database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 9751 게시물 읽기
No. 9751
pgpool watchdog을 통한 vip 설정 방법 질문이요!
작성자
Dean(crazzy0202)
작성일
2017-01-11 11:47
조회수
10,361

 안녕하세요. 

PostgreSQL 초보입니다.

PostgreSQL 실력자 분들께 문의드립니다.

두 PostgreSQL 서버가 Active/Standby로 Replication 구성되어 있습니다.

VIP를 사용하여 Master를 바라보고 있다가, Master가 죽으면 Standby로 IP를 넘겨줄 수 있게 설정하려고합니다.

그래서 Pgpool2를 사용했구요.

pgpool의 기능중에 watchdog이라는 기능이 있더라구요. 이게 VIP 설정을 해주는 역할인거 같긴한데... 정확한 사용법을 모르겠네요.

 

아래 pgpool.conf파일입니다.

먼저 Master 쪽입니다.

 

 

# WATCHDOG

#------------------------------------------------------------------------------

 

# - Enabling -

 

use_watchdog = on

                                    # Activates watchdog

                                    # (change requires restart)

 

# -Connection to up stream servers -

 

trusted_servers = ''

                                    # trusted server list which are used

                                    # to confirm network connection

                                    # (hostA,hostB,hostC,...)

                                    # (change requires restart)

ping_path = '/bin'

                                    # ping command path

                                    # (change requires restart)

 

# - Watchdog communication Settings -

 

wd_hostname = '마스터 IP'

                                    # Host name or IP address of this watchdog

                                    # (change requires restart)

wd_port = 9000

                                    # port number for watchdog service

                                    # (change requires restart)

wd_priority = 1

                                                                        # priority of this watchdog in leader election

                                                                        # (change requires restart)

 

wd_authkey = ''

                                    # Authentication key for watchdog communication

                                    # (change requires restart)

 

wd_ipc_socket_dir = '/tmp'

                                                                        # Unix domain socket path for watchdog IPC socket

                                                                        # The Debian package defaults to

                                                                        # /var/run/postgresql

                                                                        # (change requires restart)

 

 

# - Virtual IP control Setting -

 

delegate_IP = 'VIP 주소'

                                    # delegate IP address

 

                                    # (change requires restart)

if_cmd_path = '/sbin'

                                    # path to the directory where if_up/down_cmd exists

                                    # (change requires restart)

#if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'

if_up_cmd = 'ifconfig eth1 inet $_IP_$ netmask 255.255.255.0'

                                    # startup delegate IP command

                                    # (change requires restart)

#if_down_cmd = 'ip addr del $_IP_$/24 dev eth0'

if_down_cmd = 'ifconfig eth1 down'

                                    # shutdown delegate IP command

                                    # (change requires restart)

arping_path = '/usr/sbin'

                                    # arping command path

                                    # (change requires restart)

arping_cmd = 'arping -U $_IP_$ -w 1'

                                    # arping command

                                    # (change requires restart)

 

 

 

 

 

other_pgpool_hostname0 = 'Standby서버 호스트명'

                                    # Host name or IP address to connect to for other pgpool 0

                                    # (change requires restart)

other_pgpool_port0 = 9999

                                    # Port number for othet pgpool 0

                                    # (change requires restart)

other_wd_port0 = 9000

                                    # Port number for othet watchdog 0

                                    # (change requires restart)

#other_pgpool_hostname1 =

#other_pgpool_port1 =

#other_wd_port1 = 9000

 

 

 

Standby 쪽도 설정은 동일합니다.

Master 서버의 conf파일 저장 후, ./pgpool -f pgpool.conf 해서 start했더니, 얼마 지나지 않아 세션끊기면서 eth1이 vip주소로 바뀌는 현상이 발생했습니다.

제가 원하는건 vip로 master에 접속가능하고 master 장애시 standby서버로 vip가 넘어가는 것인데, 잘 안되네요.

 

도움 부탁드립니다.

 

 

이 글에 대한 댓글이 총 3건 있습니다.

 watchdog 부분 모두 긁어왔습니다.

 

 

# WATCHDOG

#------------------------------------------------------------------------------


# - Enabling -


use_watchdog = on

                                    # Activates watchdog

                                    # (change requires restart)


# -Connection to up stream servers -


trusted_servers = ''

                                    # trusted server list which are used

                                    # to confirm network connection

                                    # (hostA,hostB,hostC,...)

                                    # (change requires restart)

ping_path = '/bin'

                                    # ping command path

                                    # (change requires restart)


# - Watchdog communication Settings -


wd_hostname = 'active서버 ip'

                                    # Host name or IP address of this watchdog

                                    # (change requires restart)

wd_port = 9000

                                    # port number for watchdog service

                                    # (change requires restart)

wd_priority = 1

                                                                        # priority of this watchdog in leader election

                                                                        # (change requires restart)


wd_authkey = ''

                                    # Authentication key for watchdog communication

                                    # (change requires restart)


wd_ipc_socket_dir = '/tmp'


                                                                        # Unix domain socket path for watchdog IPC socket

                                                                        # The Debian package defaults to

                                                                        # /var/run/postgresql

                                                                        # (change requires restart)



# - Virtual IP control Setting -


delegate_IP = 'vip 주소'

                                    # delegate IP address

                                    # If this is empty, virtual IP never bring up.

                                    # (change requires restart)

if_cmd_path = '/sbin'

                                    # path to the directory where if_up/down_cmd exists

                                    # (change requires restart)

if_up_cmd = 'ifconfig eth1 inet vip주소 netmask 255.255.255.0'

                                    # startup delegate IP command

                                    # (change requires restart)

if_down_cmd = 'ifconfig eth1 down'

                                    # shutdown delegate IP command

                                    # (change requires restart)

arping_path = '/usr/sbin'

                                    # arping command path

                                    # (change requires restart)

arping_cmd = 'arping -U vip주소 -w 1'

                                    # arping command

                                    # (change requires restart)


# - Behaivor on escalation Setting -


clear_memqcache_on_escalation = on

                                    # Clear all the query cache on shared memory

                                    # when standby pgpool escalate to active pgpool

                                    # (= virtual IP holder).

                                    # This should be off if client connects to pgpool

                                    # not using virtual IP.

                                    # (change requires restart)

wd_escalation_command = ''

                                    # Executes this command at escalation on new active pgpool.


                                    # (change requires restart)

wd_de_escalation_command = ''

                                                                        # Executes this command when master pgpool resigns from being master.

                                                                        # (change requires restart)


# - Lifecheck Setting -


# -- common --


wd_monitoring_interfaces_list = ''  # Comma separated list of interfaces names to monitor.

                                                                        # if any interface from the list is active the watchdog will

                                                                        # consider the network is fine

                                                                        # 'any' to enable monitoring on all interfaces except loopback

                                                                        # '' to disable monitoring



wd_lifecheck_method = 'query'

                                    # Method of watchdog lifecheck ('heartbeat' or 'query' or 'external')

                                    # (change requires restart)

wd_interval = 10

                                    # lifecheck interval (sec) > 0

                                    # (change requires restart)


# -- heartbeat mode --


wd_heartbeat_port = 9694

                                    # Port number for receiving heartbeat signal

                                    # (change requires restart)

wd_heartbeat_keepalive = 2

                                    # Interval time of sending heartbeat signal (sec)

                                    # (change requires restart)

wd_heartbeat_deadtime = 30

                                    # Deadtime interval for heartbeat signal (sec)

                                    # (change requires restart)

heartbeat_destination0 = 'host0_ip1'

                                    # Host name or IP address of destination 0

                                    # for sending heartbeat signal.

                                    # (change requires restart)

heartbeat_destination_port0 = 9694



                                    # Port number of destination 0 for sending

                                    # heartbeat signal. Usually this is the

                                    # same as wd_heartbeat_port.

                                    # (change requires restart)

heartbeat_device0 = ''

                                    # Name of NIC device (such like 'eth0')

                                    # used for sending/receiving heartbeat

                                    # signal to/from destination 0.

                                    # This works only when this is not empty

                                    # and pgpool has root privilege.

                                    # (change requires restart)


#heartbeat_destination1 = 'host0_ip2'

#heartbeat_destination_port1 = 9694

#heartbeat_device1 = ''


# -- query mode --


wd_life_point = 3

                                    # lifecheck retry times

                                    # (change requires restart)

wd_lifecheck_query = 'SELECT 1'

                                    # lifecheck query to pgpool from watchdog

                                    # (change requires restart)

wd_lifecheck_dbname = 'postgres'

                                    # Database name connected for lifecheck

                                    # (change requires restart)

wd_lifecheck_user = 'postgres'

                                    # watchdog user monitoring pgpools in lifecheck

                                    # (change requires restart)

wd_lifecheck_password = 'postgres'

                                    # Password for watchdog user in lifecheck

                                    # (change requires restart)


# - Other pgpool Connection Settings -



other_pgpool_hostname0 = 'standby서버 호스트네임'

                                    # Host name or IP address to connect to for other pgpool 0

                                    # (change requires restart)

other_pgpool_port0 = 9999

                                    # Port number for othet pgpool 0

                                    # (change requires restart)

other_wd_port0 = 9000

                                    # Port number for othet watchdog 0

                                    # (change requires restart)

#other_pgpool_hostname1 = 'host1'

#other_pgpool_port1 = 5432

#other_wd_port1 = 9000

 

lifecheck 방법으로는 query를 택했습니다.

양 쪽 서버 모두 똑같이 설정해주고

/usr/local/pgpool/bin/pgpool -f /usr/local/pgpool/etc/pgpool.conf -a /usr/local/pgpool/etc/pool_hba.conf -d > log.txt

명령어를 active -> standby 차례로 쳐줬습니다.

 

그랬더니 양쪽 모두

 

2017-01-12 10:55:54: pid 28255: DETAIL:  ifup[/sbin/ifconfig] doesn't have setuid bit

2017-01-12 10:55:54: pid 28255: WARNING:  checking setuid bit of if_down_cmd

2017-01-12 10:55:54: pid 28255: DETAIL:  ifdown[/sbin/ifconfig] doesn't have setuid bit

2017-01-12 10:55:54: pid 28255: WARNING:  checking setuid bit of arping command

2017-01-12 10:55:54: pid 28255: DETAIL:  arping[/usr/sbin/arping] doesn't have setuid bit

 

이런 메시지가 뜨네요.

 

그리고나서 몇 초 후에 active서버의 ip가 vip로 바껴버리네요..

근데 또 이상한 점이 바뀐vip주소로 ping은 날아가는데 접속이 안됩니다...

 

 

Dean(crazzy0202)님이 2017-01-12 11:05에 작성한 댓글입니다.

pgpool을 이용한 가상IP 할당 서비스는 개념부터 잘 알고 계셔야 합니다.

 

총 IP가 3개 쓰입니다.

Virtual IP (vip), host1 IP, host2 IP

 

운영 전환을 하면, vip 를 해당 호스트의 서비스 IP를 사용하는 이더넷 디바이스 별칭으로 설정합니다.

그래서, if_up_cmd 에서 이더넷 디바이스명이 eth1 이 아니라, eth1:0 형태여야 합니다.

 

한편!

pgpool의 failover - virtual ip 전환 기능은 그리 예쁘지 않습니다.

고 가용성을 생각하신다면, pacemaker + PAF  를 권해드립니다.

http://dalibo.github.io/PAF/

 

 

김상기(ioseph)님이 2017-01-12 15:54에 작성한 댓글입니다.
이 댓글은 2017-01-12 15:57에 마지막으로 수정되었습니다.

 답변 감사합니다!

Dean(crazzy0202)님이 2017-01-16 15:59에 작성한 댓글입니다.
[Top]
No.
제목
작성자
작성일
조회
9754FDW 생성 테이블 접근 권한 확인은 어떻게 하나요? [3]
김은경
2017-01-16
7708
9753pg에서 after트리거 문의 [2]
지현명
2017-01-16
7750
9752dblink? 방법론 [1]
사랑
2017-01-11
8445
9751pgpool watchdog을 통한 vip 설정 방법 질문이요! [3]
Dean
2017-01-11
10361
9750Slony-I Replication 참고자료 [1]
사랑
2017-01-10
7522
9749PostgreSQL 인스턴스 명 [1]
고래
2017-01-04
8309
9748libpq-be.h 의 Port 구조체 정보 가져오기 [3]
궁금궁금
2016-12-30
8597
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2023 DSN, All rights reserved.
작업시간: 0.056초, 이곳 서비스는
	PostgreSQL v16.1로 자료를 관리합니다