[ClusterLabs] nginx resource - how to reload config or do a config test

Ken Gaillot kgaillot at redhat.com
Mon Aug 7 18:53:06 CEST 2017


On Mon, 2017-08-07 at 16:32 +0200, Przemyslaw Kulczycki wrote:
> Hi.
> I have a 2-node cluster with a cloned IP and nginx configured.
> 
> 
> user at proxy04 ~]$ sudo pcs resource show --full
>  Clone: ha-ip-clone
>   Meta Attrs: clone-max=2 clone-node-max=2 globally-unique=true
> resource-stickiness=0
>   Resource: ha-ip (class=ocf provider=heartbeat type=IPaddr2)
>    Attributes: cidr_netmask=24 clusterip_hash=sourceip
> ip=192.68.20.240
>    Operations: monitor interval=5s timeout=15s
> (ha-ip-monitor-interval-5s)
>                start interval=0s timeout=20s (ha-ip-start-interval-0s)
>                stop interval=0s timeout=20s (ha-ip-stop-interval-0s)
>  Clone: ha-nginx-clone
>   Meta Attrs: clone-max=2 clone-node-max=1 globally-unique=true
> resource-stickiness=0
>   Resource: ha-nginx (class=ocf provider=heartbeat type=nginx)
>    Attributes: configfile=/etc/nginx/nginx.conf
>    Operations: monitor interval=5s timeout=20s
> (ha-nginx-monitor-interval-5s)
>                start interval=0s timeout=60s
> (ha-nginx-start-interval-0s)
>                stop interval=0s timeout=60s
> (ha-nginx-stop-interval-0s)
> 
> 
> $ pcs --version
> 0.9.158
> 
> 
> I have 2 questions about that resource type:
> 1) How do I reload nginx config in the clustered resource without
> restarting the nginx process?
> pcs doesn't have an option to do that (analogous to pcs resource
> restart ha-nginx-clone)
> Is there a pacemaker command to do that?

Pacemaker's reload capability is a bit muddled right now. It's on the
to-do to overhaul it. Currently, if the resource agent supports the
reload action, and you change a resource parameter marked as unique=0
(or left as default) in the agent meta-data, Pacemaker will execute the
reload action.

You can use this method by changing such a parameter, but it's more a
workaround than a solution.

> According to http://linux-ha.org/doc/man-pages/re-ra-nginx.html this
> type of agent supports a reload option, so how can I use it?

You can run the agent manually from the command line like:

OCF_ROOT=/usr/lib/ocf
[OCF_RESKEY_<param>=<value> ...] /usr/lib/ocf/resource.d/heartbeat/nginx
reload

where you need to set the param/value pairs identical to what you have
in the cluster configuration.

However, in nginx's case, the RA simply does a "kill -HUP" to the nginx
PID, so it's probably easier to just do that yourself.

> 2) How do I do an nginx config test with the clustered resource?
> 
> 
> I know I can do a "nginx -t", but is there an option to do it using
> pacemaker/pcs commands on both nodes?

No, but that's OK. You don't want to start or stop or change the
configuration without involving the cluster, but tests and checks are
fine to run outside cluster control.

> -- 
> Best Regards
>  
> Przemysław Kulczycki
> System administrator
> Avaleo
> 
> Email: upr at avaleo.net

-- 
Ken Gaillot <kgaillot at redhat.com>







More information about the Users mailing list