Siga este guia para fazer o failover automático do PostgreSQL:
https://dalibo.github.io/PAF/Quick_Start-CentOS-7.html
Nesta etapa:
pcs -f cluster1.xml stonith create fence_vm_srv1 fence_virsh pcmk_host_check="static-list" pcmk_host_list="srv1" ipaddr="192.168.122.1" login="<username>" port="srv1-c7" action="off" identity_file="/root/.ssh/id_rsa"
pcs -f cluster1.xml stonith create fence_vm_srv2 fence_virsh pcmk_host_check="static-list" pcmk_host_list="srv2" ipaddr="192.168.122.1" login="<username>" port="srv2-c7" action="off" identity_file="/root/.ssh/id_rsa"
pcs -f cluster1.xml stonith create fence_vm_srv3 fence_virsh pcmk_host_check="static-list" pcmk_host_list="srv3" ipaddr="192.168.122.1" login="<username>" port="srv3-c7" action="off" identity_file="/root/.ssh/id_rsa"
pcs -f cluster1.xml constraint location fence_vm_srv1 avoids srv1=INFINITY
pcs -f cluster1.xml constraint location fence_vm_srv2 avoids srv2=INFINITY
pcs -f cluster1.xml constraint location fence_vm_srv3 avoids srv3=INFINITY
O que eu editei:
pcs -f cluster1.xml stonith create fence_vm_node1 fence_virsh pcmk_host_check="static-list" pcmk_host_list="node1" ipaddr="192.168.33.1" login="root" port="5432" action="off" identity_file="/root/.ssh/id_rsa"
pcs -f cluster1.xml stonith create fence_vm_node2 fence_virsh pcmk_host_check="static-list" pcmk_host_list="node2" ipaddr="192.168.33.1" login="root" port="5432" action="off" identity_file="/root/.ssh/id_rsa"
pcs -f cluster1.xml constraint location fence_vm_node1 avoids node1=INFINITY
pcs -f cluster1.xml constraint location fence_vm_node2 avoids node2=INFINITY
Erro recebido:
[root@node1 ~]# pcs -f cluster1.xml stonith create fence_vm_node1 fence_virsh pcmk_host_check="static-list" pcmk_host_list="node1" ipaddr="192.168.33.1" login="root" port="5432" action="off" identity_file="/root/.ssh/id_rsa"
Error: Agent 'fence_virsh' not found, use --force to override
[root@node1 ~]# pcs -f cluster1.xml stonith create fence_vm_node2 fence_virsh pcmk_host_check="static-list" pcmk_host_list="node2" ipaddr="192.168.33.1" login="root" port="5432" action="off" identity_file="/root/.ssh/id_rsa"
Error: Agent 'fence_virsh' not found, use --force to override
[root@node1 ~]# pcs -f cluster1.xml constraint location fence_vm_node1 avoids node1=INFINITY
Error: Resource 'fence_vm_node1' does not exist
[root@node1 ~]# pcs -f cluster1.xml constraint location fence_vm_node2 avoids node2=INFINITY
Error: Resource 'fence_vm_node2' does not exist
Não existe este IP: 192.168.33.1
, mas existe 192.168.33.111
.
Eu acho que port
significa que a porta do PostgreSQL mudou para 5432
. Talvez não esse significado. Então, qual é o significado certo?
Onde estava errado?
Você instalou o
fence-agents
pacote? Isso forneceria ofence_virsh
binário quepcs
está reclamando que não está lá.