redis cluster concept:
A group of redis services, to provide services to the outside world (originally a person to work, now a group of people to work together).
The characteristics of redis cluster:
- Each redis service in the redis cluster is a node (node) in the cluster.
- In redis cluster, redis services are divided into many groups, one of which is the main node.
The rest are slave nodes, which are used to back up data in the master node. - The main node s in redis communicate with each other to inform each other of their own information.
- When a primary node in the cluster is suspended, one of its slaves will become the primary node.
Configuration master
python@ubuntu:~$ ifconfig ens33 Link encap:Ethernet hardware address 00:50:56:3a:f9:a8 inet address:192.168.78.53 Radio broadcast:192.168.78.255 Mask:255.255.255.0 inet6 address: fe80::537a:9f77:a5e9:c86f/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 //Receiving Packet: 1511270 Error: 0 Drop: 2 Overload: 0 Frames: 0 //Sending Packet: 2098 Error: 0 Drop: 0 Overload: 0 Carrier: 0 //Collision: 0 Send queue length: 1000 //Receive bytes: 160435514 (160.4 MB) Send bytes: 228472 (228.4 KB) lo Link encap:Local loopback inet address:127.0.0.1 Mask:255.0.0.0 inet6 address: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 //Receiving Packet: 6146 Error: 0 Drop: 0 Overload: 0 Frames: 0 //Sending Packet: 6146 Error: 0 Drop: 0 Overload: 0 Carrier: 0 //Collision: 0 Send queue length: 1 //Receive bytes: 1175883 (1.1 MB) Send bytes: 1175883 (1.1 MB)
Modify the/etc/redis/redis.conf file
python@ubuntu:~$ sudo vi /etc/redis/redis.conf bind 127.0.0.1 192.168.78.53
Restart redis service
python@ubuntu:~$ sudo service redis stop python@ubuntu:~$ redis-server /etc/redis/redis.conf
Configuration from
Copy/etc/redis/redis.conf file
sudo cp /etc/redis/redis.conf /etc/redis/slave.conf
Modify redis/slave.conf file
sudo vi slave.conf
Editorial content
bind 192.168.78.53 slaveof 192.168.78.53 port 6378
redis services
sudo redis-server slave.conf
View master-slave relationships
redis-cli info Replication
Logged in
redis-cli -p 6379
Login from
redis-cli -p 6378