Pastebin
Retrouvez, créez et partagez vos snippets en temps réel.
Rechercher un Pastebin
Aucun paste trouvé.
Créer un paste
Pastebin
Blog
ooooooooooo
cat <<'EOF' > /usr/local/bin/check_pg_primary.sh #!/bin/bash pg_isready -q || exit 1 IS_PRIMARY=$(psql -U postgres -tAc "SELECT NOT pg_is_in_recovery();") [ "$IS_PRIMARY" = "t" ] && exit 0 || exit 1 EOF chmod 755 /usr/local/bin/check_pg_primary.sh sudo -u postgres /usr/local/bin/check_pg_primary.sh && echo OK || echo NOT_PRIMARY ============================== global_defs { router_id PG_MINIO1 } vrrp_script chk_pg_primary { script "sudo -u postgres /usr/local/bin/check_pg_primary.sh" interval 2 fall 2 rise 1 } vrrp_instance VI_PG { state MASTER interface eth0 virtual_router_id 51 priority 100 advert_int 1 unicast_src_ip 172.16.26.161 unicast_peer { 172.16.26.162 } authentication { auth_type PASS auth_pass StrongVrrpPass } virtual_ipaddress { 172.16.26.170/24 } track_script { chk_pg_primary } } ======================================= global_defs { router_id PG_MINIO2 } vrrp_script chk_pg_primary { script "sudo -u postgres /usr/local/bin/check_pg_primary.sh" interval 2 fall 2 rise 1 } vrrp_instance VI_PG { state BACKUP interface eth0 virtual_router_id 51 priority 90 advert_int 1 unicast_src_ip 172.16.26.162 unicast_peer { 172.16.26.161 } authentication { auth_type PASS auth_pass StrongVrrpPass } virtual_ipaddress { 172.16.26.170/24 } track_script { chk_pg_primary } } =================== psql -h 172.16.26.170 -U postgres -c "SELECT inet_server_addr();"
Créé il y a 4 semaines.