[Postgres] Connection reset
정리 - 방화벽이 뚫려있는데 dbeaver로 개발서버에 접근하지 못한다.
환경
1. postgresql 9.5
2. dbeaver 6.2.4.201911031605
3. RedHat 7.3버전
증상
dbeaver로 연결 시도 시
Connection reset
The connection attempt failed.
Connection reset
힌트
1. postgresql은 서비스 구동중. 서버내 psql로 접근 가능, 확인 가능
2. dbeaver은 운영서버는 잘 붙는다.
3. 개발서버 local방화벽 inactive 상태 - systemctl status firewalld.service
4. 운영서버 개발 서버 핑 모두 받음. 100%, TTL, 시간도 동일
5. 운영서버 개발 서버 telnet 접속 가능 - telnet <IP> 5432
결론
해결했다. 글을 쓰는 도중에 해결해버렸다..
서버간 연결을 확인하려고 구글링 하다가
https://dejavuqa.tistory.com/32
외부 서버에서 postgresql 접속하기
PostgreSQL을 기본 설치하면 외부에서는 접속할 수가 없다. config를 수정해 줘야 한다. 우선 Ubuntu에서 열려있는 포트를 확인해 보자. 포트 확인은 netstat -ntlp로 확인하자 $ netstat -ntlp (Not all processe..
dejavuqa.tistory.com
이 글을 보고 서버에 postgres의 버전이 두개라는 것을 확인하고
systemctl status postgresql-9.5
systemctl stop postgresql-9.5
systemctl start postgresql-9.6
systemctl status postgresql-9.6
로 끝을 내버렸다.
찐결론
서버에 postgresql이 2개 버전이 있었고 최근에 서버를 reboot한 적이 있는데
둘다 서비스에 등록 되어 있지만 9.5 버전이 먼저 실행되고 9.6 버전은 실행되지 않은 것 같다.
9.5 버전의 postgresql.conf에는 listen_addresses가 localhost 였고
9.6 버전의 postgresql.conf에는 listen_addresses가 *이었다.
9.5버전 종료 후 9.6 서비스 실행
실험
뭔가 싸하긴 했다. 왜냐면 dbeaver에서 test를 누른지 0.0001초만에 에러메세지가 떴기 때문
시스템 사이에 외부 방화벽이 있고 방화벽 허용이 안되어 있는 상태로 dbeaver로 연결을 시도하면. Connection attemp timed out이 한참 걸려 나온다.
내부방화벽은 테스트를 못해봄.(겁남)
db명이 틀리면 db명이 틀렸다고, FATAL: database "~" does not exist
user명이 틀리면 FATAL: password authentication failed for user "~"
라고 나온다.
systemctl disable postgresql-9.5.service
systemctl enable postgresql-9.6.service