Login
网站首页 > 文章中心 > 其它

redis master配置了密码进行主从同步

作者:小编 更新时间:2023-08-17 10:34:34 浏览量:445人看过

①如果master不设置密码,那么直接在slave服务器配置slaveof即可 配置如下

#slaveof ip 端口
slaveof  221.22④8⑤186 6379 

配置好我们看下redis的日志 看是否同步成功

5014:S 25 Jan 10:53:5③667 * Connecting to MASTER 221.224.8⑤186:6379
5014:S 25 Jan 10:53:5③667 * MASTER <-> SLAVE sync started
5014:S 25 Jan 10:53:5③700 * Non blocking connect for SYNC fired the event.
5014:S 25 Jan 10:53:5③734 * Master replied to PING, replication can continue...
5014:S 25 Jan 10:53:5③832 * Partial resynchronization not possible (no cached master)
5014:S 25 Jan 10:53:5③867 * Full resync from master: 4d6221e370675f397c396c9222b1b60bfcea1efb:1
5014:S 25 Jan 10:53:5③985 * MASTER <-> SLAVE sync: receiving 844 bytes from master
5014:S 25 Jan 10:53:5③985 * MASTER <-> SLAVE sync: Flushing old data
5014:S 25 Jan 10:53:5③985 * MASTER <-> SLAVE sync: Loading DB in memory
5014:S 25 Jan 10:53:5③985 * MASTER <-> SLAVE sync: Finished with success
5014:S 25 Jan 10:53:5③667 * Connecting to MASTER 221.22④8⑤186:6379

这句是从上面slave服务器日志里面获取的,我们可以看到连接的master的服务器的ip是221.22④8⑤186

MASTER <-> SLAVE sync: Finished with success

看到输出的语句是success表示同步成功.

masterauth 123456

OK.

不然可能会出现一下错误

4939:S 25 Jan 09:53:20.450 # MASTER aborted replication with an error: NOAUTH Authentication required.
4939:S 25 Jan 09:53:21.291 * Connecting to MASTER 120.27.13⑦142:6379
4939:S 25 Jan 09:53:21.292 * MASTER <-> SLAVE sync started
4939:S 25 Jan 09:53:21.317 * Non blocking connect for SYNC fired the event.
4939:S 25 Jan 09:53:21.342 * Master replied to PING, replication can continue...
4939:S 25 Jan 09:53:21.368 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
4939:S 25 Jan 09:53:21.393 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
4939:S 25 Jan 09:53:21.393 * Partial resynchronization not possible (no cached master)
4939:S 25 Jan 09:53:21.419 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.
4939:S 25 Jan 09:53:21.419 * Retrying with SYNC...
4939:S 25 Jan 09:53:21.444 # MASTER aborted replication with an error: NOAUTH Authentication required.

以上就是土嘎嘎小编为大家整理的redis master配置了密码进行主从同步相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章