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
    
  • 相关阅读:
    PHP实现用户在线状态检测
    php面试题汇集2
    php 调用银联接口 【转载】
    【基础算法】基础算法【转载】
    下ue节点
    Python 字典 列表 嵌套 复杂排序大全
    Linux IO 监控与深入分析
    ELK之kibana的web报错[request] Data too large, data for [<agg [2]>] would be larger than limit of
    Elasticsearch聚合优化 | 聚合速度提升5倍
    elasticsearch bulk批量导入 大文件拆分
  • 原文地址:https://www.cnblogs.com/sunxiuwen/p/13770124.html
Copyright © 2011-2022 走看看