Test Redis cluster cluster pits notes on Windows

Source: Internet
Author: User
Tags failover redis cluster


The principles of Redis cluster implementation refer to a minimum of 3 nodes for the Http://www.tuicool.com/articles/VvIZje cluster environment. It is recommended to use 6 node configurations, which are 3 primary nodes and 3 slave nodes. Create a new 6 folder 7000/7001/7002/7003/7004/7005 copy the redis.windows.conf and then modify the following options in the configuration file
    • Port 7000 (redis port number)
    • daemonize Yes (whether it is not supported on a later stage daemon run on windows, can be ignored)
    • cluster-enabled Yes ( Open cluster)
    • cluster-config-file nodes.conf (in cluster mode, each REDIS node generates its own cluster configuration file, which does not need to be manually modified and maintained by Redis itself)
    • Cluster-node-timeout 5000 (cluster mode, when the current node in the KeepAlive probe with other nodes, how long does not respond when the other node is considered to be in the fail state, which is 5 seconds)
    • appendonly Yes ( Whether the appendonlylog is turned on and on, each write will record a log, which will improve the data anti-risk ability, but affect efficiency.
    • cluster-require-full-coverage yes (default = yes, after losing a certain scale key (perhaps node cannot connect or hang up), the cluster stops accepting writes No: The rest of the slots are available when some slots do not have an active node. Is that 1 of these instances are hung, and will not cause the entire Redis cluster to be unavailable)
    • cluster-slave-validity-factor 10 (Control settings related to node failover are set to 0, The slave node will always try to start failover. Set to a positive number, lose the General Assembly at a certain time (factor* node timeout), no longer failover)
Put in the above 5 folders (note: After the copy is completed, the redis.conf file in the 7001/7002/7003/7004/7005 directory to modify the port parameter, respectively, the name of the corresponding folder)    start each of the 6 Redis instance  redis-server.exe h:\tools\cluster\7000\redis.7000.confredis-server.exe h:\tools\cluster \7001\redis.7001.confredis-server.exe h:\tools\cluster\7002\redis.7002.confredis-server.exe h:\tools \cluster\7003\redis.7003.confredis-server.exe h:\tools\cluster\7004\redis.7004.confredis-server.exe  h:\tools\cluster\7005\redis.7005.conf  will see the following log information when it starts, prompting that node.conf does not exist, and that each node creates a nodeid    The final step of the build cluster configuration    source src file provides a script file called Redis-trib.rb, which is a ruby script used to create clusters, detect and re-shard, etc. but you have to install the Ruby environment.   Then install the Redis Ruby function library    Run command: Ruby h:\tools\cluster\redis.trib.rb create --replicas  1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004  127.0.0.1:7005   in the process of establishing  ruby will require change  nodes.conf, enter  yes  on it.   I am looking forward to the news of success when I enter Yes. Who knows to give me an infinity of WAiting?
H:\Tools\cluster>ruby H:\Tools\cluster\redis.trib.rb create --replicas 0 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005
>>> Creating cluster
Connecting to node 127.0.0.1:7001: OK
Connecting to node 127.0.0.1:7002: OK
Connecting to node 127.0.0.1:7003: OK
Connecting to node 127.0.0.1:7004: OK
Connecting to node 127.0.0.1:7005: OK
>>> Performing hash slots allocation on 5 nodes...
Using 5 masters:
127.0.0.1:7001
127.0.0.1:7002
127.0.0.1:7003
127.0.0.1:7004
127.0.0.1:7005
M: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7001
   slots:0-3276 (3277 slots) master
M: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7002
   slots:3277-6553 (3277 slots) master
M: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7003
   slots:6554-9829 (3276 slots) master
M: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7004
   slots:9830-13106 (3277 slots) master
M: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7005
   slots:13107-16383 (3277 slots) master
Can I set the above configuration? (type ‘yes‘ to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join..........................................................................................................................................................

NND, a moment to touch the mind, on the Internet a few programs have tried or not. Google did not find the relevant information. Just posted on StackOverflow to help foreigners. Http://stackoverflow.com/questions/37193338/redis-cluster-error still no one bird me ah. Maybe my english is too bad. Because it's using Ruby's code to configure cluster. The next step is to debug the Ruby code to see where the problem is, causing the block to waiting. To modify the Redis.trib.rb file can be debugged, because the parameters are not passed through the command of the argv pass. debugging when running to the following code when the error message: ERR Slot 6387 is already busy solution is changed to the following (http://stackoverflow.com/questions/34230131/ Err-slot-xxx-is-already-busy-rediscommanderror) OK solves a problem. F5 operation will not error, but TMD will block in waiting. 10,000 champ is omitted here. Analysed it for a moment.  Here will 7001,7002,7003,7004,7005 will be sent to 7000 meet this command. And then you get your signature, and you're assigned a successful discovery.
Signatures
It's full of 7000 receipts signed. No, it's not. What should be received is 7001--7005. Unless you're sending it to yourself? In a closer look, 7000-7005 of the Nodeid are the same. It's no fault! Before looking back at the command to start Redis, only to find that the created Nodeid are the same, the beginning is wrong!!! The configuration is modified as follows:
Port 7005appendonly yesappendfilename "appendonly.7005.aof" cluster-enabled yescluster-config-file Nodes.7005.confcluster-node-timeout 15000cluster-slave-validity-factor 10cluster-migration-barrier 1cluster-require-full-coverage Yes And then come back. The following results are shown: >>> creating clusterconnecting to node 127.0.0.1:7000: okconnecting  to node 127.0.0.1:7001: OKConnecting to node 127.0.0.1:7002:  OKCONNECTING TO NODE 127.0.0.1:7003: OKCONNECTING TO NODE 127.0.0.1:7004:  OKConnecting to node 127.0.0.1:7005: OK>>> Performing hash  Slots allocation on 6 nodes ... using 3 masters:127.0.0.1:7000127.0.0.1:7001127.0.0.1:7002adding replica 127.0.0.1:7003  to 127.0.0.1:7000Adding replica 127.0.0.1:7004 to 127.0.0.1:7001Adding  replica 127.0.0.1:7005 to 127.0.0.1:7002m: fa810d10bca15ffc480953329c12da988fc3f52a  127.0.0.1:7000   slots:0-5460  (5461 slots)  masterM:  65e347cbe71aeae7b983ce85cf14eec1f0c1e0b7 127.0.0.1:7001   slots:5461-10922  (5462  slots)  masterm: 17739ba52d2c171db5c960962e4ec8845c6e63b0 127.0.0.1:7002   slots :10923-16383  (5461 slots)  masterS: d7c9a9c3982dde2f0cc551f227e023b5746373b5  127.0.0.1:7003   replicates fa810d10bca15ffc480953329c12da988fc3f52as:  fbac6089f7889b68726dd152daaf71834a97dd6e 127.0.0.1:7004   replicates  65e347cbe71aeae7b983ce85cf14eec1f0c1e0b7s: 76867e63d75e1ff00dc4a5f60a91ea4634a083aa 127.0.0.1:7005    replicates 17739ba52d2c171db5c960962e4ec8845c6e63b0>>> Nodes  configuration updated>>> assign a different config epoch to  each node>>> sending cluster meet messages to join the  clusterwaiting for the cluster to join>>> performing cluster  check  (using node 127.0.0.1:7000) m: fa810d10bca15ffc480953329c12da988fc3f52a 127.0.0.1:7000   slots:0-5460  (5461 slots)   masterm: 65e347cbe71aeae7b983ce85cf14eec1f0c1e0b7 127.0.0.1:7001   slots:5461-10922   (5462 slots)  masterM: 17739ba52d2c171db5c960962e4ec8845c6e63b0 127.0.0.1:7002    slots:10923-16383  (5461 slots)  masterS:  d7c9a9c3982dde2f0cc551f227e023b5746373b5 127.0.0.1:7003   replicates  fa810d10bca15ffc480953329c12da988fc3f52as: fbac6089f7889b68726dd152daaf71834a97dd6e 127.0.0.1:7004    replicates 65e347cbe71aeae7b983ce85cf14eec1f0c1e0b7S:  76867e63d75e1ff00dc4a5f60a91ea4634a083aa 127.0.0.1:7005   replicates  17739ba52d2c171db5c960962e4ec8845c6e63b0[ok] all nodes agree about slots  configuration.>>> check for open slots...>>> check slots  Coverage:. [Ok] all 16384 slots covered.


Test it.


Set a value from port 7000 and set the expiration time to 10 seconds and then get out of Port 7001. No problem!
Finally: It is recommended that individuals play on the production or do not make redis on Windows.


Test Redis cluster cluster pits notes on Windows


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.