PostgreSQL

[PostgreSQL] PostgreSQL PGPOOL with failover

bbugge 2021. 2. 8. 14:50

 

// pgpool 다운로드 경로

yum install -y https://www.pgpool.net/yum/rpms/4.2/redhat/rhel-7-x86_64/pgpool-II-pg10-4.2.1-1pgdg.rhel7.x86_64.rpm

yum install -y https://www.pgpool.net/yum/rpms/4.2/redhat/rhel-7-x86_64/pgpool-II-pg10-devel-4.2.1-1pgdg.rhel7.x86_64.rpm

yum install -y https://www.pgpool.net/yum/rpms/4.2/redhat/rhel-7-x86_64/pgpool-II-pg10-debuginfo-4.2.1-1pgdg.rhel7.x86_64.rpm

yum install -y https://www.pgpool.net/yum/rpms/4.2/redhat/rhel-7-x86_64/pgpool-II-pg10-extensions-4.2.1-1pgdg.rhel7.x86_64.rpm

 

// pgpool 로드밸런싱

https://browndwarf.tistory.com/6?category=803646

 

PostgreSQL HA 구성 - 2. PGPool을 활용한 Load Balance 구현

PGPool Overview PostgreSQL의 기능 확장을 위해 많이 사용되는 Middle Ware로 Pool이라는 이름에서 알 수 있듯이 최초 개발 목적은 Connection Pooling을 위해 만들어 졌지만, 이후 기능이 확장되면서 PostgreSQL..

browndwarf.tistory.com

// pgpool failover

https://browndwarf.tistory.com/7?category=803646

 

PostgreSQL HA 구성 - 3. PGPool을 활용한 FailOver 구현

pgpool.conf Configuration II 이전 포스트 'PostgreSQL HA 구성 - 2. PGPool을 활용한 Load Balance 구현' 에서 PGPool이 제공하는 기능 중 Failover, Failback이 있었다고 했다. 이를 활성화 하기 위해서는 pgpo..

browndwarf.tistory.com

 

 

// pgpool 설정 시 발생했던 에러

// wrong authentication about pgpool.conf or not created pgpool.conf

systemctl status pgpool
LOG: health_check_stats_shared_memory_size: requested size: 12288
LOG:  memory cache initialized
DETAIL:  memcache blocks :64

 

// check the pg_hba.conf

systemctl status pgpool

 LOG:  find_primary_node: make_persistent_db_connection_noerror failed on node 0
 LOG:  find_primary_node: standby node is 1

 ERROR:  failed to authenticate
 DETAIL:  호스트 "192.168.10.200", 사용자 "postgres", 데이터베이스 "postgres", SSL 중지 연결에 대한 설정이 pg_hba.conf 파일에 없습니다.

 

// check the enable_pool_hba parameter in pgpool.conf or check that add 'host    all         all         0.0.0.0/0             md5' to pool_hba.conf

psql -h 192.168.10.200 -p 5433 -U postgres
psql: ERROR:  failed to authenticate with backend using md5
상세정보:  valid password not found

 

// add to pool_passwd (do command 'pg_md5 -m -p postgres & cat pool_passwd >> pcp.conf')

psql -h 192.168.10.200 -p 5433 -U postgres
psql: FATAL:  md5 authentication failed
상세정보:  pool_passwd file does not contain an entry for "postgres"

 

// pg pool 설정 후 show pool_nodes; > master 혹은 standby 의 status 가 down인 경우
- pgpool.conf 파일의 sr_check_database 값 확인할 것 
- pcp_attach_node -n [node_num]