在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。