下载
wget http://download.redis.io/releases/redis-3.2.2.tar.gz
安装
make
测试
make test

启动redis
/home/redis-3.2.2/src/redis-server ../redis.conf
查看:ps-ef|grep redis
阿里云安装错误
gem install redis
ERROR: Error installing redis:
redis requires Ruby version >= 2.2.2.
解决办法:
https://www.cnblogs.com/carryping/p/7447823.html
https://blog.csdn.net/afjaklsdflka/article/details/82959399
安装rvm
配置redis.conf
bind 0.0.0.0
protected-mode no
port 6380
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis_6380.pid
loglevel notice
logfile ""
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir ./
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
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
cluster-enabled yes
cluster-config-file nodes-6380.conf
cluster-node-timeout 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
启动redis
[root@sunpyServer src]# ./redis-trib.rb create --replicas 0 106.15.95.37:6380 106.12.42.149:6380 47.99.197.133:6380
>>> Creating cluster
>>> Performing hash slots allocation on 3 nodes...
Using 3 masters:
106.15.95.37:6380
106.12.42.149:6380
47.99.197.133:6380
M: a728886edc6a7a7f0b680b1f5df0e8428df78cd6 106.15.95.37:6380
slots:0-5460 (5461 slots) master
M: 039c9720444c99eac423604e34e76fd3a52b9ab6 106.12.42.149:6380
slots:5461-10922 (5462 slots) master
M: dd490a3e40aa0092e846f97de784acf27d2c9057 47.99.197.133:6380
slots:10923-16383 (5461 slots) master
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join..
>>> Performing Cluster Check (using node 106.15.95.37:6380)
M: a728886edc6a7a7f0b680b1f5df0e8428df78cd6 106.15.95.37:6380
slots:0-5460 (5461 slots) master
M: 039c9720444c99eac423604e34e76fd3a52b9ab6 106.12.42.149:6380
slots:5461-10922 (5462 slots) master
M: dd490a3e40aa0092e846f97de784acf27d2c9057 47.99.197.133:6380
slots:10923-16383 (5461 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
查看集群节点
127.0.0.1:6380> cluster nodes
039c9720444c99eac423604e34e76fd3a52b9ab6 106.12.42.149:6380 master - 0 1554997027467 2 connected 5461-10922
dd490a3e40aa0092e846f97de784acf27d2c9057 172.16.24.243:6380 myself,master - 0 0 3 connected 10923-16383
a728886edc6a7a7f0b680b1f5df0e8428df78cd6 106.15.95.37:6380 master - 0 1554997026455 1 connected 0-5460
网友评论