redis3.0.7集群部署手册
2018-03-13 12:12 staryea-bigdata 阅读(661) 评论(0) 编辑 收藏 举报1.用root登录主机
2.将redis-3.0.7.tar.gz传送到主机
3.将rubygems-update-2.5.2.gem,redis-3.0.0.gem传送到主机
4.解压redis-3.0.7.tar.gz
5.make , make test, make MALLOC=libc , make install
6.mkdir 7000, mkdir 7001
7.cd 7000
vi redis.conf 添加如下
###################################################
include /home/redis/redis3.0.7/config/redis-common.conf
pidfile /home/redis/redis3.0.7/output/7000/redis7000.pid
cluster-config-file /home/redis/redis3.0.7/output/7000/nodes.conf
port 7000
daemonize yes
cluster-enabled yes
cluster-node-timeout 15000
####################################################
8.cd 7001 ,vi redis.conf 添加如下
#################################################
include /home/redis/redis3.0.7/config/redis-common.conf
pidfile /home/redis/redis3.0.7/output/7001/redis7001.pid
cluster-config-file /home/redis/redis3.0.7/output/7001/nodes.conf
port 7001
daemonize yes
cluster-enabled yes
cluster-node-timeout 15000
##################################################
9.启动redis:
redis-server /home/redis/redis-3.0.7/output/7000/redis.conf
redis-server /home/redis/redis-3.0.7/output/7001/redis.conf
需要等待一段时间然后看进程是否启动 7000,7001端口
ps -ef|grep redis
root 59938 59718 0 12:06 pts/0 00:00:00 grep redis
root 60441 1 0 May29 ? 00:07:39 redis-server *:7000 [cluster]
root 60453 1 0 May29 ? 00:07:31 redis-server *:7001 [cluster]
重复上述操作在其他2台主机上
部署了三台主机后选择其中一台主机把rubygems-update-2.5.2.gem,redis-3.0.0.gem传送到主机
然后升级方式为 gem install rubygems-update-2.5.2.gem ; gem redis-3.0.0.gem
gem install redis-3.0.0.gem
升级完成后 进入redis的src目录,执行下面命令创建集群:
./redis-trib.rb create --replicas 1 192.168.2.249:7000 192.168.2.253:7001 192.168.2.253:7000 192.168.2.254:7001 192.168.2.254:7000 192.168.2.249:7001
附件:redis-common.conf 配置
#####################################################################################################
daemonize yes
tcp-backlog 511
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1
timeout 0
# A reasonable value for this option is 60 seconds.
tcp-keepalive 0
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel warning
# Specify the log file name. Also the empty string can be used to force
logfile ./redis.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
syslog-enabled yes
# Specify the syslog identity.
# syslog-ident redis
# Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7.
# syslog-facility local0
# Set the number of databases. The default database is DB 0, you can select
# a different one on a per-connection basis using SELECT <dbid> where
# dbid is a number between 0 and 'databases'-1
databases 16
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
# The filename where to dump the DB
#dbfilename dump.rdb
# The working directory.
#
# The DB will be written inside this directory, with the filename specified
# above using the 'dbfilename' configuration directive.
#
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir ./
################################# REPLICATION #################################
# slaveof <masterip> <masterport>
# If the master is password protected (using the "requirepass" configuration
# directive below) it is possible to tell the slave to authenticate before
# starting the replication synchronization process, otherwise the master will
# refuse the slave request.
#
# masterauth <master-password>
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
# repl-ping-slave-period 10
# repl-timeout 60
repl-disable-tcp-nodelay no
# repl-backlog-size 1mb
# repl-backlog-ttl 3600
# It is possible for a master to stop accepting writes if there are less than
# N slaves connected, having a lag less or equal than M seconds.
#
# The N slaves need to be in "online" state.
#
# The lag in seconds, that must be <= the specified value, is calculated from
# the last ping received from the slave, that is usually sent every second.
#
# This option does not GUARANTEE that N replicas will accept the write, but
# will limit the window of exposure for lost writes in case not enough slaves
# are available, to the specified number of seconds.
#
# For example to require at least 3 slaves with a lag <= 10 seconds use:
#
# min-slaves-to-write 3
# min-slaves-max-lag 10
#
# Setting one or the other to 0 disables the feature.
#
# By default min-slaves-to-write is set to 0 (feature disabled) and
# min-slaves-max-lag is set to 10.
################################### LIMITS ####################################
maxclients 10000
maxmemory 64424509440
# volatile-lru -> remove the key with an expire set using an LRU algorithm
# allkeys-lru -> remove any key according to the LRU algorithm
# volatile-random -> remove a random key with an expire set
# allkeys-random -> remove a random key, any key
# volatile-ttl -> remove the key with the nearest expire time (minor TTL)
# noeviction -> don't expire at all, just return an error on write operations
#
maxmemory-policy volatile-lru
# maxmemory-samples 5
############################## APPEND ONLY MODE ###############################
appendonly no
# The name of the append only file (default: "appendonly.aof")
appendfilename "appendonly.aof"
# appendfsync always
#appendfsync everysec
appendfsync no
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
################################ LUA SCRIPTING ###############################
lua-time-limit 5000
################################ REDIS CLUSTER ###############################
cluster-enabled yes
cluster-node-timeout 15000
#cluster-slave-validity-factor 10
#cluster-migration-barrier 1
#cluster-require-full-coverage yes
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
############################# EVENT NOTIFICATION ##############################
notify-keyspace-events ""
############################### ADVANCED CONFIG ###############################
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
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
aof-rewrite-incremental-fsync yes