vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 411 forks source link

add balancer error #610

Closed bogdan-atl closed 7 months ago

bogdan-atl commented 7 months ago

У меня ошибка вылетает при добавлении нового haproxy на Debian 11

TASK [haproxy : Copy haproxy.cfg file to replica] *************************************************************************************************************************************
ok: [45.152.84.248]

TASK [haproxy : Remove haproxy.cfg file from localhost] *******************************************************************************************************************************
changed: [45.152.84.248 -> localhost]

TASK [haproxy : Prepare haproxy.cfg conf file (replace "bind")] ***********************************************************************************************************************
ok: [45.152.84.248] => (item=    bind 45.152.84.248:7000)
ok: [45.152.84.248] => (item=    bind 45.152.84.248:5000)
ok: [45.152.84.248] => (item=    bind 45.152.84.248:5001)
ok: [45.152.84.248] => (item=    bind 45.152.84.248:5002)
ok: [45.152.84.248] => (item=    bind 45.152.84.248:5003)

TASK [confd : Download and copy "confd" binary file to /usr/local/bin/] ***************************************************************************************************************
ok: [45.152.84.248] => (item=https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64)

TASK [confd : Create conf directories] ************************************************************************************************************************************************
ok: [45.152.84.248] => (item=/etc/confd/conf.d)
ok: [45.152.84.248] => (item=/etc/confd/templates)

TASK [confd : Fetch confd.toml, haproxy.toml, haproxy.tmpl conf files from 45.152.84.248] *********************************************************************************************
failed: [45.152.84.248] (item=/etc/confd/confd.toml) => {"ansible_loop_var": "item", "changed": false, "item": "/etc/confd/confd.toml", "msg": "the remote file does not exist, not transferring, ignored"}
failed: [45.152.84.248] (item=/etc/confd/conf.d/haproxy.toml) => {"ansible_loop_var": "item", "changed": false, "item": "/etc/confd/conf.d/haproxy.toml", "msg": "the remote file does not exist, not transferring, ignored"}
failed: [45.152.84.248] (item=/etc/confd/templates/haproxy.tmpl) => {"ansible_loop_var": "item", "changed": false, "item": "/etc/confd/templates/haproxy.tmpl", "msg": "the remote file does not exist, not transferring, ignored"}

NO MORE HOSTS LEFT ********************************************************************************************************************************************************************

PLAY RECAP ****************************************************************************************************************************************************************************
45.152.84.248              : ok=28   changed=2    unreachable=0    failed=1    skipped=62   rescued=0    ignored=0   

image

vitabaks commented 7 months ago

@bogdan-atl Судя по логу на сервере нет файлов конфигурации и шаблонов confd для копирования ("the remote file does not exist")

Проверьте наличие каталога /etc/confd на сервере указанным первым в группе balancers в инветори.

During the run this playbook, the new balancer node will be prepared in the same way as when first deployment the cluster. But unlike the initial deployment, all necessary configuration files will be copied from the first server specified in the inventory file in the "balancers" group.

Возникает также вопроc, действительно ли сервера балансировщиков были изначально подняты с использованием автоматизации postgesql_cluster?

vitabaks commented 7 months ago

Убедитесь что вы следуете инструкции https://github.com/vitabaks/postgresql_cluster?tab=readme-ov-file#cluster-scaling

В этом примере мы добавляем узел балансировщика с IP-адресом 10.128.64.144 (для которого указан 'new_node=true')

[balancers]
10.128.64.140
10.128.64.142
10.128.64.143
10.128.64.144 new_node=true

Здесь конфги будут скопированы с сервреа 10.128.64.140

Похоже в Вашем случае, новый сервер указан первым в списке, что и приводит к подобному поведению.

bogdan-atl commented 7 months ago

Добрый вечер, ага теперь все понятно. У меня изначально установка была без haproxy.

vitabaks commented 7 months ago

@bogdan-atl тогда используйте плейбук balancers.yml для развертывания новых балансировщиков