Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[discuss] Discussion of executing a single server under multiple nodes #501

Closed
flc1125 opened this issue Aug 16, 2023 · 3 comments
Closed

Comments

@flc1125
Copy link

flc1125 commented Aug 16, 2023

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.

I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.

@elbert-chan
Copy link

elbert-chan commented Feb 5, 2024

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.

I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.

Through a distributed lock to ensure that only one of the multiple nodes can perform tasks?
If you use this scheme, you need to ensure that the time of multiple nodes is consistent.

Do you have a better plan? Look forward to further communication with you

@flc1125
Copy link
Author

flc1125 commented Feb 7, 2024

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.我在想,在实际的项目应用场景中,我们的cron实际上是在多个节点下运行的。
I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.我想知道我是否可以提供一种独立的方式来支持单节点操作的多节点保证。

Through a distributed lock to ensure that only one of the multiple nodes can perform tasks?通过分布式锁来保证多个节点中只有一个可以执行任务? If you use this scheme, you need to ensure that the time of multiple nodes is consistent.如果使用此方案,则需要保证多个节点的时间一致。

Do you have a better plan? Look forward to further communication with you你有更好的计划吗?期待与您的进一步沟通

I wrote a Mutex to implement a distributed single server to run. This is my implementation on go-kratos.

https://github.com/go-kratos-ecosystem/components/tree/2.x/crontab

PS: I don't think it's optimal, there's room for improvement, but I haven't had time to think about it. If you have any better suggestions, I'd love to hear them.

@flc1125
Copy link
Author

flc1125 commented Mar 26, 2024

I am thinking that in the actual project application scenario, our cron actually runs under multiple nodes.
I was wondering if I could provide an independent way to support the multi-node guarantee of single-node operation.

Through a distributed lock to ensure that only one of the multiple nodes can perform tasks? If you use this scheme, you need to ensure that the time of multiple nodes is consistent.

Do you have a better plan? Look forward to further communication with you你有更好的计划吗?期待与您进一步沟通

I implemented a package to solve this problem, the address of the package is: https://github.com/go-kratos-ecosystem/components/tree/2.x/crontab/jobwrapper/mutex

How to use it: https://github.com/go-kratos-ecosystem/components/blob/2.x/crontab/README.md

@flc1125 flc1125 closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants