安裝Redis(二)主從

redis主服務器

ip:192.168.80.100redis

redis密碼:redis服務器

redis從服務器

ip:192.168.80.101app

redis密碼:redisasync

  • 修改從的配置文件:/etc/redis/6379.conf
################################# REPLICATION #################################

# Master-Slave replication. Use slaveof to make a Redis instance a copy of
# another Redis server. A few things to understand ASAP about Redis replication.
#
# 1) Redis replication is asynchronous, but you can configure a master to
#    stop accepting writes if it appears to be not connected with at least
#    a given number of slaves.
# 2) Redis slaves are able to perform a partial resynchronization with the
#    master if the replication link is lost for a relatively small amount of
#    time. You may want to configure the replication backlog size (see the next
#    sections of this file) with a sensible value depending on your needs.
# 3) Replication is automatic and does not need user intervention. After a
#    network partition slaves automatically try to reconnect to masters
#    and resynchronize with them.
#
# slaveof <masterip> <masterport>

slaveof 192.168.80.100 6379

# 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>
masterauth redis

在   #####REPLICATION### 註釋那塊加上了主redis的ip端口和密碼;ui

配置完成後重啓從redis this

/etc/init.d/redis_6379 restartspa

相關文章
相關標籤/搜索