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

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

참고

이 기능 무료 클러스터 및 Flex 클러스터에서는 사용할 수 없습니다. 사용할 수 없는 기능에 대해 자세히 학습하려면 Atlas 무료 클러스터 제한을 참조하세요.

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

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

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

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=upsertmongoimport 아카이브에서 중복 문서를 처리하다 수 있도록 합니다.

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

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

where:

<downloadFolder>

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

<connectionString>

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

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

예시

sh massimport.sh mybucket "mongodb+srv://<myConnString>"
1
azcopy copy "https://<storageAccountName>.blob.core.windows.net/<containerName>/<prefix>/*" "<downloadFolder>" --recursive

where:

<storageAccountName>

블롭 저장 컨테이너 속한 Azure 계정의 이름입니다.

<containerName>

Azure Blob 저장 컨테이너의 이름입니다.

<prefix>

버킷에 보관된 데이터의 경로.

<downloadFolder>

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

예시

azcopy copy "https://mystorageaccount.blob.core.windows.net/mycontainer/myTextFile.txt" "~/downloads" --recursive
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=upsertmongoimport 아카이브에서 중복 문서를 처리하다 수 있도록 합니다.

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

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

where:

<downloadFolder>

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

<connectionString>

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

예시

sh massimport.sh "~/downloads" "mongodb+srv://<myConnString>"
1
gsutil -m cp -r "gs://<bucketName>/<prefix> <downloadFolder>" --recursive
gunzip -r <downloadFolder>

where:

<bucketName>

Google Cloud Platform 버킷의 이름입니다.

<prefix>

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

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

<downloadFolder>

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

예시

gsutil -m cp -r
gs://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=upsertmongoimport 아카이브에서 중복 문서를 처리하다 수 있도록 합니다.

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

3

massimport.sh 유틸리티를 실행하여 보관된 데이터를 Atlas 클러스터로 가져옵니다.

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

where:

<downloadFolder>

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

<connectionString>

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

예시

sh massimport.sh mybucket "mongodb+srv://<myConnString>"

이 페이지의 내용