Reference documents:
https://www.cnblogs.com/yaopengfei/p/12418227.html
https://blog.csdn.net/weixin_42694286/article/details/92974535
https://blog.csdn.net/qq_42815754/article/details/82912130
1, the configuration Redis service
Download Redis-x64-3.2.100 zip format version, to extract the D occurs, then copy the profile 6, respectively: 6279 ~ 6384
download directory: https: //github.com/MSOpenTech/redis/releases/
The main contents of the configuration file as follows: [to] redis.windows-service6379.conf example, the same is true of several other files to modify, and then the port number 6379 should also be amended to correspond to the numbers
bind 192. ***. **. ** #IP changed to the corresponding IP server
port 6379 # port number
Save appendonly yes # data format for aof
appendfilename "appendonly.6379.aof" # save file data
cluster-enabled yes # if the open cluster
cluster-config-file nodes.6379.conf # cluster node configuration file
Timeout cluster-node-timeout 15000 # cluster node
cluster-slave-validity-factor 10 # checks whether the master can be copied from the check nodes 10
cluster-migration-barrier 1 # configuration data transfer
cluster-require-full-coverage yes # master node copied from the whole amount
protected-mode no # enabled by default, need to temporarily shut down, or bottom can not configure a cluster configuration is complete and then open
After all modifications, installation services operate, open cmd, switch to the directory Redis, respectively, execute the command to install the service:
D:\Redis-x64-3.2.100_cluster\redis-server.exe --service-install D:\Redis-x64-3.2.100_cluster\redis.windows-service6379.conf --service-name RedisService6379
D:\Redis-x64-3.2.100_cluster\redis-server.exe --service-install D:\Redis-x64-3.2.100_cluster\redis.windows-service6380.conf --service-name RedisService6380
D:\Redis-x64-3.2.100_cluster\redis-server.exe --service-install D:\Redis-x64-3.2.100_cluster\redis.windows-service6381.conf --service-name RedisService6381
D:\Redis-x64-3.2.100_cluster\redis-server.exe --service-install D:\Redis-x64-3.2.100_cluster\redis.windows-service6382.conf --service-name RedisService6382
D:\Redis-x64-3.2.100_cluster\redis-server.exe --service-install D:\Redis-x64-3.2.100_cluster\redis.windows-service6383.conf --service-name RedisService6383
D:\Redis-x64-3.2.100_cluster\redis-server.exe --service-install D:\Redis-x64-3.2.100_cluster\redis.windows-service6384.conf --service-name RedisService6384
After installation is complete, open the service, you will see the following services, and then they all start
Once started, you will see in the persistence directory is set to generate 12 files, my persistence directory is set in the data file path (by default in the root directory)
2, install the Ruby runtime environment
Download the Ruby runtime environment file: http: //dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.4-x64.exe
When installing, pay attention to check the latter two, it automatically configure the environment variables, this final installation in this folder [Ruby22-x64]
3, under the environment Redis Ruby driver download
Download Path: https://rubygems.org/gems/redis/versions/3.2.2 taking into account the compatibility, download the 3.2.2 version here
Then download the file: Copy redis-3.2.2.gem to the installation directory of the Ruby runtime environment
Open cmd, switch to the installation directory of the Ruby runtime environment, my installation directory: C: \ Ruby22-x64
Then execute the command: gem install --local C: \ Ruby22-x64 \ redis-3.2.2.gem
4, download Redis cluster tool redis-trib.rb
Download path is as follows: https: //github.com/beebol/redis-trib.rb download, unzip the file, it is recommended to file into the root directory of Redis
Open cmd, switch to the Redis directory, execute the command:
ruby redis-trib.rb create --replicas 1 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384
Here replicas 1,1 representative of a master corresponding to a slave, to 2, it represents a master slave corresponds to 2
Note: 127.0.0.1 is your configuration file bundled IP, if you bind your profile is not 127.0.0.1, you have to follow the change in command
If you encounter the below error, reference documentation: https: //blog.csdn.net/maoyuanming0806/article/details/103171182
My reason being given is to set the password, the solution: that is, after the first comment out all passwords, and other cluster configuration is complete, re-open the password.
Refer to the documentation: https: //blog.csdn.net/xufei512/article/details/82758676
After solving all the roadblocks, the successful installation of the drive:
5, Redis cluster password
1, redis-trib.rb If you are using tools to build a cluster, do not build a cluster configuration password before completion, completed and then build a cluster-by-machine password by config set + config rewrite command
2, if you set a password for the cluster, requirepass and masterauth need to set up, otherwise occur when switching from the master, you will encounter licensing issues
3, password each node must be consistent, otherwise it will fail Redirected
6, the test
Using Client Connection Redis cluster, you will find only db0 that a database, as shown below:
The reason: Reference document: https: //blog.csdn.net/yaomingyang/article/details/79094869
1, redis redis.conf default configuration file in the database is the number of stand-alone mode 16
2, in a clustered mode does not work in this configuration, the cluster client does not support multi-database db, only a default database is SELECT 0
3, from the slave node cluster is not supported by default read and write operations, but can perform a read operation performed after the readonly command
Next: In 6379 this port to add a command set
You will find all the other five will be increased simultaneously