Contentful에서 export/import(백업/복구)
8769 단어 HeadlessCMScontentful
export/import
이 할 기회가 있어서 메모를 합니다.전제 조건
절차.
1. 토큰창설(Personal Access Tokens)
브라우저가 Contentful에 로그인
Giithub 근처 SSO에서 로그인하십시오.
Settings - Api Keys
Content management tokens
Generate personal token
적당한 이름으로 만들다
여기에 "api keys"를 넣어 제작되었습니다.
이 값을 클립보드에 붙여넣고 기록합니다.
2. 프로파일 만들기
Contentful의 Space ID 가져오기
Settings-General settings를 통해 확인 가능
프로파일 생성
$ cat <<EOF > example-config.json
{
"spaceId": "<< 確認したスペースIDを記載 >>",
"managementToken": "<< 1.で取得したトークンを記載 >>",
"contentFile": "contentful-export.json"
}
EOF
확인된 스페이스 바 ID 및 토큰이 생성된 파일입니다.
3. Contentful에 로그인 명령
$ npx contentful-cli login --management-token "1.で取得したトークンを記載"
Great! Your CMA token is now stored on your system. (Located at /Users/hirosue/.contentfulrc.json)
You can always run contentful logout to remove it.
4.export
$ npx contentful-cli space export --config example-config.json
✔ Initialize client (1s)
✔ Fetching data from space
✔ Connecting to space (1s)
✔ Fetching content types data (1s)
✔ Fetching tags data (1s)
✔ Fetching editor interfaces data (1s)
✔ Fetching content entries data (1s)
✔ Fetching assets data (1s)
✔ Fetching locales data (1s)
✔ Fetching webhooks data (1s)
✔ Fetching roles data (1s)
↓ Download assets [skipped]
✔ Write export log file
✔ Lookup directory to store the logs
✔ Create log directory
✔ Writing data to file
┌───────────────────────┐
│ Exported entities │
├───────────────────┬───┤
│ Content Types │ 2 │
├───────────────────┼───┤
│ Tags │ 0 │
├───────────────────┼───┤
│ Editor Interfaces │ 2 │
├───────────────────┼───┤
│ Entries │ 4 │
├───────────────────┼───┤
│ Assets │ 4 │
├───────────────────┼───┤
│ Locales │ 1 │
├───────────────────┼───┤
│ Webhooks │ 1 │
├───────────────────┼───┤
│ Roles │ 1 │
└───────────────────┴───┘
The export took a few seconds (6s)
Stored space data to json file at: /path/to/workspace/tmp/contentful-export.json
No errors or warnings occurred
The export was successful.
✨ Done
5. import
$ npx contentful-cli space import --config example-config.json
┌──────────────────────────────────────────────────┐
│ The following entities are going to be imported: │
├─────────────────────────────────┬────────────────┤
│ Content Types │ 2 │
├─────────────────────────────────┼────────────────┤
│ Tags │ 0 │
├─────────────────────────────────┼────────────────┤
│ Editor Interfaces │ 2 │
├─────────────────────────────────┼────────────────┤
│ Entries │ 4 │
├─────────────────────────────────┼────────────────┤
│ Assets │ 4 │
├─────────────────────────────────┼────────────────┤
│ Locales │ 1 │
├─────────────────────────────────┼────────────────┤
│ Webhooks │ 1 │
└─────────────────────────────────┴────────────────┘
✔ Validating content-file
✔ Initialize client (1s)
✔ Checking if destination space already has any content and retrieving it (2s)
✔ Apply transformations to source data (1s)
✔ Push content to destination space
✔ Connecting to space (1s)
✔ Importing Locales (1s)
✔ Importing Content Types (4s)
✔ Publishing Content Types (2s)
↓ Importing Tags [skipped]
✔ Importing Editor Interfaces (2s)
✔ Importing Assets (26s)
✔ Publishing Assets (3s)
✔ Archiving Assets (1s)
✔ Importing Content Entries (4s)
✔ Publishing Content Entries (3s)
✔ Archiving Entries (0s)
✔ Creating Web Hooks (1s)
Finished importing all data
┌───────────────────────┐
│ Imported entities │
├───────────────────┬───┤
│ Locales │ 1 │
├───────────────────┼───┤
│ Content Types │ 2 │
├───────────────────┼───┤
│ Editor Interfaces │ 2 │
├───────────────────┼───┤
│ Assets │ 4 │
├───────────────────┼───┤
│ Published Assets │ 4 │
├───────────────────┼───┤
│ Archived Assets │ 0 │
├───────────────────┼───┤
│ Entries │ 4 │
├───────────────────┼───┤
│ Published Entries │ 4 │
├───────────────────┼───┤
│ Archived Entries │ 0 │
├───────────────────┼───┤
│ Webhooks │ 1 │
└───────────────────┴───┘
The import took a few seconds (42s)
The following 0 errors and 1 warnings occurred:
15:50:99 - Rate limit error occurred. Waiting for 1561 ms before retrying...
The import was successful.
사후 처리(로그오프)
$ npx contentful-cli logout
This will log you out by deleting the CMA token stored on your system.
? Do you want to log out now? Yes
Successfully logged you out.
기타
무료 계좌라면 Rate limit
자주 걸립니다.
참조 링크
Contentful의 Space ID 가져오기
Settings-General settings를 통해 확인 가능
프로파일 생성
$ cat <<EOF > example-config.json
{
"spaceId": "<< 確認したスペースIDを記載 >>",
"managementToken": "<< 1.で取得したトークンを記載 >>",
"contentFile": "contentful-export.json"
}
EOF
확인된 스페이스 바 ID 및 토큰이 생성된 파일입니다.3. Contentful에 로그인 명령
$ npx contentful-cli login --management-token "1.で取得したトークンを記載"
Great! Your CMA token is now stored on your system. (Located at /Users/hirosue/.contentfulrc.json)
You can always run contentful logout to remove it.
4.export
$ npx contentful-cli space export --config example-config.json
✔ Initialize client (1s)
✔ Fetching data from space
✔ Connecting to space (1s)
✔ Fetching content types data (1s)
✔ Fetching tags data (1s)
✔ Fetching editor interfaces data (1s)
✔ Fetching content entries data (1s)
✔ Fetching assets data (1s)
✔ Fetching locales data (1s)
✔ Fetching webhooks data (1s)
✔ Fetching roles data (1s)
↓ Download assets [skipped]
✔ Write export log file
✔ Lookup directory to store the logs
✔ Create log directory
✔ Writing data to file
┌───────────────────────┐
│ Exported entities │
├───────────────────┬───┤
│ Content Types │ 2 │
├───────────────────┼───┤
│ Tags │ 0 │
├───────────────────┼───┤
│ Editor Interfaces │ 2 │
├───────────────────┼───┤
│ Entries │ 4 │
├───────────────────┼───┤
│ Assets │ 4 │
├───────────────────┼───┤
│ Locales │ 1 │
├───────────────────┼───┤
│ Webhooks │ 1 │
├───────────────────┼───┤
│ Roles │ 1 │
└───────────────────┴───┘
The export took a few seconds (6s)
Stored space data to json file at: /path/to/workspace/tmp/contentful-export.json
No errors or warnings occurred
The export was successful.
✨ Done
5. import
$ npx contentful-cli space import --config example-config.json
┌──────────────────────────────────────────────────┐
│ The following entities are going to be imported: │
├─────────────────────────────────┬────────────────┤
│ Content Types │ 2 │
├─────────────────────────────────┼────────────────┤
│ Tags │ 0 │
├─────────────────────────────────┼────────────────┤
│ Editor Interfaces │ 2 │
├─────────────────────────────────┼────────────────┤
│ Entries │ 4 │
├─────────────────────────────────┼────────────────┤
│ Assets │ 4 │
├─────────────────────────────────┼────────────────┤
│ Locales │ 1 │
├─────────────────────────────────┼────────────────┤
│ Webhooks │ 1 │
└─────────────────────────────────┴────────────────┘
✔ Validating content-file
✔ Initialize client (1s)
✔ Checking if destination space already has any content and retrieving it (2s)
✔ Apply transformations to source data (1s)
✔ Push content to destination space
✔ Connecting to space (1s)
✔ Importing Locales (1s)
✔ Importing Content Types (4s)
✔ Publishing Content Types (2s)
↓ Importing Tags [skipped]
✔ Importing Editor Interfaces (2s)
✔ Importing Assets (26s)
✔ Publishing Assets (3s)
✔ Archiving Assets (1s)
✔ Importing Content Entries (4s)
✔ Publishing Content Entries (3s)
✔ Archiving Entries (0s)
✔ Creating Web Hooks (1s)
Finished importing all data
┌───────────────────────┐
│ Imported entities │
├───────────────────┬───┤
│ Locales │ 1 │
├───────────────────┼───┤
│ Content Types │ 2 │
├───────────────────┼───┤
│ Editor Interfaces │ 2 │
├───────────────────┼───┤
│ Assets │ 4 │
├───────────────────┼───┤
│ Published Assets │ 4 │
├───────────────────┼───┤
│ Archived Assets │ 0 │
├───────────────────┼───┤
│ Entries │ 4 │
├───────────────────┼───┤
│ Published Entries │ 4 │
├───────────────────┼───┤
│ Archived Entries │ 0 │
├───────────────────┼───┤
│ Webhooks │ 1 │
└───────────────────┴───┘
The import took a few seconds (42s)
The following 0 errors and 1 warnings occurred:
15:50:99 - Rate limit error occurred. Waiting for 1561 ms before retrying...
The import was successful.
사후 처리(로그오프)
$ npx contentful-cli logout
This will log you out by deleting the CMA token stored on your system.
? Do you want to log out now? Yes
Successfully logged you out.
기타
무료 계좌라면
Rate limit
자주 걸립니다.참조 링크
Reference
이 문제에 관하여(Contentful에서 export/import(백업/복구)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/takeshi_hirosue/items/f4539a87a9e2aab382ac텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)