Re: systemd services running on VM nodes 1 and 2 in High Availability Mode.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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  . 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@xxxxxxxxx> 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@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@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@devplace-dev-vm1]#

Node2
[root@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@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@devplace-dev-vm2]#

Thanks in advance.

Best Regards,

Kaushal



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux