标签:拷贝 .gz syn oca lis value stop ofo dep
服务器A:192.168.3.188 centos7yum -y install wget vim tcl gcc make
mkdir –p /usr/local/redis
cd !$
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
tar –xvf redis-4.0.1.tar.gz
make
make test-没报错继续
报错了修改这里
/usr/local/redis/redis-4.0.1/tests/integration
replication-2.tcl里面的after 10000
拷贝redis命令到环境变量
cp -a src/redis-server src/redis-cli src/redis-sentinel src/redis-trib.rb src/redis-check-aof src/redis-check-rdb src/redis-benchmark /usr/local/bin/
mkdir cluster-redis
cd cluster-redis
mkdir {7000,7001,7002}
其中一个redis.conf配置文件内容
bind 192.168.3.188
protected-mode yes
port 7000
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis_7000.pid
loglevel notice
logfile "/usr/local/redis/cluster-redis/7000/redis_7000.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump7000.rdb
dir /usr/local/redis/cluster-redis/7000/
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
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly yes
appendfilename "appendonly7000.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
cluster-enabled yes
cluster-config-file nodes-7000.conf
cluster-node-timeout 15000
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
其它redis配置文件修改相应的端口和数据库名称就好了
依次启动redis
redis-server /usr/local/redis/cluster-redis/7000/redis.conf
redis-server /usr/local/redis/cluster-redis/7001/redis.conf
redis-server /usr/local/redis/cluster-redis/7002/redis.conf——另一台服务器也启动三个redis节点
提前安装以下两个依赖,zlib和openssl
yum -y install zlib-devel
yum install openssl-devel -y
再安装ruby,ruby-2.3.4.tar.gz,解压后编译安装
./configure
Make && make install
Ruby –v 版本在2.2.2以上
安装redis,如果无法安装,切换gem源,看以下链接更换gem源
https://ruby.taobao.org/
Gem install redis
启动集群
redis-trib.rb create --replicas 1 192.168.3.188:7000 192.168.3.188:7001 192.168.3.188:7002 192.168.3.189:7000 192.168.3.189:7001 192.168.3.189:7002
登陆某台节点
redis-cli 192.168.3.188 -c -p 7001
察看集群状态
cluster info
cluster nodes
标签:拷贝 .gz syn oca lis value stop ofo dep
原文地址:http://blog.51cto.com/12185273/2313021