[ClusterLabs] 答复: How to change the "pcs constraint colocation set"
Tomas Jelinek
tojeline at redhat.com
Tue May 15 04:12:18 EDT 2018
Dne 15.5.2018 v 10:02 范国腾 napsal(a):
> Thank you, Tomas. I know how to remove a constraint " pcs constraint colocation remove <source resource id> <target resource id> ". Is there a command to delete a constraint colocation set?
There is "pcs constraint remove <constraint id>". To get a constraint
id, run "pcs constraint colocation --full" and find the constraint you
want to remove.
>
> -----邮件原件-----
> 发件人: Users [mailto:users-bounces at clusterlabs.org] 代表 Tomas Jelinek
> 发送时间: 2018年5月15日 15:42
> 收件人: users at clusterlabs.org
> 主题: Re: [ClusterLabs] How to change the "pcs constraint colocation set"
>
> 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
> _______________________________________________
> Users mailing list: Users at clusterlabs.org https://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
> _______________________________________________
> Users mailing list: Users at clusterlabs.org
> https://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
>
More information about the Users
mailing list