[ClusterLabs] How to change the "pcs constraint colocation set"
Tomas Jelinek
tojeline at redhat.com
Tue May 15 03:41:33 EDT 2018
Dne 15.5.2018 v 05:25 范国腾 napsal(a):
> Hi,
>
> We have two VIP resources and we use the following command to make them in different node.
>
> pcs constraint colocation set pgsql-slave-ip1 pgsql-slave-ip2 setoptions score=-1000
>
> Now we add a new node into the cluster and we add a new VIP too. We want the constraint colocation set to change to be:
> pcs constraint colocation set pgsql-slave-ip1 pgsql-slave-ip2 pgsql-slave-ip3 setoptions score=-1000
>
> How should we change the constraint set?
>
> Thanks
Hi,
pcs provides no commands for editing existing constraints. You can
create a new constraint and remove the old one. If you want to do it as
a single change from pacemaker's point of view, follow this procedure:
[root at node1:~]# pcs cluster cib cib1.xml
[root at node1:~]# cp cib1.xml cib2.xml
[root at node1:~]# pcs -f cib2.xml constraint list --full
Location Constraints:
Ordering Constraints:
Colocation Constraints:
Resource Sets:
set pgsql-slave-ip1 pgsql-slave-ip2
(id:pcs_rsc_set_pgsql-slave-ip1_pgsql-slave-ip2) setoptions score=-1000
(id:pcs_rsc_colocation_set_pgsql-slave-ip1_pgsql-slave-ip2)
Ticket Constraints:
[root at node1:~]# pcs -f cib2.xml constraint remove
pcs_rsc_colocation_set_pgsql-slave-ip1_pgsql-slave-ip2
[root at node1:~]# pcs -f cib2.xml constraint colocation set
pgsql-slave-ip1 pgsql-slave-ip2 pgsql-slave-ip3 setoptions score=-1000
[root at node1:~]# pcs cluster cib-push cib2.xml diff-against=cib1.xml
CIB updated
Pcs older than 0.9.156 does not support the diff-against option, you can
do it like this:
[root at node1:~]# pcs cluster cib cib.xml
[root at node1:~]# pcs -f cib.xml constraint list --full
Location Constraints:
Ordering Constraints:
Colocation Constraints:
Resource Sets:
set pgsql-slave-ip1 pgsql-slave-ip2
(id:pcs_rsc_set_pgsql-slave-ip1_pgsql-slave-ip2) setoptions score=-1000
(id:pcs_rsc_colocation_set_pgsql-slave-ip1_pgsql-slave-ip2)
Ticket Constraints:
[root at node1:~]# pcs -f cib.xml constraint remove
pcs_rsc_colocation_set_pgsql-slave-ip1_pgsql-slave-ip2
[root at node1:~]# pcs -f cib.xml constraint colocation set pgsql-slave-ip1
pgsql-slave-ip2 pgsql-slave-ip3 setoptions score=-1000
[root at node1:~]# pcs cluster cib-push cib.xml
CIB updated
Regards,
Tomas
More information about the Users
mailing list