Create a Redis cluster

Development environment]

  1、win7

  2. Redis 3.0 64-bit

  3. ruby ​​environment

  All the installation packages used in the test and my test configuration** http://pan.baidu.com/s/1qXmO3fQ

[ruby environment preparation]

  1. Double-click Rubtinstaller-2.2.3-x64.exe directly to install

  

  2. Install RubyGems

  Run under cmd:

    gem sources --remove  https://rubygems.org/delete  the original source//The source that comes with ruby ​​is sometimes very slow due to the wall, we replace it with the source of Taobao, otherwise the following installation of redis dependencies will fail

    gem sources -a  http://gems.ruby-china.org/Add  Taobao sources

    gem sources -l View existing sources
    gem install redis Install redis dependencies

【redis cluster】

  1. At least three master nodes are required for the normal operation of the cluster, so we create 6 nodes, three master nodes and three slave nodes. For details, please refer to the documentation. I will simplify the steps of the documentation: create 6 folders as 7000-7005, one redis node is stored under each folder. Here is the redis installed on each machine when clustering, put a downloaded redis in each folder, ( note that appendonly.aof, dump.rdb, nodes.conf under the file save the information of my machine, need to delete ) as shown in the figure:

  

 

  2. Create the configuration file redis.conf and other 7000-7004 folders and so on, pay attention to modify the corresponding port number, the cluster-enabled option in the file is used to open the cluster mode of the instance, and the cluster-conf-file option is set Specifies the path to save the node configuration file, the default value is nodes.conf. The nodes.conf node configuration file does not need to be modified manually, it is created by the Redis cluster at startup and automatically updated when necessary.

  

  3. Create a startup script 7005.bat, so that you don't have to type commands all the time, and the name can be changed at will. The same is true for other folders: redis-server.exe redis.conf

【Start cluster】

  1. Configure each instance according to the above, mainly change the port number, run the 7000.bat-7005.bat script to start six redis instances

  2. cd to the directory where redis-trib.rb is located and run the command 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

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324947459&siteId=291194637