在Linux上安裝Redis集群可以通過以下步驟完成:
wget http://download.redis.io/releases/redis-x.x.x.tar.gz
tar xzf redis-x.x.x.tar.gz
cd redis-x.x.x
make
cp redis.conf redis-7000.conf
cp redis.conf redis-7001.conf
cp redis.conf redis-7002.conf
cp redis.conf redis-7003.conf
cp redis.conf redis-7004.conf
cp redis.conf redis-7005.conf
vim redis-7000.conf
port 7000
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 5000
vim redis-7001.conf
port 7001
cluster-enabled yes
cluster-config-file nodes-7001.conf
cluster-node-timeout 5000
vim redis-7002.conf
port 7002
cluster-enabled yes
cluster-config-file nodes-7002.conf
cluster-node-timeout 5000
vim redis-7003.conf
port 7003
cluster-enabled yes
cluster-config-file nodes-7003.conf
cluster-node-timeout 5000
vim redis-7004.conf
port 7004
cluster-enabled yes
cluster-config-file nodes-7004.conf
cluster-node-timeout 5000
vim redis-7005.conf
port 7005
cluster-enabled yes
cluster-config-file nodes-7005.conf
cluster-node-timeout 5000
src/redis-server redis-7000.conf
src/redis-server redis-7001.conf
src/redis-server redis-7002.conf
src/redis-server redis-7003.conf
src/redis-server redis-7004.conf
src/redis-server redis-7005.conf
src/redis-cli --cluster create 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 --cluster-replicas 1
這樣就完成了在Linux上安裝Redis集群的步驟。需要注意的是,在創建集群時需要指定好每個節點的IP和端口,并且要確保每個節點的配置文件中的cluster-enabled配置項為yes。