1

I have a cluster of servers that will be running a simple ruok command with fallover. The command will be something simple like curl -X POST http://foo.com/status. Due to the fact that I will have anywhere from 3 to 300 nodes in this pool, I want to make sure that this command is only emitted once every ten minutes. I ran into the issue that I cannot just add a crontab to my servers unless I want them all to emit every X minutes.

I started looking at using HashiCorp Consul as its fairly highly available and seemingly easier than etcd or Zookeeper. I do not know how to actually create something that will do this though.

I will be using this script on all servers

#!/bin/bash

curl -i -H "Accept: application/json" \
-H "Content-Type:application/json"    \
-X POST --data '{"status":"ruok"}' "https://foobar.com/status"

So how would I write Consul in order to run this once in a pool of nodes?

ehime
  • 577
  • 2
  • 7
  • 15

1 Answers1

1

You could use this.

Just Googled "distributed cron using consul".

Florin Asăvoaie
  • 6,932
  • 22
  • 35