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

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

중요

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

참고

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

S3, Azure 또는 Google Cloud Platform 저장에 보관된 데이터를 mongoimport와 mongorestore을 사용하여 복원할 수 있습니다. 이 페이지에는 데이터 소스에 따라 Amazon Web Services, azopy 또는 gcloud CLI와 MongoDB Database Tools를 사용하여 보관된 데이터를 가져오고 인덱스를 다시 생성하는 샘플 절차가 있습니다.

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

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

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

where:

<bucketName>

AWS S3 버킷의 이름입니다.

<prefix>

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

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

<downloadFolder>

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

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

예시

aws s3 cps3://export-test-bucket/exported_snapshots/1ab2cdef3a5e5a6c3bd12de4/12ab3456c7d89d786feba4e7/myCluster/2021-04-24T0013/1619224539mybucket --recursivegunzip -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 mongoimportfind $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 jsondone # 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 mongorestorefind $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.jsondonemongorestore "$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 importrm -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>"
이 페이지 평가하기

이 페이지의 내용