Redis Installation
About Redis
Redis is fully open source free, adheres to the BSD protocol and is a high-performance Key-value database.
Redis and other Key-value cache products have the following three features:
- Redis supports data persistence, which saves data in memory on disk and can be loaded again for use when restarting.
- Redis not only supports simple key-value types of data, but also provides storage of data structures such as List,set,zset,hash.
- Redis supports backup of data, that is, Master-slave mode of data backup.
Redis Benefits
- The performance is very high –redis can read the speed is 110,000 times/s, the write speed is 81,000 times/s.
- Rich data types –redis support binary case Strings, Lists, hashes, sets and Ordered sets data type operations.
- Atomic –redis All operations are atomic, meaning either successful execution or failure to execute at all. A single operation is atomic. Multiple operations also support transactions, namely atomicity, wrapped by multi and EXEC commands.
- Rich features –redis also supports publish/subscribe, notifications, key expiration, and more
Redis download
Installation
Download, unzip, compile:
$ wget http://download.redis.io/releases/redis-4.0.8.tar.gz$ tar xzf redis-4.0.8.tar.gz$ cd redis-4.0.8$ make
Binary files are compiled after completion in the SRC directory, start the Redis service with the following command:
$ src/redis-server
You can use the built-in client command redis-cli:
$ src/redis-cliredis> set foo barOKredis> get foo"bar"
The use of Redis
Used in Linux:
redis operations: Linux boot: src/redis-server redis.conf View process: -NTLP View details, with IP address ifconfig kill process -911148
Locate the Process ps-e|grep keyword (for example, Redis) to view text content vim redis.conf exit and save content ZZ view detailed ls into redis directory CD Red is-4.0. 8 . tar.gz Turn off firewall systemctl Stop firewalld.service View firewall status firewall-cmd--state
The steps are as follows:
1. Enter the Redis directory and start
2. Configure the redis.conf file.
Note Bind 127.0.0.1 First, or you cannot connect to another IP
Daemonizze no change to daemonize Yes
AppendOnly no change to appendonly Yes
Open the comment here, then add the password for a long time.
3. Turn off the firewall
Systemctl Stop Firewalld.service #关闭防火墙
Firewall-cmd--state #查看防火墙是否关闭 not running
#这样window才可以调用linux
Application in window:
Running Redis in Linux, and window calls Redis in Linux
1, first Redis in Linux to start,
2, Import Redis
3,r=redis. Redis (host= "IP address in Linux", password= "password", port=6379) ps:port default is 6379
4,r.set (' A ', ' B ') #加入内容
Redis--linux System Download install and run Redis