redis文档:http://doc.redisfans.com/

参考:https://www.cnblogs.com/wuxl360/p/5920330.html

          http://www.cnblogs.com/carryping/p/7447823.html

         https://www.jianshu.com/p/2639549bedc8

 

1. 下载并解压

cd /root/software
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
tar -zxvf redis-3.2.4.tar.gz 

2. 编译安装

cd redis-3.2.3
make PREFIX=/usr/local/redis-3.2.3 install
ln -sv /usr/local/redis-3.2.3 /usr/local/redis

3. 将 redis-trib.rb 复制到 /usr/local/bin 目录下

cd src
cp redis-trib.rb /usr/local/bin/  

4. 创建 Redis 节点

首先在机器上/usr/local/redis/ 目录下创建 cluster-test 目录;

mkdir redis_cluster  

在cluster-test 目录下,创建名为7001、7002、7003,7004、7005、7006的目录,并将 redis.conf 拷贝到这刘个目录中

mkdir 7001 7002 7003 7004 7005 7006
cp redis.conf cluster-test/7001 cp redis.conf cluster-test/7002 cp redis.conf cluster-test/7003
cp redis.conf cluster-test/7004 cp redis.conf cluster-test/7005 cp redis.conf cluster-test/7006    

分别修改这6个配置文件,修改如下内容

bind 0.0.0.0
port 7001
dir /usr/local/redis/cluster-test/7001
pidfile /var/run/redis_7001.pid
cluster-enabled  yes                           
cluster-config-file  nodes_7001.conf
cluster-node-timeout  15000 
appendonly yes
appendfilename "appendonly.aof"
daemonize yes

protected-mode yes
tcp-backlog 511
timeout 0
tcp-keepalive 300
supervised no
loglevel verbose
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

7001 redis.conf