zoukankan      html  css  js  c++  java
  • 数据库-redis集群发生的错误解决方案

    当进行set时报错

    [was@dqysh050035 src]$ ./redis-cli -h 127.0.0.1 -c -p 7001
    127.0.0.1:7001> set test_error friday
    (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.
    

    检查集群状态,发现7001、7002、7006节点异常

    [was@dqysh050035 src]$ ./redis-trib.rb check 127.0.0.1:7001
    Connecting to node 127.0.0.1:7001: [ERR] Sorry, can't connect to node 127.0.0.1:7001
    [was@dqysh050035 src]$ ./redis-trib.rb check 127.0.0.1:7002
    Connecting to node 127.0.0.1:7002: [ERR] Sorry, can't connect to node 127.0.0.1:7002
    [was@dqysh050035 src]$ ./redis-trib.rb check 127.0.0.1:7003
    Connecting to node 127.0.0.1:7003: OK
    Connecting to node 172.16.50.35:7005: OK
    Connecting to node 172.16.50.35:7001: [ERR] Sorry, can't connect to node 172.16.50.35:7001
    OK
    Connecting to node 172.16.50.35:7004: OK
    Connecting to node 172.16.50.35:7002: [ERR] Sorry, can't connect to node 172.16.50.35:7002
    OK
    Connecting to node 172.16.50.35:7006: [ERR] Sorry, can't connect to node 172.16.50.35:7006
    OK
    *** WARNING: 127.0.0.1:7003 claims to be slave of unknown node ID 4d734557d7ebec8c9c04eae1cbb4085318dff761.
    *** WARNING: 172.16.50.35:7005 claims to be slave of unknown node ID 1f443bf60f0ca1f8f50a0c25a59195ace7c71c47.
    *** WARNING: 172.16.50.35:7004 claims to be slave of unknown node ID 9054c0c29e756d6b79cf5342099bbad8ceeafbeb.
    
    Performing Cluster Check (using node 127.0.0.1:7003)
    S: 1d04c60e1ee2ea7ac26f4c66f0fad86a20384c1e 127.0.0.1:7003
    slots: (0 slots) slave
    replicates 4d734557d7ebec8c9c04eae1cbb4085318dff761
    S: 3493a9243c01602fa4c81a5b25836ff77bd5f668 172.16.50.35:7005
    slots: (0 slots) slave
    replicates 1f443bf60f0ca1f8f50a0c25a59195ace7c71c47
    S: 15bd9e8d1ab5bac7710c4797f7b2268f6c01aa79 172.16.50.35:7004
    slots: (0 slots) slave
    replicates 9054c0c29e756d6b79cf5342099bbad8ceeafbeb
    [OK] All nodes agree about slots configuration.
    Check for open slots...
    Check slots coverage...
    [ERR] Not all 16384 slots are covered by nodes.
    
    • 经百度查询因redis.conf配置文件中的stop-writes-on-bgsave-error yes 配置了启动而导致

    • 原因:

    这是rdb持久化的bug,当高并发时,持久向redis中写操作,而在同步时,
    会fork即完全复制一下主进程从而就会向内存申请和主进程一样大的内存,
    当内存不够时,就会导致fork失败,从而导致数据保存到硬盘失败。

    • 解决方案:
    方法一、将`stop-writes-on-bgsave-error yes` 的yes改为no
    方法二、三、四:
    (1) 编辑/etc/sysctl.conf ,改vm.overcommit_memory=1,然后sysctl -p 使配置文件生效
    (2)sysctl vm.overcommit_memory=1
    (3)echo 1 > /proc/sys/vm/overcommit_memory
    
  • 相关阅读:
    iOS_SN_地图的使用(3)
    iOS_SN_地图的使用(2)
    iOS_SN_百度地图基本使用(1)
    iOS_SN_CoreData(二)
    iOS_SN_CoreDate(一)封装使用
    iOS_SN_UITableView的优化
    阿里云 单表备份 恢复
    svn 彻底删除文件、文件夹
    @去除
    服务器安全保护
  • 原文地址:https://www.cnblogs.com/sunxiuwen/p/13770124.html
Copyright © 2011-2022 走看看