일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- JavaScript
- IntelliJ
- kubeflow
- docker
- codedeploy error
- SQL
- Airflow
- Jenkins
- bootstrap
- VPN
- codepipeline
- chartjs
- or some instances in your deployment group are experiencing problems.
- AWS CI/CD 구축하기
- node
- Python
- Spring
- aws cicd
- Spring Error
- chart.js
- Flux
- Kafka
- aws
- codedeploy
- COALESCE
- redis
- java bigdecimal
- codebuild
- 도커
- PostgreSQL
- Today
- Total
Small Asteroid Blog
Postgresql에서 5432 port가 열려있냐는 문제(Ubuntu 기준) 본문
1. 에러
각종 서비스에서 5432 port가 열려있느냐를 묻는 에러가 발생한다.
django는 이런 식.
Is the server running on host XXX and accepting TCP/IP connections on port 5432?
어쨌든 connection이 안되면 서비스가 실행되는지, port가 열려있는지 확인해보는게 좋다.
2. 확인
1) htop 에서 postgresql이 있는지 본다. 혹은 ps -el.
2) netstat -ntl로 5432가 열려있는지 본다.
3) service postgresql status로 서비스가 active 상태인지 본다.
3. 해결방법
1) postgresql이 실행되어 있지 않다.
sudo service postgresql start.
2) 5432 port가 열려있지 않다.
/etc/posgresql/VERSION/main/pg_hba.conf
/var/lib/pgsql/11/data/pg_hba.conf 에서
# IPv4 local connections 아래
host all all 0.0.0.0/0 md5
를 추가(혹은 수정)
- 외부에서 접속하는 경우 방화벽이 막혀있는 경우가 있다. 열어도 되는 서버라면
iptables -I INPUT 1 -p tcp --dport 5432 -j ACCEPT
iptables -I OUTPUT 1 -p tcp --dport 5432 -j ACCEPT
AWS EC2는 EC2 콘솔에 가서 열어야 하는 것 같다.
3) 실행도 되어있고 port도 열려있다.
이전 실행에서 비정상적으로 종료된 경우가 가끔 있다.
/var/lib/postgresql/VERSION/main/postmaster.pid
/var/lib/pgsql/VERSION/data/postmaster.pid
를 삭제하고 다시 postgresql을 시작한다.
재시작
sudo systemctl restart postgresql-11
4. 기타
1) 로그 위치 : /var/log/postgresql/postgresql-VERSION-main.log
'백엔드 > DB' 카테고리의 다른 글
[SQL] row number (0) | 2021.07.19 |
---|---|
postgresql 서비스 시작 및 상태 확인 (0) | 2021.06.30 |
서버에서 postgresql 접속 및 데이터베이스, 스키마, 테이블 조회 (0) | 2021.06.18 |
postgresql - relation "hibernate_sequence" does not exist (0) | 2021.05.14 |
Column count of mysql.proc is wrong. Expected 21, found 20. The table is probably corrupted (0) | 2021.04.16 |