本篇内容介绍了“怎么实现Redis主从复制”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!架构主 192.168.2.222从 192.168.2.187从 192.168.2.188从库配置文件添加:从 192.168.2.187从 192.168.2.188[root@rac1 config]# pwd/usr/local/redis/config[root@rac1 config]# vim redis.conf#添加slaveof 192.168.2.222 6379重启数据库[root@rac1 config]# redis-cli -p 6379 shutdown[root@rac1 config]# redis-server redis.conf验证数据同步主库2.222[root@cjcos src]# redis-cli127.0.0.1:6379> set station dbaOK127.0.0.1:6379> get station”dba”从库2.187[root@rac1 config]# redis-cli127.0.0.1:6379> get station”dba”从库2.188[root@rac2 config]# redis-cli127.0.0.1:6379> get station”dba”主库2.222查看同步信息127.0.0.1:6免费主机域名379> info replication# Replicationrole:masterconnected_slaves:2slave0:ip=192.168.2.187,port=6379,state=online,offset=11208,lag=1slave1:ip=192.168.2.188,port=6379,state=online,offset=11208,lag=1master_replid:231ff9d15411b50038a43bb0726580f4dd788f80master_replid2:0000000000000000000000000000000000000000master_repl_offset:11208second_repl_offset:-1repl_backlog_active:1repl_backlog_size:1048576repl_backlog免费主机域名_first_byte_offset:1repl_backlog_histlen:11208同步日志
主库2.222—-redis.log8511:M 23 Mar 2020 14:53:51.841 * Background saving terminated with success8511:M 23 Mar 2020 14:53:51.842 * Synchronization with replica 192.168.2.187:6379 succeeded8511:M 23 Mar 2020 14:53:57.272 * Replica 192.168.2.188:6379 asks for synchronization8511:M 23 Mar 2020 14:53:57.272 * Full resync requested by replica 192.168.2.188:63798511:M 23 Mar 2020 14:53:57.272 * Starting BGSAVE for SYNC with target: disk8511:M 23 Mar 2020 14:53:57.272 * Background saving started by pid 85288528:C 23 Mar 2020 14:53:57.326 * DB saved on disk8528:C 23 Mar 2020 14:53:57.327 * RDB: 0 MB of memory used by copy-on-write常见问题:同步失败,日志如下:—-redis.log29884:S 23 Mar 2020 14:50:29.152 * Connecting to MASTER 192.168.2.222:637929884:S 23 Mar 2020 14:50:29.152 * MASTER REPLICA sync started29884:S 23 Mar 2020 14:50:29.152 * Non blocking connect for SYNC fired the event.29884:S 23 Mar 2020 14:50:29.153 # Error reply to PING from master: ‘-DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect’解决方案:—配置文件redis.conf添加:bind 0.0.0.0“怎么实现Redis主从复制”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注云技术网站,小编将为大家输出更多高质量的实用文章!
这篇文章主要讲解了“分析PostgreSQL中用于索引维护的查询”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“分析PostgreSQL中用于索引维护的查询”吧!查看表&索引大小索引定义识别未使用的Ind…