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

2017-08-10 Thread Jan Pokorný
On 07/08/17 11:53 -0500, Ken Gaillot wrote:
> On Mon, 2017-08-07 at 16:32 +0200, Przemyslaw Kulczycki wrote:
>> 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.

Unless, of course, these checks are inherently racy, which would
arguably be an agent's design flaw (e.g. writing semirandom data
to the same or not assuredly as of birth unique file and reading
them back for comparison).

-- 
Jan (Poki)


pgptWKx0WK62K.pgp
Description: PGP signature
___
Users mailing list: Users@clusterlabs.org
http://lists.clusterlabs.org/mailman/listinfo/users

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org


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

2017-08-07 Thread Ken Gaillot
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@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_= ...] /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: u...@avaleo.net

-- 
Ken Gaillot 





___
Users mailing list: Users@clusterlabs.org
http://lists.clusterlabs.org/mailman/listinfo/users

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org


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

2017-08-07 Thread Przemyslaw Kulczycki
Hi.
I have a 2-node cluster with a cloned IP and nginx configured.

user@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?

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?

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?


-- 
Best Regards

Przemysław Kulczycki
System administrator
Avaleo

Email: u...@avaleo.net
___
Users mailing list: Users@clusterlabs.org
http://lists.clusterlabs.org/mailman/listinfo/users

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org