backend/sql (postgres) 21

RDS에서 로컬로 postgres pg_dump해서 데이터 가져오기

데이터 가져오기이전에 한번 RDS에서 postgres 데이터를 가져오는 법을 정리한 적이 있는데, 이번에 한 번 더 해보니 잘 되지 않아서 다시한번 트러블슈팅을 기록해둔다.우선 이 명령어로 postgres 데이터를 가져올 수 있다.$ pg_dump -h -U -f public dns에는 ip dns나 rds endpoint를 적어도 무방하다.이렇게 했더니 다음 오류가 발생.pg_dump: [archiver (db)] connection to database "gcf" failed: could not connect to server: Connection timed out Is the server running on host "***********" (18.195.59.***) and accepting TC..

Mac (OS X)에 postgres 설치하기 (sierra 10.12.6)

brew tap petere/postgresql # search로 원하는 postgresql 버전을 찾을 수 있다. brew search postgresql brew install petere/postgresql/postgresql@10 Run this command to start postgres manuallypg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start psql postgres 사실 postgres 설치는 매우 간단하게 할 수 있지만, 이를 실행시키는 데서 잠깐 애를 먹었다. ubuntu에서는 service 명령어로 postgres를 실행시키던걸 pg_ctl 명령어로 실행시켜주면 된다.

ubuntu postgres systemctl restart 명령어

ubuntu 16.04에서 postgres를 사용해보면서 service 명령어가 아니라 systemctl 명령어를 처음 사용해보았다. 그런데 계속 restart, start 등의 명령어로도 postgresql을 찾을 수 없다는 오류가 나와서 글을 찾던 중 SO에서 여러 버전의 postgresql이 깔린 경우에는 해당 버전을 다 적어주어야 한다는 말을 보고 시도해봤다. 결과는 성공!postgresql 9.5를 기준으로 작성한 명령어sudo systemctl restart postgresql@9.5-main.service