• Home
  • About
    • lahuman photo

      lahuman

      열심히 사는 아저씨

    • Learn More
    • Facebook
    • LinkedIn
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

MongoDB backup & restore

23 Feb 2019

Reading time ~1 minute

MongoDB backup & restore

간단하게 몽고 디비 백업과 복구를 해보겠다.

먼저 백업 명령은 다음과 같다

# 결과로 디렉터리가 생성 된다.
# 특정 collection 명이나 DB 명을 Backup 할 수 있다.
$> mongodump --collection words --db TEST --out ./

다음은 복원 하는 방법이다.

# 특정 컬렉션만 복원 할 수 있으며 --drop  옵션을 추가 하면 삭제하고 복원 한다.
$> mongorestore --host 172.30.10.1 --port 27017 --db TEST --collection words --username tester --password 'password'  ./TEST/words.bson --drop

가끔씩 쓸일이 생긴다.



mongodbtip Share Tweet +1