Installation environment: six centos7.4
-
Each node in the network to download the official release packages, you can find yourself Quguan network: wget http://download.redis.io/releases/redis-5.0.5.tar.gz
-
Decompression: tar -zxvf redis-5.0.5.tar.gz
-
Enter the directory: cd redis-5.0.5, if a custom directory, then extract the required otherwise specified
-
Compile: make, you can compile, generate binary files, to run redis in the src directory
-
If prompted jemalloc when compiling / jemalloc.h: No such file or directory reused make MALLOC = libc installed
-
Compiled to run stand-alone
-
Redis.conf modify the configuration, use one of the most simple configuration: you can make a backup of the original, and then generate a new
Port 6379
Cluster-Enabled yes
Cluster-config-File nodes.conf // will start when the generation and redis the node-management-timeout 5000 Cluster
appendOnly yes
daemonize yes // background
bind 10.99.32.16 // need to bind its own ip, otherwise not have access to the outside, each node do not need to modify the configuration inside // add content -
Each node running instance: src / redis-server ./redis.conf, success will be prompted to start
1467: C 28 Jun 2019 20: 22: 30.943 # oO0OoO0OoO0Oo Redis IS Starting oO0OoO0OoO0Oo
1467: C 28 Jun 2019 20: 22: 30.943 # = Version 5.0.5 redis, = 64 bits, the commit = 00000000, Modified = 0, PID = 1467, Just Started
1467: On Jun 2019 C 20 is 28: 22 is: the Configuration loaded 30.943 # -
Before starting the script :( version requires ruby script needs some more operations, you can use 5.0 redis-cli command)
src / redis-cli --cluster the Create 10.99.32.3:6379 10.99.32.9:6379 10.99.32.31:6379 10.99.32.10:6379 10.99.32.12:6379 10.99.32.13:6379 --cluster-replicas 1 -
After a successful start node will be displayed:
. [The OK] All Nodes Agree slots the About the Configuration
>>> Open slots for the Check ...
>>> the Check slots coverages ...
. [The OK] All slots 16384 Covered's six copies of a node there 3M3S -
Connected to the cluster src / redis-cli -h 10.99.32.3 -c, without using -c, will be reported when the setting key: redis (error) MOVED 7638
-
After setting the cache, and only one of its Slave M have the data, no other node has this data
Additional nodes
src/redis-cli --cluster add-node 10.99.32.32:6379 10.99.32.3:6379
View node
src/redis-cli -h 10.99.32.9 -c cluster nodes
Delete Node
src/redis-cli --cluster del-node 10.99.32.9:6379 08859612fdf824fd07c538c65073a86ca7d522cb
You need to obtain the node node-id