真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

redis自動(dòng)主從切換

127.0.0.1     7000     master

創(chuàng)新互聯(lián)公司專業(yè)為企業(yè)提供雞冠網(wǎng)站建設(shè)、雞冠做網(wǎng)站、雞冠網(wǎng)站設(shè)計(jì)、雞冠網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、雞冠企業(yè)網(wǎng)站模板建站服務(wù),十年雞冠做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

127.0.0.1     7001     slave

127.0.0.1     7002     slave

127.0.0.1     7003     slave

查看主上面連接的從

redis-cli -p 7000 info Replication

# Replication

role:master

connected_slaves:3

slave0:ip=127.0.0.1,port=7001,state=online,offset=2532,lag=0

slave1:ip=127.0.0.1,port=7002,state=online,offset=2532,lag=0

slave2:ip=127.0.0.1,port=7003,state=online,offset=2532,lag=1

master_repl_offset:2532

repl_backlog_active:1

repl_backlog_size:1048576

repl_backlog_first_byte_offset:2

repl_backlog_histlen:2531

創(chuàng)建sentinel配置文件

vim /redis_test/7000/sentinel.conf

port 26379

sentinel monitor master 127.0.0.1 7000 2

sentinel down-after-milliseconds master 5000

sentinel failover-timeout master 60000

sentinel config-epoch master 12

vim /redis_test/7001/sentinel.conf

port 26479

sentinel monitor master 127.0.0.1 7000 2

sentinel down-after-milliseconds master 5000

sentinel failover-timeout master 60000

sentinel config-epoch master 12

vim /redis_test/7002/sentinel.conf

port 26579

sentinel monitor master 127.0.0.1 7000 2

sentinel down-after-milliseconds master 5000

sentinel failover-timeout master 60000

sentinel config-epoch master 12

啟動(dòng)sentinel

/usr/src/redis/src/redis-server /redis_database/7000/sentinel.conf --sentinel &

/usr/src/redis/src/redis-server /redis_database/7001/sentinel.conf --sentinel &

/usr/src/redis/src/redis-server /redis_database/7002/sentinel.conf --sentinel &

將主7000關(guān)掉

redis-cli -p 7000 shutdown

redis-cli -p 7002 info replication

# Replication

role:master

connected_slaves:2

slave0:ip=127.0.0.1,port=7001,state=online,offset=6345,lag=0

slave1:ip=127.0.0.1,port=7003,state=online,offset=6345,lag=0

master_repl_offset:6345

repl_backlog_active:1

repl_backlog_size:1048576

repl_backlog_first_byte_offset:2

repl_backlog_histlen:6344

可以發(fā)現(xiàn)7002變成了新的主庫(kù)


分享文章:redis自動(dòng)主從切換
當(dāng)前網(wǎng)址:http://weahome.cn/article/pgdjph.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部