[ClusterLabs] 答复: 答复: How to change the "pcs constraint colocation set"

范国腾 fanguoteng at highgo.com
Tue May 15 04:23:18 EDT 2018


It could not find the id of constraint set.

[root at node1 ~]# pcs constraint colocation --full
Colocation Constraints:
  clvmd-clone with dlm-clone (score:INFINITY) (id:colocation-clvmd-clone-dlm-clone-INFINITY)
  pgsql-master-ip with pgsql-ha (score:INFINITY) (rsc-role:Started) (with-rsc-role:Master) (id:colocation-pgsql-master-ip-pgsql-ha-INFINITY)
  pgsql-slave-ip2 with pgsql-ha (score:INFINITY) (rsc-role:Started) (with-rsc-role:Slave) (id:colocation-pgsql-slave-ip2-pgsql-ha-INFINITY)
  pgsql-slave-ip3 with pgsql-ha (score:INFINITY) (rsc-role:Started) (with-rsc-role:Slave) (id:colocation-pgsql-slave-ip3-pgsql-ha-INFINITY)
  Resource Sets:
    set pgsql-slave-ip2 (id:pcs_rsc_set_pgsql-slave-ip2) setoptions score=-1000 (id:pcs_rsc_colocation_set_pgsql-slave-ip2)
    set pgsql-slave-ip2 pgsql-slave-ip3 (id:pcs_rsc_set_pgsql-slave-ip2_pgsql-slave-ip3) setoptions score=-1000 (id:pcs_rsc_colocation_set_pgsql-slave-ip2_pgsql-slave-ip3)
    set pgsql-slave-ip2 pgsql-slave-ip3 (id:pcs_rsc_set_pgsql-slave-ip2_pgsql-slave-ip3-1) setoptions score=-INFINITY (id:pcs_rsc_colocation_set_pgsql-slave-ip2_pgsql-slave-ip3-1)
[root at node1 ~]# pcs constraint remove pcs_rsc_set_pgsql-slave-ip2
Error: Unable to find constraint - 'pcs_rsc_set_pgsql-slave-ip2'
[root at node1 ~]# pcs constraint remove pcs_rsc_set_pgsql-slave-ip2_pgsql-slave-ip3
Error: Unable to find constraint - 'pcs_rsc_set_pgsql-slave-ip2_pgsql-slave-ip3'
[root at node1 ~]#

-----邮件原件-----
发件人: Users [mailto:users-bounces at clusterlabs.org] 代表 Tomas Jelinek
发送时间: 2018年5月15日 16:12
收件人: users at clusterlabs.org
主题: Re: [ClusterLabs] 答复: How to change the "pcs constraint colocation set"

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
> 
_______________________________________________
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