redis主从复制踩到的那些坑
一、报错:
* MASTER <-> SLAVE sync started
# Error condition on socket for SYNC: No route to host
解决:
详情见:https://blog.csdn.net/qq_28538407/article/details/81878609
主从复制时,如果主机状态如下:
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
主机中的connected_slaves为0,说明主从复制并没有成功。。
查看从机的redis的log(错误一般都是记录在从机log),之前已经创建并指定了log的路径,如下:
vim /usr/local/redis/log
查出问题如下:
* MASTER <-> SLAVE sync started
# Error condition on socket for SYNC: No route to host
关闭主机的防火墙,注意:是主机的防火墙,然后再重启服务就可以了。
在centos7中,systemctl stop firewalld即可关闭防火墙。其他版本可通过service iptables stop关闭防火墙。
1.关闭防火墙:
[root@localhost ~]# systemctl stop firewalld
2.查看redis进程:
[root@localhost ~]# ps -ef |grep -i redis
root 3667 1 1 16:17 ? 00:00:00 redis-server 0.0.0.0:6379
3.关掉进程:
[root@localhost ~]# kill -9 3667
4.最后重启redis服务以及客户端。
[root@localhost ~]# redis-server /usr/local/redis/etc/redis.conf
[root@localhost ~]# redis-cli
127.0.0.1:6379> info
完成主从复制。
在linux中安装、部署环境时,出了问题一定要多看log。
参考资料:
https://blog.csdn.net/qq_28538407/article/details/81878609
二、报错:
# Creating Server TCP listening socket 0.0.0.0:6379: bind: Address already in use
解决2:
跟上面的解决报错一的过程差不多。查看redis进程,关掉进程,最后重启redis服务。
三、报错:
Error condition on socket for SYNC: Connection refused
* Connecting to MASTER 192.168.0.103:6379
解决3:
redis主服务器绑定了127.0.0.1,那么跨服务器IP的访问就会失败,从服务器用IP和端口访问主的时候,主服务器发现本机6379端口绑在了127.0.0.1上,也就是只能本机才能访问,外部请求会被过滤。所以需要修改redis-master的redis.conf,注释掉bind
127.0.0.1,添加:
bind 0.0.0.0
参考资料: https://blog.csdn.net/chwshuang/article/details/54929277
redis主从复制踩到的那些坑的更多相关文章
- [转帖]美团在Redis上踩过的一些坑-3.redis内存占用飙升
美团在Redis上踩过的一些坑-3.redis内存占用飙升 博客分类: 运维 redis redismonitor内存突增client listinfo 转载请注明出处哈:http://car ...
- 美团在Redis上踩过的一些坑-目录(本人非美团)(转)
来自:http://carlosfu.iteye.com/blog/2254154 分为5个部分: 一.周期性出现connect timeout 二.redis bgrewriteaof问 ...
- [转帖]美团在Redis上踩过的一些坑-5.redis cluster遇到的一些问题
美团在Redis上踩过的一些坑-5.redis cluster遇到的一些问题 博客分类: redis 运维 redis clustercluster-node-timeoutfailover 转载请 ...
- [转帖]美团在Redis上踩过的一些坑-4.redis内存使用优化
美团在Redis上踩过的一些坑-4.redis内存使用优化 博客分类: 运维 redis redisstringhash优化segment-hash 转载请注明出处哈:http://carlosfu ...
- [转帖]美团在Redis上踩过的一些坑-2.bgrewriteaof问题
美团在Redis上踩过的一些坑-2.bgrewriteaof问题 博客分类: redis 运维 aofaof rewrite 转载请注明出处哈:http://carlosfu.iteye.com/b ...
- [转帖]美团在Redis上踩过的一些坑-1.客户端周期性出现connect timeout
美团在Redis上踩过的一些坑-1.客户端周期性出现connect timeout 博客分类: redis 运维 jedisconnect timeoutnosqltcp 转载请注明出处哈:http ...
- Redis上踩过的一些坑
来自: http://blog.csdn.net//chenleixing/article/details/50530419 上上周和同事(龙哥)参加了360组织的互联网技术训练营第三期,美团网的DB ...
- 美团在Redis上踩过的一些坑-3.redis内存占用飙升(转载)
一.现象: redis-cluster某个分片内存飙升,明显比其他分片高很多,而且持续增长.并且主从的内存使用量并不一致. 二.分析可能原因: 1. redis-cluster的bu ...
- Redis Cluster踩过的坑
Redis Cluster踩过的坑请参考如下链接:http://www.iteye.com/blogs/subjects/Redis_Cluster_Devops
随机推荐
- How to CORS enable ArcGIS Server 10.2.1 to Access REST Services without Using proxy.ashx
http://gis.stackexchange.com/questions/86206/how-to-cors-enable-arcgis-server-10-2-1-to-access-rest- ...
- redis导数到mysql
filename=$(date "+%Y%m%d%H%M%S") //将type为list,键为bi0205导出文本,并保存到mysql导入导出目录redis-cli -h 服务器 ...
- C# 趣味小程序(4)——遍历特定目录及其子目录
//递归方法遍历目录,并统计其中文件的数目 private int statisticFiles(string directory) { int st ...
- twisted reactor执行流程
#reactorbase的主循环 def mainLoop(self): while self._started: try: while self._started: # Advance simula ...
- element(vue.js)+django 整合
近期开始接触Python,从web开发入门.尝试Django与vue整合,大概分3个阶段: 1.基于Django开发web后端 2.基于element开发好前端 3.前后端整合 参考:https:// ...
- c++builder 6 [Linker Fatal error] Unable to open file 'PROXIES.OBJ'
c++builder 6 [Linker Fatal error] Unable to open file 'PROXIES.OBJ' http://blog.csdn.net/cb168/artic ...
- BBS--功能4:个人站点页面设计(ORM跨表与分组查询)
查询: 日期归档查询 1 date_format ============date,time,datetime=========== create table t_mul_new(d date,t t ...
- Django--templates(模板层)
模板语法: """ 模板语法: 变量:{{}} 1.深度查询 句点符 2.过滤器 {{value|filter_name:参数}} 标签:{% %} "&quo ...
- Delphi 三层TDataSetProvider
在Delphi想使用三层架构或者使用TClientDataSet控件,一般都需要引用TDataSetProvider控件,现对TDataSetProvider控件的Options属性值做一个简单的分析 ...
- 笔记本移动位置,切换网络ip后,虚拟机的mac系统无法联网解决
1.手动配置新的ip