CentOS7.1 configure a redis Cluster
Download the centos7.1
Http://www.centoscn.com/CentosSoft/iso/2015/0402/5070.html
Thunder: // timeout 1pa
1. Install the latest reids version ~
[Html] view plaincopy
- Wgethttp: // download. redis. io/releases/redis-3.2.8.tar.gz
- Tarxzfredis-3.2.8.tar.gz
- Cdredis-3.2.8
- Make
For single-node redis, it can be started directly after installation.
2. Install the ruby package
[Html] view plaincopy
- Yum-yinstallruby
3. Install the rubygams package
[Html] view plaincopy
- Https://rubygems.org/pages/download
- Tar-zxvfrubygems-2.2.2.tar
- Cdrubygems-2.2.2
- Rubysetup. rb
4. As expected, the following error occurs: 'require ': cannot load such file -- json/pure
Install json_pure
[Html] view plaincopy
- Geminstalljson_pure
5. Install redis (repeated installation)
[Html] view plaincopy
- Geminstallredis
6. Create Multiple folders 7000-7005
Copy redis. conf to various directories
Cp redis. conf 7000
.....
Cp redis. conf 7005
7. modify the content of the redis. conf configuration file
[Html] view plaincopy
- Port7000 // port 7003
- Bind local ip // The default ip address is 127.0.0.1, which needs to be changed to the ip address accessible to machines on other nodes. Otherwise, the corresponding port cannot be accessed during cluster creation and the cluster cannot be created.
- Daemonizeyes // run in redis background
- Pidfile/var/run/redis_7000.pid // pidfile corresponds to 7002
- Cluster-enabledyes // enable the cluster to remove the comment #
- Cluster-config-filenodes_7000.conf // cluster configuration profile automatically generated 7002
- Cluster-node-timeout15000 // request timeout default 15 seconds, configurable
- Appendonlyyes // aof log is enabled as needed. It records a log for each write operation.
Replace text content in linux
: G/str1/s // str2/g
7. Start each node
Redis-server 7000/redis. conf
... 7001
... 7005
8. Create a cluster
[Html] view plaincopy
- ./Redis-trib.rbcreate -- replicas1127.0.0.1: 7000127.0.0.1: 7001127.0.0.1: 7002127.0.0.1: 7003127.0.0.1: 7004127.0.0.1: 7005
- >>> Creatingcluster
- Connectingtonode127.0.0.1: 7000: OK
- Connectingtonode127.0.0.1: 7001: OK
- Connectingtonode127.0.0.1: 7002: OK
- Connectingtonode127.0.0.1: 7003: OK
- Connectingtonode127.0.0.1: 7004: OK
- Connectingtonode127.0.0.1: 7005: OK