1 |
On 06/28/2014 07:06 PM, J. Roeleveld wrote: |
2 |
> On Saturday, June 28, 2014 01:39:41 PM Neil Bothwick wrote: |
3 |
>> On Sat, 28 Jun 2014 11:36:11 +0200, J. Roeleveld wrote: |
4 |
>>> I need a way to add dependencies to services which are provided by |
5 |
>>> different servers. For instance, my mail server uses DNS to locate my |
6 |
>>> LDAP server which contains the mail aliases. All these are running on |
7 |
>>> different machines. Currently, I manually ensure these are all started |
8 |
>>> in the correct sequence, I would like to automate this to the point |
9 |
>>> where I can start all 3 servers at the same time and have the different |
10 |
>>> services wait for the dependency services to be available even though |
11 |
>>> they are on different systems. |
12 |
>>> |
13 |
>>> All the dependency systems in the init-systems I could find are all |
14 |
>>> based on dependencies on the same server. Does anyone know of something |
15 |
>>> that can already provide this type of dependencies? Or do I need to |
16 |
>>> write something myself? |
17 |
>> With systemd you can add ExecStartPre=/some/script to the service's unit |
18 |
>> file where /some/script waits for the remote services to become available, |
19 |
>> and possibly return an error if the service does not become available |
20 |
>> within a set time. |
21 |
> That method works for any init-system and writing a script to check and if |
22 |
> necessary fail is my temporary fall-back plan. I was actually hoping for a |
23 |
> method that can be used to monitor availability and, if necessary, stop |
24 |
> services when the dependencies disappear. |
25 |
> |
26 |
> -- |
27 |
> Joost |
28 |
> |
29 |
|
30 |
the difficulty is in identifying failed services. |
31 |
local network issue / load issue could mean your services start bouncing. |
32 |
the best way is to have redundancy so it doesn't matter as much |
33 |
|
34 |
having said all of that:: |
35 |
|
36 |
systemd will start servers and buffer network activity - how this works |
37 |
for non local services would be interesting to see. |
38 |
|
39 |
with openrc : |
40 |
you could on the DNS server have a service which is just a batch script |
41 |
that uses watches for pid / program path in "ps" which outputs ACK or |
42 |
NAK to a file in an NFS share say /nfs/monitoring/dns |
43 |
|
44 |
then on the mail server you could have a service that polls |
45 |
/nfs/monitoring/dns for NAK or ACK |
46 |
you can then choose to have this service directly start your dependent |
47 |
services, or if you adjust /etc/init.d/postfix to have depends = |
48 |
"mymonitorDNS" which is an empty shell of a service. your watchdog |
49 |
service could stop / start the empty shell of a script mymonitorDNS, and |
50 |
then postfix depends on mymonitorDNS |
51 |
this would save you from "i've just stopped the mail server for |
52 |
maintenance and my watchdogservice has just restarted it due to a |
53 |
NAK>ACK event" |
54 |
|
55 |
or... |
56 |
you could have a central master machine which has it's own services, |
57 |
watchdog and monitor... i.e. /etc/init.d/thepostfixserver start / |
58 |
depends on thednsserver which just runs |
59 |
# ssh postfixserver '/etc/init.d/postfix start' |
60 |
|
61 |
or... |
62 |
puppet and it's kin |