cronsun
cronsun copied to clipboard
mongodb挂了会影响cronnode任务的调度运行?
Please answer these questions before submitting your issue. Thanks! 在你提交 issue 前,请先回答以下问题,谢谢!
-
What version of Go and cronsun version are you using? 你用的是哪个版本的 Go 和 哪个版本的 cronsun? cronsun-v0.3.2 直接下载的release包
-
What operating system and processor architecture are you using (
go env
)? 你用的是哪个操作系统,什么架构的? CentOS release 6.7 -
What did you do? If possible, provide a recipe for reproducing the error. A complete runnable program is good. 你做了什么,遇到了什么问题?尽可能描述清楚问题,最好把操作步骤写下来,按这些步骤操作后能重现你的问题。
mongodb挂了,cronnode结点所在的任务不执行,完全没有调度, 从可靠性说明文档来看即使mongodb挂了只是影响日志的记录,不会影响任务的运行, cronnode日志报错日志如下: 2020-11-10T19:09:17.796+0800 ERROR node/server.go:37 Connect to MongoDB [mongodb://test:test@mongo1:27017,test:test@mongo2:27017,test:test@mongo3:27017/cronsun?authSource=admin] failed: no reachable servers github.com/shunfei/cronsun/log.Errorf /Users/Doflatango/go/src/github.com/shunfei/cronsun/log/log.go:39 main.main /Users/Doflatango/go/src/github.com/shunfei/cronsun/bin/node/server.go:37 runtime.main /usr/local/go/src/runtime/proc.go:198
-
What did you expect to see? 你期望得到什么样的结果? mongodb挂了不影响任务的运行,只是影响日志记录
-
What did you see instead? 现在你得到的结果是什么样的? mongodb挂了cronnode所在的结点任务不会调度执行,@QLeelulu
node执行过程中,如果mongodb挂了,任务可以继续执行,只是不能记录日志; 但是你这里是启动时尝试连接mongodb时报错,我觉得是合理的;
如果觉得这是可以容忍的,那么可以common.go文件,做兼容
我测试,每分钟执行单机单进程任务,mongodb挂了后,这个任务成功一次,失败一次,以此循环