[ClusterLabs] Best way to create a floating identity file
Tony Stocker
akostocker at gmail.com
Wed Dec 16 04:46:32 EST 2020
On Tue, Dec 15, 2020 at 12:29 PM Ken Gaillot <kgaillot at redhat.com> wrote:
>
> On Tue, 2020-12-15 at 17:02 +0300, Andrei Borzenkov wrote:
> > On Tue, Dec 15, 2020 at 4:58 PM Tony Stocker <akostocker at gmail.com>
> > wrote:
> > >
> Just for fun, some other possibilities:
>
> You could write your script/cron as an OCF RA itself, with an
> OCF_CHECK_LEVEL=20 monitor doing the actual work, scheduled to run at
> whatever interval you want (or using time-based rules, enabling it to
> run at a particular time). Then you can colocate it with the workload
> resources.
>
> Or you could write a systemd timer unit to call your script when
> desired, and colocate that with the workload as a systemd resource in
> the cluster.
>
> Or similar to the crm_resource method, you could colocate an
> ocf:pacemaker:attribute resource with the workload, and have your
> script check the value of the node attribute (with attrd_updater -Q) to
> know whether to do stuff or not.
> --
All three options look interesting, but the last one seems the
simplest. Looking at the description I'm curious to know what happens
with the 'inactive_value' string. Is that put in the 'state' file
location whenever a node is not the active one? For example, when I
first set up the attribute and it gets put on the active node
currently running the resource group with the 'active_value' string,
will the current backup node automatically get the same 'state' file
created with the 'inactive_value'? Or does that only happen when the
resource group is moved?
Secondly, does this actually create a file with a plaintext entry
matching one of the *_value strings? Or is it simply an empty file
with the information stored somewhere in the depths of the PM config?
Finally (for the moment), what does the output of 'attrd_updater -Q'
look like? I need to figure out how to utilize the output for a cron
'if' statement similar to the previous one:
if [ -f /var/local/project/cluster-node ] && [ `cat
/var/local/project/cluster-node` = "distroserver" ]; then ...
since the cron script is run on both nodes, I need to know how the
output can be used to determine which node will run the necessary
commands. If the return values are the same regardless of which node I
run attrd_updater on, what do I use to differentiate?
Unfortunately right now I don't have a test cluster that I can play
with things on, only a 'live' one that we had to rush into service
with a bare minimum of testing, so I'm loath to play with things on
it.
Thanks!
More information about the Users
mailing list