Test the Cluster of Redis Cluster on Windows to fill in the note, rediscluster

Source: Internet
Author: User
Tags redis cluster

Test the Cluster of Redis Cluster on Windows to fill in the note, rediscluster
For the principle of redis cluster implementation, see the http://www.tuicool.com/articles/VvIZje cluster environment requires at least three nodes. We recommend that you use six nodes, namely three master nodes and three slave nodes. Create 6 new folders: 7000/7001/7002/7003/7004/7005 copy redis. windows. conf and modify the following options in the configuration file.

  • Port 7000 (redis port number)
  • Daemonize yes (whether to run windows in the daemon mode in the future is not supported, but can be ignored)
  • Cluster-enabled yes (enable cluster)
  • Cluster-config-file nodes. conf (in cluster mode, each redis node generates its own cluster configuration file. This file does not need to be manually modified and is maintained by redis itself)
  • Cluster-node-timeout 5000 (in cluster mode, when the current node is alive with other nodes, when there is no response, it is considered that the other nodes are in the fail state, the above is 5 seconds)
  • Appendonly yes (whether to enable appendonlylog. If it is enabled, a log is recorded for each write operation, which improves data risk resistance but affects efficiency .)
  • Cluster-require-full-coverage yes (the default value is Yes. After a certain percentage of keys are lost (Node may not be connected or fails), the cluster stops accepting the write operation no: some slots can be used when they do not have active nodes. That is, if one of the instances fails, the entire redis cluster will not be available)
  • Cluster-slave-validity-factor 10 (control slave node FailOver related settings to set to 0, the slave node will always try to start FailOver. it is set to a positive number, and the loss of the common node is at a certain time (factor * node TimeOut), and no FailOver is performed)
Put them in the five folders above (Note: After the copy is complete, modify redis under the 7001/7002/7003/7004/7005 directory. the port parameters in the conf file are changed to the corresponding folder name respectively) Start the six 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.conf
Redis-server.exe H: \ Tools \ cluster \ 7003 \ redis.7003.conf
Redis-server.exe H: \ Tools \ cluster \ 7004 \ redis.7004.conf
Redis-server.exe H: \ Tools \ cluster \ 7005 \ redis.7005.conf
After startup, the following log information is displayed, prompting Node. conf does not exist, and each node creates a NodeID set up cluster configuration source code src file provides a script file called redis-trib.rb, is a Ruby script for creating clusters, detection and re-sharding. but you have to install the ruby environment. Redis ruby function export 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 Ruby requires nodes to be changed when it is created. conf, enter yes. 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 clusterConnecting 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 5 nodes...Using 5 masters:127.0.0.1:7001127.0.0.1:7002127.0.0.1:7003127.0.0.1:7004127.0.0.1:7005M: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7001 slots:0-3276 (3277 slots) masterM: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7002 slots:3277-6553 (3277 slots) masterM: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7003 slots:6554-9829 (3276 slots) masterM: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7004 slots:9830-13106 (3277 slots) masterM: 6c5c8b20e7f051e19a41e96a1d0b37cc79abf647 127.0.0.1:7005 slots:13107-16383 (3277 slots) masterCan 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 clusterWaiting for the cluster to join..........................................................................................................................................................
NND: I was confused at the moment. I tried several solutions on the Internet, but I still couldn't. Google does not find the relevant information. I posted a post on stackoverflow to ask for help from foreigners. Http://stackoverflow.com/questions/37193338/redis-cluster-errorit's still nobody else .. Maybe my English is too bad. Because ruby code is used to configure the cluster. Next, we will debug the ruby code to see where the block is in waiting. You need to modify the redis. trib. rb file before debugging, because the parameters are not passed through the argv command. ERR Slot 6387 is already busy solution is changed to the following (http://stackoverflow.com/questions/34230131/err-slot-xxx-is-already-busy-rediscommanderror) and then will receive the signature before it is assigned successfully signaturesAll of them are receipt signatures of 7000. No. It should be 7001--7005. Unless it is sent to yourself? Take a closer look, the nodeids of-are the same. No error! The following results show that the configuration is complete: test it.

Set a value from port 7000 and set the expiration time to 10 seconds. Then, get the value from port 7001. No problem!
Finally, we recommend that you do not have to engage in redis on windows for personal experience.

 

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.