Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgreSQL backup system #23

Open
Byunk opened this issue Dec 23, 2023 · 2 comments
Open

postgreSQL backup system #23

Byunk opened this issue Dec 23, 2023 · 2 comments
Assignees
Labels
infrastructure This issue is related to infrastructure or deployment new feature New feature or request

Comments

@Byunk
Copy link
Collaborator

Byunk commented Dec 23, 2023

원활한 서비스 운영과 안정성을 위해 데이터베이스의 백업은 필수적이다. 여기에는 크게 두가지 옵션이 있다.

  1. ORM (sequelize)를 이용한 방법 (migration)
  2. postgreSQL의 내장 tool을 이용한 방법 (pg_dump)

위의 두가지 방법에는 각각의 장단점이 존재한다. 먼저 migration을 이용했을 경우:

  • 별다른 설정과 작업 없이 sequelize-cli만을 이용하여 migration을 생성 (백업) 및 복원할 수 있다.
  • 그러나 sequelize-cli가 JavaScript에 종속적이기 때문에 migration 파일과 본 프로젝트의 소스코드 (TypeScript) 간의 호환에 문제가 존재하고, 따라서 manual한 작업이 수반된다.

다음으로 pg_dump를 이용했을 경우:

  • pg_dump가 특정 프로그래밍 언어에 종속적이지 않다.
  • 그러나 주기적으로 백업을 하거나, 특정 시점으로 복원을 시도할 경우 shell 환경에서의 작업이 수반된다.

본 프로젝트의 성격과 진행상황을 고려할 때, 두번째 방법 (pg_dump)가 더 유효한 방법으로 판단된다. 그 이유는 다음과 같다.

  1. 현재는 Node.js를 기반으로 구성되어 있으나, 추후 다른 프레임워크를 이용할 가능성이 존재한다.
  2. sequelize-cli의 초기 설정을 위해 많은 양의 설정이 필요하다. 그에 반해 pg_dump는 별다른 작업이 필요하지 않다.

pg_dump를 이용할 경우 다음과 같은 잠재적 문제점이 존재한다.

  1. DB model 정의에 변경사항이 존재할 경우, backup이 반드시 필요하다. 이는 현재 sequelizesync({ alter: true}) option을 production 환경에도 이용하고 있기 때문이다.
  2. pg_dump를 주기적으로 실행하는 service가 별도로 필요하다. 이 서비스에 문제가 생길 경우, 운영에 치명적일 수 있다. 따라서 alert system 등 추가적인 개발 비용이 수반될 가능성이 존재한다.
@Byunk Byunk self-assigned this Dec 23, 2023
@Byunk Byunk added the new feature New feature or request label Dec 23, 2023
@Byunk
Copy link
Collaborator Author

Byunk commented Dec 23, 2023

추가로 S3를 mount하여 backup dump를 permanent한 storage에 저장하는 작업이 필요하다. 다음의 옵션이 존재한다.

@Byunk Byunk added the infrastructure This issue is related to infrastructure or deployment label Jan 10, 2024
@Byunk
Copy link
Collaborator Author

Byunk commented Feb 24, 2024

@sjuuun RDS 관련 업데이트 있나요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure This issue is related to infrastructure or deployment new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants