Tencent / Tendis

Tendis is a high-performance distributed storage system fully compatible with the Redis protocol.
http://tendis.cn
Other
2.93k stars 320 forks source link

执行大hash迭代删key操作,导致tendis节点很快挂掉,且tendis掉线看不到相关日志 #76

Open whl-2020-Hunan opened 3 years ago

whl-2020-Hunan commented 3 years ago

def clear_data(redis_key, count=1000, days=7): timestamp = time.time() time_date = days 24 3600 for k, v in redis_client.hscan_iter(redis_key, None, count): data = json.loads(v) cache_time = data['cache_time'] if int(timestamp) - int(cache_time) > time_date: redis_client.hdel(redis_key, k) time.sleep(0.0001) time.sleep(0.0001)

以下是该节点的相关配置: port 端口 bind IP loglevel notice cluster-enabled yes logdir ./home/log dumpdir ./home/dump dir ./home/db pidfile ./home/tendisplus.pid slowlog ./home/log/slowlog rocks.blockcachemb 2048 rocks.blockcache_strict_capacity_limit false netiothreadnum 4 executorThreadNum 6

binlog清理相关参数

minbinlogkeepsec 3600 truncateBinlogIntervalMs 1000 truncateBinlogNum 500000 rename-command keys keys_cyt rename-command flushdb flushdb_cyt rename-command flushall flushall_cyt requirepass 密码 masterauth 密码

TendisDev commented 3 years ago

你好,挂掉是因为oom还是core了 如果core了,提供下coredump的堆栈

whl-2020-Hunan commented 3 years ago

您好,挂掉的时候并没有打印日志,估计是oom了吧,就是不知道啥原因

------------------ 原始邮件 ------------------ 发件人: "vinchen"<notifications@github.com>; 发送时间: 2021年3月5日(星期五) 上午10:18 收件人: "Tencent/Tendis"<Tendis@noreply.github.com>; 抄送: "wang hailong"<790685682@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [Tencent/Tendis] 执行大hash迭代删key操作,导致tendis节点很快挂掉,且tendis掉线看不到相关日志 (#76)

你好,挂掉是因为oom还是core了 如果core了,提供下coredump的堆栈

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

TendisDev commented 3 years ago

如果可以,请提供一下这个操作完整序列,并且重现这个问题的方式

另外,也需要提供完整配置,以及硬件CPU和内存信息 如果是OOM,可以查看系统日志来确认

whl-2020-Hunan commented 3 years ago

陈总,您好,不好意思,上午安排了事情有点忙,没来得及回复:

  1. 操作完整序列,我可以简单描述下:就是起8个清理key的线程(对8个hash),同时做hscan_iter操作,查出想要删除key名,然后hdel删除,中间给了一点睡眠时间防止删除过快影响线上数据,这就是删除的过程。
  2. 配置参数已经在issue上面给出其中一个tendis节点tendisplus.conf全部配置,共3个节点,其中tendis1节点4核8G,另外两个节点部署在另一台机器上8核16G,清洗脚本开启大概几分钟后每次都会导致tendis1节点挂掉,另外两个节点没挂
  3. 确实是OOM,截图如下:

------------------ 原始邮件 ------------------ 发件人: "vinchen"<notifications@github.com>; 发送时间: 2021年3月5日(星期五) 上午10:26 收件人: "Tencent/Tendis"<Tendis@noreply.github.com>; 抄送: "wang hailong"<790685682@qq.com>; "Author"<author@noreply.github.com>; 主题: Re: [Tencent/Tendis] 执行大hash迭代删key操作,导致tendis节点很快挂掉,且tendis掉线看不到相关日志 (#76)

如果可以,请提供一下这个操作完整序列,并且重现这个问题的方式

另外,也需要提供完整配置,以及硬件CPU和内存信息 如果是OOM,可以查看系统日志来确认

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.