AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

보관 스냅샷을 Atlas로 가져오기

중요

이 페이지에 설명된 기능 현재 공개 미리 보기 중에 Atlas Infinite 클러스터에서 지원되지 않습니다. 공개 미리 보기에서 지원되는 기능은 공개 미리 보기 가용성을 참조하세요.

참고

이 기능 M10 클러스터 이상에서 사용할 수 있습니다. 무료 클러스터에 사용할 수 있는 기능에 대한 자세한 학습 은 Atlas 무료 클러스터 제한 사항을 참조하고, Flex 클러스터의 경우 Atlas Flex 제한 사항을 참조하세요.

mongoimport 및 mongorestore를 사용하여 S3, Azure 또는 Google Cloud Storage에 보관된 데이터를 복원 할 수 있습니다. 이 페이지에서는 데이터 소스 에 따라 AWS, azopy 또는 gcloud CLI 및 MongoDB 데이터베이스 도구 사용하여 보관된 데이터를 가져오고 인덱스를 다시 작성하는 샘플 절차를 설명합니다.

이미 가져온 클라우드 백업 스냅샷을 가져오기 전에 클라우드 객체 저장소 버킷으로 내보내는 방법을 알아보려면 클라우드 백업 스냅샷을 객체 저장소로 내보내기를 참조하십시오.

시작하기 전에 반드시 해야 할 것은 다음과 같습니다.

1
aws s3 cp s3://<bucketName>/<prefix> <downloadFolder> --recursive
gunzip -r <downloadFolder>

where:

<bucketName>

AWS S3 버킷의 이름입니다.

<prefix>

버킷에 보관된 데이터의 경로. 경로의 형식은 다음과 같습니다.

/exported_snapshots/<orgId>/<projectId>/<clusterName>/<initiationDateOfSnapshot>/<timestamp>/

<downloadFolder>

보관된 데이터를 복사하려는 로컬 폴더의 경로.

예를 들어 다음과 유사한 명령을 실행합니다.

예시

aws s3 cp
s3://export-test-bucket/exported_snapshots/1ab2cdef3a5e5a6c3bd12de4/12ab3456c7d89d786feba4e7/myCluster/2021-04-24T0013/1619224539
mybucket --recursive
gunzip -r mybucket
2
#!/bin/bash
regex='/(.+)/(.+)/.+'
dir=${1%/}
connstr=$2
# iterate through the subdirectories of the downloaded and
# extracted snapshot export and restore the docs with mongoimport
find $dir -type f -not -path '*/\.*' -not -path '*metadata\.json' | while read line ; do
[[ $line =~ $regex ]]
db_name=${BASH_REMATCH[1]}
col_name=${BASH_REMATCH[2]}
mongoimport --uri "$connstr" --mode=upsert -d $db_name -c $col_name --file $line --type json
done
# create the required directory structure and copy/rename files
# as needed for mongorestore to rebuild indexes on the collections
# from exported snapshot metadata files and feed them to mongorestore
find $dir -type f -name '*metadata\.json' | while read line ; do
[[ $line =~ $regex ]]
db_name=${BASH_REMATCH[1]}
col_name=${BASH_REMATCH[2]}
mkdir -p ${dir}/metadata/${db_name}/
cp $line ${dir}/metadata/${db_name}/${col_name}.metadata.json
done
mongorestore "$connstr" ${dir}/metadata/
# remove the metadata directory because we do not need it anymore and this returns
# the snapshot directory in an identical state as it was prior to the import
rm -rf ${dir}/metadata/

여기:

  • --mode=upsert mongoimport가 아카이브에서 중복 문서를 처리하다 할 수 있도록 합니다.

  • --uri Atlas 클러스터에 대한 연결 문자열을 지정합니다.

3
sh massimport.sh <downloadFolder> "mongodb+srv://<connectionString>"

where:

<downloadFolder>

보관된 데이터를 복사한 로컬 폴더의 경로입니다.

<connectionString>

Atlas 클러스터의 연결 문자열.

예를 들어 다음과 유사한 명령을 실행합니다.

예시

sh massimport.sh mybucket "mongodb+srv://<myConnString>"
이 페이지 평가하기

이 페이지의 내용