Installation
Cd/root/downloadwget http://download.redis.io/releases/redis-3.0.7.tar.gzTar xzf Redis-3.0. 7.Tar.GZCD Redis-3.0. 7makemkdir/usr/Local/redis#redis-server, Redis-benchmark, Redis-cliIn Redis-3.0. 7Under/SRC, Redis.Conf in Redis-3.0. 7Under CP Redis-server/usr/Local/REDISCP Redis-benchmark/usr/Local/REDISCP Redis-cli/usr/Local/REDISCP Redis.conf/usr/Local/rediscd/usr/Local/redis
Start (port number defaults to 6379)
#添加&符号是为了让服务在后台运行redis-server redis.conf &
Detection
#使用`redis-cli`客户端检测连接是否正常./redis-cli#如果更改了端口,使用`redis-cli`客户端连接时,也需要指定端口,例如:#./redis-cli -p 6380127.0.0.1:6379set)127.0.0.1:6379set"hello world"OK127.0.0.1:6379get key"hello world"
Stop it
#使用客户端redis-cli shutdown
Master-Slave configuration
1, the above installed a redis as master, and then use the VMware virtual machine cloning function to clone just that Linux system as a slave, and modify its IP to 192.168.1.101 (master-ip:100,slave-ip : 101).
2. Modify the Redis configuration file for slave:
slaveof 192.168.1.7 6379 (mapped to the primary server)
If Master sets the authentication password, you also need to configure Masterauth,eg:masterauth admin. If you do not set a password, you do not need to configure it.
After configuring the Redis service to start slave, OK, master and slave configuration is complete.
Test it below:
Perform the info command on the master and Slave clients (REDIS-CLI) to see the results as follows:
Master
Slave
Then execute set age 24 in master
Perform get age on slave to see if you can get 24 and if you can get the value then the configuration is successful.
Linux Installation Redis Service