장고 설치에서 python manage.py syncdb
을 수행하려고하는데, 계속 OperationalError: ERROR: pgbouncer cannot connect to server
이 계속됩니다.OperationalError : 오류 : pgbouncer가 서버에 연결할 수 없습니다.
;; dbname= host= port= user= password=
mydb = host=xx.xxx.xxx.xxx port=5432 dbname=mydb
;forcedb = host=127.0.0.1 port=300 user=baz password=foo client_encoding=UNICODE datestyle=ISO connect_query='SELECT 1'
listen_port = 6432
마지막 settings.py
의 관련 부분이 포함되어
2017-09-19 19:44:15.107 1128 LOG C-0x8a9930: mydb/[email protected]:6432 closing because: pgbouncer cannot connect to server (age=0)
2017-09-19 19:44:15.107 1128 WARNING C-0x8a9930: mydb/[email protected]:6432 Pooler Error: pgbouncer cannot connect to server
2017-09-19 19:44:15.107 1128 LOG S-0x8c72e0: mydb/[email protected]:5432 new connection to server
2017-09-19 19:44:15.107 1128 LOG C-0x8a9930: mydb/[email protected]:6432 login failed: db=mydb user=myuser
2017-09-19 19:44:30.108 1128 LOG S-0x8c72e0: mydb/[email protected]:5432 closing because: connect failed (age=15)
필요한 경우
, ps -aef | grep pgbouncer
수율 :에 grep port /etc/pgbouncer/pgbouncer.ini
결과 또한
postgres 1128 1 0 18:38 ? 00:00:00 /usr/sbin/pgbouncer -d /etc/pgbouncer/pgbouncer.ini
myuser 1919 1533 0 19:45 pts/0 00:00:00 grep --color=auto pgbouncer
, pgbouncer.log 같은 라인을 포함 :
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydb',
'USER': 'myuser',
'PASSWORD': 'mypassword',
'HOST': '/var/run/postgresql',
'PORT': '6432',
}
postgresql.conf에서 log_connections
을 on
으로 설정하고 PG를 다시 시작한 후 다시 시도했습니다. 다음은 관련 라인이다 :
2017-09-20 07:50:59 UTC LOG: database system is ready to accept connections
2017-09-20 07:50:59 UTC LOG: autovacuum launcher started
2017-09-20 07:51:00 UTC LOG: connection received: host=[local]
2017-09-20 07:51:00 UTC LOG: incomplete startup packet
2017-09-20 07:51:00 UTC LOG: connection received: host=[local]
2017-09-20 07:51:00 UTC LOG: connection authorized: user=postgres database=postgres
2017-09-20 07:51:01 UTC LOG: connection received: host=[local]
2017-09-20 07:51:01 UTC LOG: connection authorized: user=postgres database=postgres
2017-09-20 07:51:01 UTC LOG: connection received: host=[local]
2017-09-20 07:51:01 UTC LOG: connection authorized: user=postgres database=postgres
연결이 겪고있는 것 같다,하지만 user
및 database
이름은 postgres
입니다. 그 자격 증명은 내가 pgbouncer.ini
에서 제공 한 것이 아닙니다.
2017-09-20 09:37:37 UTC FATAL: Peer authentication failed for user "myuser"
2017-09-20 09:37:37 UTC DETAIL: Connection matched pg_hba.conf line 90: "local all all peer"
모두 난처한 :
그러나 명시pgbouncer.ini
에 기재된 연결 문자열
myuser
을 첨가하여 리드.
'PORT': '6432',
나는 그것을 주석과 pgbouncer는 일을 시작 :
PostgreSQL 로그에서 그 점에 관해 무엇을 말하고 있습니까? PostgreSQL은 대상에서 실행됩니까? –
내 의견의 첫 부분을 읽지 않았습니다. 'log_connections'을'on'으로 바꾸고 PostgreSQL 로그를 확인하십시오. –
settings.py는 소켓 디렉토리를 호스트로 정의했지만 localhost는'/ etc/pgbouncer/pgbouncer.ini'에 있습니다 -'/ var/run/postgresql'을'127.0.0.1'로 변경하십시오'settings.py' –