반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
Tags
- FCM
- NextJS
- PM2
- nodejs
- Tomcat
- security
- docker
- SpringBoot
- rocky9
- MariaDB
- mybatis
- pwa
- config
- Maven
- jenkins
- jquery
- Eclipse
- centos7
- MSsql
- Push
- Next.js
- spring3
- javascript
- popup
- ajax
- git
- Java
- yona
- mysql
- node.js
Archives
- Today
- Total
종이 한장 차이...
docker+mongodb+mongodump+mongorestore 본문
728x90
반응형
SMALL
#환경.
- docker-desktop (windows)
- mongodb
# 먼저 백업데이터가 저장될 DB서버에서 아래와 같이 원격의 DB를 백업하자.
mongodump --host xxx.xxx.xxx.xxx --port 27017 -d testDB --username testuser --password testuser123 --out /opt/backup/mongodump
위 명령어를 실행하면 host에 명시한 ip의 DB에서 testuser계정으로 접속하여 testDB란 DB를 명령어를 실행하는 서버의 /opt/backup/mongodump경로에 testDB가 백업된다.
반응형
728x90
SMALL
# 백업한 DB를 복구시킬 때는 아래와 같이 restore 할 수 있다.
백업한 데이터가 백업용 mongoDB서버에 백업되면 testDB명 그대로 DB 가 생성 된다.
# mongorestore --username root --password 1234 /opt/backup/mongodump/
# 복구시킬 DB가 이미 존재할 경우 중복된 데이터는 error로깅이 표시되지만 중복되지 않은 신규 데이터들은 정상적으로 restore
되니 아래와 비슷한 로그가 보여도 신경 쓰지 말고 기다리면 신규데이터가 restore 되는 로그가 올라온다.
2025-05-07T02:01:54.502+0000 continuing through error: E11000 duplicate key error collection: testDB.testDB index: _id_ dup key: { _id: ObjectId('XXXXXXXXXXXXXXXXXXXXXXXX') }
2025-05-07T02:01:54.502+0000 continuing through error: E11000 duplicate key error collection: testDB.testDB index: _id_ dup key: { _id: ObjectId('XXXXXXXXXXXXXXXXXXXXXXXX') }
2025-05-07T02:01:56.932+0000 [################........] testDB.testDB 2.24GB/3.31GB (67.6%)
2025-05-07T02:01:59.933+0000 [################........] testDB.testDB 2.34GB/3.31GB (70.7%)
2025-05-07T02:02:02.933+0000 [#################.......] testDB.testDB 2.44GB/3.31GB (73.8%)
2025-05-07T02:02:05.930+0000 [##################......] testDB.testDB 2.55GB/3.31GB (77.1%)
2
참고자료:
https://www.mongodb.com/ko-kr/docs/database-tools/mongodump/
mongodump - MongoDB Database Tools
--sslAllowInvalidCertificates 옵션은 사용할 수 있는 경우에도 가급적 사용하지 않는 것이 좋습니다. --sslAllowInvalidCertificates를 사용해야만 하는 경우, 침입이 불가능한 시스템에서만 옵션을 사용하세요
www.mongodb.com
728x90
반응형
LIST
'docker' 카테고리의 다른 글
docker-desktop + mongodb compose (0) | 2025.01.06 |
---|---|
Create docker image and container by Dockerfile exampl (rock9(linux)+jdk8+tomcat8.5+spring3-web) (2) | 2024.07.30 |
Dockerfile build by Node.js Simple Project (0) | 2024.07.24 |
centos7+docker+MSSQL setup & config Ing~ (0) | 2022.09.08 |
centos7+docker+linux+mariadb setup&config (4) | 2022.08.25 |
Comments