1. Install the GCC environment
View version 【gcc -v】
gcc installation 【yum install gcc-c ++】
2. Install Ruby and Rubygems
Installing Ruby
installs version 2.0 by default.
Requires> = 2.3 version or above.
Perform the following:
【yum install centos-release-scl-rh】
【yum install rh-ruby23 -y】
【scl enable rh-ruby23 bash】
安装Rubygems【yum install rubygems】
4. Offline installation of Rdis-5.0.8 requires xftp 6
Official website address 【https://redis.io/download】
Create a folder in the root directory address / home [mkdir redis]
5. Use XFTP 6 to upload the Rrdis compressed package to the folder / home / redis / install Redis
Unzip [tar -zxvf redis-3.2.9.tar.gz]
Install Redis and
go to the location of the installation package [cd /home/redis/redis-5.0.8]
Install [make && make install]
6. At this point Redis installation is complete, configure Redis cluster
Create 6 folders to store Redis configuration of Redis 6 different ports.
【Cd / home / redis /】
【mkdir 700 {1,2,3,4,5,6}】
Go to the directory [cd usr / local / bin], copy the files [redis-cli], [redis-server] to the 700, 1, 2, 3, 4 folders.
【cp redis-cli redis-server /home/redis/7001】
【cp redis-cli redis-server /home/redis/7002】
【cp redis-cli redis-server /home/redis/7003】
【cp redis-cli redis-server /home/redis/7004】
【cp redis-cli redis-server /home/redis/7005】
【cp redis-cli redis-server /home/redis/7006】
Create a redis.conf file for each independent directory and configure the following (with the help of tool XFTP6):
port 7001
#Configure according to different ports here daemonize yes
appendonly yes
cluster-enabled yes
cluster-config-file "nodes.conf"
cluster-node-timeout 5000
logfile ""
bind 0.0.0.0
dir "/ home / redis / 7001" # Configure here by different ports
Start the redis service on 6 different ports
【/home/redis/7001/redis-server /home/redis/7001/redis.conf】
【/home/redis/7002/redis-server /home/redis/7002/redis.conf】
【/home/redis/7003/redis-server /home/redis/7003/redis.conf】
【/home/redis/7004/redis-server /home/redis/7004/redis.conf】
【/home/redis/7005/redis-server /home/redis/7005/redis.conf】
【/home/redis/7006/redis-server /home/redis/7006/redis.conf】
View the running status of redis:
【Netstat -tnulp | seized red】
【Ps aux | grep redis】
Start the Redis cluster:
【cd home/redis】
【redis-cli --cluster create 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 127.0.0.1:7006 --cluster-replicas 1】
Set iptables rules to allow external access to 7001, 2, 3, 4, 5, 6 ports
[iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 7001 -j ACCEPT]
execute [service iptables save】
View cluster status
Log in to the Redis cluster [ redis-cli -c -p 7001] to test:
Principle: The redis client can arbitrarily access a redis instance. If the data is not in the instance, the client is redirected to guide the client to access the required redis instance.
This article refers to: https://www.cnblogs.com/xuliangxing/p/7146868.html , https://www.diandian100.cn/eb5223a5.html