Closed emanfeah closed 3 months ago
Hello @emanfeah, yes.
In addition to deploying new clusters, this playbook also support the deployment of cluster over already existing and running PostgreSQL. You can convert your basic PostgreSQL installation to a high availability cluster. \
Just specify the variable postgresql_exists=true
in the inventory file. Also make sure that the other variables (e.g. postgresql_version, postgresql_data_dir, etc) match your database.
Attention! Your PostgreSQL will be stopped before running in cluster mode (please plan for a short downtime of databases).
what about the replicas Vm , its need to install a Postgresql manually Right ? and it will sync ?
`ubuntu@patroni1:~/postgresql_cluster$ ansible-playbook deploy_pgcluster.yml
PLAY [Deploy PostgreSQL HA Cluster (based on "Patroni" and "etcd")] ************************************************************[WARNING]: Unhandled error in Python interpreter discovery for host postgresql_exists=true: Failed to connect to the host via
ssh: ssh: Could not resolve hostname postgresql_exists=true: Name or service not known
TASK [Gathering Facts] *********************************************************************************************************fatal: [postgresql_exists=true]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"postgresql_exists=true\". Make sure this host can be reached over ssh: ssh: Could not resolve hostname postgresql_exists=true: Name or service not known\r\n", "unreachable": true}
ok: [xxx.8]
ok: [xxx.3]
ok: [xxx.11]
NO MORE HOSTS LEFT *************************************************************************************************************
PLAY RECAP *********************************************************************************************************************xxx.11 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
xxx.3 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
xxx.8 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
postgresql_exists=true : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0 `
here i change a inventory file :
@emanfeah See example
# PostgreSQL nodes
[master]
10.128.64.140 hostname=pgnode01 postgresql_exists=true
[replica]
10.128.64.142 hostname=pgnode02 postgresql_exists=true
10.128.64.143 hostname=pgnode03 postgresql_exists=true
what about the replicas Vm , its need to install a Postgresql manually Right ? and it will sync ?
You can add replicas automatically
# PostgreSQL nodes
[master]
10.128.64.140 hostname=pgnode01 postgresql_exists=true
[replica]
10.128.64.142 hostname=pgnode02 postgresql_exists=false
10.128.64.143 hostname=pgnode03 postgresql_exists=false
Or separately using the playbook add_pgnode.yml
(details)
hello ,
i want ask you about if we have already a DataBase (postgresql) in Virtual Machine can we install patroni without loosing the db ? and how we can do that approach on your playbook ..