2013-04-16 3 views
1

pgbouncer를 독립형 PostgreSQL 서버에서 작동 시키려고하는데, pgbouncer 포트를 사용하여 데이터베이스에 연결하려고하면 시간 초과 오류가 발생합니다.pgbouncer가 로컬 postgresql 데이터베이스에 연결할 수 없습니다. (시간 초과)

PostgreSQL을 : 9.1.8은

pgBouncer : 1.4.2

OS : 여기

내 conf의 우분투 12.04.2 LTS (GNU/리눅스 3.8.4-x86_64의-linode31의 x86_64의)입니다 파일 :

[databases] 
postgres = host=127.0.0.1 port=5432 dbname=postgres 
mydb = host=127.0.0.1 port=5432 dbname=mydb 

[pgbouncer] 
logfile = /home/username/pg_log/pgbouncer.log 
pidfile = /tmp/pgbouncer.pid 
listen_addr = xxx.xxx.xxx.xxx 
listen_port = 6432 
unix_socket_dir = /var/run/postgresql 
auth_type = md5 
auth_file = /etc/pgbouncer/userlist.txt 
admin_users = postgres 
stats_users = stats, root 
user = postgres 
pool_mode = session 
server_reset_query = DISCARD ALL 
max_client_conn = 1000 
default_pool_size = 20 
log_connections = 1 
log_disconnections = 1 
log_pooler_errors = 1 

임과 같이 연결을 테스트하려고 :

psql -p 6432 -U postgres mydb 
012,351을

28396 LOG listening on xxx.xxx.xxx.xxx:6432 
28396 LOG listening on unix:/var/run/postgresql/.s.PGSQL.6432 
28396 LOG process up: pgbouncer 1.4.2, libevent 2.0.16-stable (epoll), adns: evdns2 
28864 LOG C-0x23f7890: mydb/[email protected]:6432 login attempt: db=mydb user=postgres 
28864 LOG C-0x23f7890: mydb/[email protected]:6432 closing because: client unexpected eof (age=0) 
28864 LOG C-0x23f7890: mydb/[email protected]:6432 login attempt: db=mydb user=postgres 
28864 LOG S-0x2415240: mydb/[email protected]:5432 new connection to server 
28864 LOG S-0x2415240: mydb/[email protected]:5432 closing because: connect failed (age=0) 
28864 LOG S-0x2415240: mydb/[email protected]:5432 new connection to server 
28864 LOG S-0x2415240: mydb/[email protected]:5432 closing because: connect failed (age=0) 
28864 LOG S-0x2415240: mydb/[email protected]:5432 new connection to server 
28864 LOG S-0x2415240: mydb/[email protected]:5432 closing because: connect failed (age=0) 
28864 LOG S-0x2415240: mydb/[email protected]:5432 new connection to server 
28864 LOG S-0x2415240: mydb/[email protected]:5432 closing because: connect failed (age=0) 
28864 LOG Stats: 0 req/s, in 0 b/s, out 0 b/s,query 0 us 
28864 LOG C-0x23f7890: mydb/[email protected]:6432 closing because: client_login_timeout (server down) (age=60) 
28864 WARNING C-0x23f7890: mydb/[email protected]:6432 Pooler Error: client_login_timeout (server down) 
28864 LOG Stats: 0 req/s, in 0 b/s, out 0 b/s,query 0 us 
28864 LOG Stats: 0 req/s, in 0 b/s, out 0 b/s,query 0 us 

내가 pgbouncer 작업을 만들기 위해 변경해야 다른 무언가가 : 여기 6,

내 로그 파일입니다?

+0

방화벽은 단방향 패킷을 차단합니까? –

+0

흠, 이상하게 보입니다. 내 로컬 및 외부 연결 테스트 : tcp 0 0 xxx.xxx.xxx.xxx : 6432 0.0.0.0:* LISTEN 27040/pgbouncer –

답변

1

변경

listen_addresses = 'private_ip' 

postgresql.conf 파일에서

listen_addresses = '*' 

합니다.

+1

'listen_addresses ='localhost ''가 작동하지 않아야합니까? –

0

유닉스 소켓을 사용하여 연결하려는 것 같습니다. Postgres 설치에 따라 소켓은/var/run/postgres가 아닌/tmp에 생성되었을 수 있습니다. 나는이 같은 문제에 부딪 쳤고 그것은 discussed here이었다.

이에 pgbouncer.ini 설정을 변경해보십시오 :

unix_socket_dir = /tmp 

또한 다음과 같이 -h를 추가하여 로컬 호스트에 연결 만 시도 할 수 :

psql -p 6432 -h localhost -U postgres mydb 

희망이 도움이!

+0

오류가 내 postgresql.conf 파일에 있습니다. 내 listen_adresses는 로컬 수신을 허용하지 않도록 설정되었습니다. listen_addresses = '*'로 변경하고 이제 작동합니다! –

+1

좋습니다! 업데이트 해줘서 고마워. – marcj

관련 문제