[systemd-devel] systemd services running on VM nodes 1 and 2 in High Availability Mode.

Arian van Putten arian.vanputten at gmail.com
Tue Aug 17 10:53:14 UTC 2021


Heya!

Currently systemd doesn't have this kind of distributed scheduler . Though
I think it would be very interesting to explore (systemd-distributed seems
to be a fun name).

At some point coreos had a distributed version of systemd that did sort of
exactly what you want https://github.com/coreos/fleet
<ttps://github.com/coreos/fleet> . However it is now unmaintained as they
moved their focus to Kubernetes for orchestrating workloads.

On Tue, Aug 17, 2021 at 12:39 PM Kaushal Shriyan <kaushalshriyan at gmail.com>
wrote:

> Hi,
>
> I have created a systemd script along with the timer which runs once every
> three hours. I have the same settings across node1 and node2 which are
> hosted behind the load balancer. The reason setting behind LB is to make
> sure we avoid a single point of failure scenarios. I have a specific issue
> here both the systemd tasks are doing the same job which will result in
> *duplication*. Is there a way to set it in such a way that node1 systemd
> tasks should run all the time and if node1 goes down in an event of failure
> then node2 systemd service will trigger the tasks.  Can systemd service on
> node1 talk to node2 and vice versa? Please suggest.
>
> *Node1*
> [root at devplace-dev-vm1]#cat
> /etc/systemd/system/checkeverythreehours.service
> [Unit]
> Description=checkeverythreehours
> [Service]
> Type=simple
> User=deployuser
> ExecStart=/bin/bash /var/www/html/dsc/devplace/externaldrupalcron.sh
> [root at devplace-dev-vm1]#cat /etc/systemd/system/checkeverythreehours.timer
> [Unit]
> Description=A timer that runs once in every three hours
> Requires=checkeverythreehours.service
>
> [Timer]
> Unit=checkeverythreehours.service
> AccuracySec=1us
> OnUnitActiveSec=10800
> Persistent=true
>
> [Install]
> WantedBy=timers.target
> [root at devplace-dev-vm1]#
>
> *Node2*
> [root at devplace-dev-vm2]#cat
> /etc/systemd/system/checkeverythreehours.service
> [Unit]
> Description=checkeverythreehours
> [Service]
> Type=simple
> User=deployuser
> ExecStart=/bin/bash /var/www/html/dsc/devplace/externaldrupalcron.sh
> [root at devplace-dev-vm2]#cat /etc/systemd/system/checkeverythreehours.timer
> [Unit]
> Description=A timer that runs once in every three hours
> Requires=checkeverythreehours.service
>
> [Timer]
> Unit=checkeverythreehours.service
> AccuracySec=1us
> OnUnitActiveSec=10800
> Persistent=true
>
> [Install]
> WantedBy=timers.target
> [root at devplace-dev-vm2]#
>
> Thanks in advance.
>
> Best Regards,
>
> Kaushal
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20210817/6de3016b/attachment.htm>


More information about the systemd-devel mailing list