Dynamodb 简明教程
DynamoDB - Data Backup
利用Data Pipeline的导入/导出功能执行备份。您执行备份的方式取决于您使用的是GUI控制台还是直接使用Data Pipeline(API)。使用控制台时,为每个表创建单独的管道,或者在使用直接选项时,在一个管道中导入/导出多个表。
Utilize Data Pipeline’s import/export functionality to perform backups. How you execute a backup depends on whether you use the GUI console, or use Data Pipeline directly (API). Either create separate pipelines for each table when using the console, or import/export multiple tables in a single pipeline if using a direct option.
Exporting and Importing Data
在执行导出操作之前,必须创建一个Amazon S3存储桶。您可以从一个或多个表导出数据。
You must create an Amazon S3 bucket prior to performing an export. You can export from one or more tables.
执行以下四个步骤来执行导出 -
Perform the following four step process to execute an export −
Step 1 - 登录 AWS 管理控制台,然后打开位于 https://console.aws.amazon.com/datapipeline/ 的数据管道控制台。
Step 1 − Log in to the AWS Management Console and open the Data Pipeline console located at https://console.aws.amazon.com/datapipeline/
Step 2 - 如果在所用 AWS 区域中没有管道,请选 Get started now 。如果有,请选 Create new pipeline 。
Step 2 − If you have no pipelines in the AWS region used, select Get started now. If you have one or more, select Create new pipeline.
Step 3 - 在创建页面上,为你的管道输入一个名称。为源参数选 Build using a template 。从列表中选 Export DynamoDB table to S3 。在 Source DynamoDB table name 字段中输入源表。
Step 3 − On the creation page, enter a name for your pipeline. Choose Build using a template for the Source parameter. Select Export DynamoDB table to S3 from the list. Enter the source table in the Source DynamoDB table name field.
在 Output S3 Folder 文本框中以以下格式输入目标 S3 存储桶:s3://nameOfBucket/region/nameOfFolder。在 S3 location for logs 文本框中为日志文件输入一个 S3 目标。
Enter the destination S3 bucket in the Output S3 Folder text box using the following format: s3://nameOfBucket/region/nameOfFolder. Enter an S3 destination for the log file in S3 location for logs text box.
Step 4 - 在输入所有设置后,选 Activate 。
Step 4 − Select Activate after entering all settings.
管道完成其创建过程可能需要几分钟时间。使用控制台监控其状态。通过查看导出文件,使用 S3 控制台确认处理成功。
The pipeline may take several minutes to finish its creation process. Use the console to monitor its status. Confirm successful processing with the S3 console by viewing the exported file.
Importing Data
只有在满足以下条件时,才能成功导入:你创建了一个目标表,目标和源使用相同的名称,并且目标和源使用相同的键架构。
Successful imports can only happen if the following conditions are true: you created a destination table, the destination and source use identical names, and the destination and source use identical key schema.
你可以使用一个已填充的目标表,但是,导入会替换与源项目共享键的数据项目,并且还会将附加项目添加到表中。该目标还可以使用不同的区域。
You can use a populated destination table, however, imports replace data items sharing a key with source items, and also add excess items to the table. The destination can also use a different region.
尽管你可以导出多个源,但每次操作只能导入一个。你可以按照以下步骤执行导入操作 −
Though you can export multiple sources, you can only import one per operation. You can perform an import by adhering to the following steps −
Step 1 - 登录 AWS 管理控制台,然后打开数据管道控制台。
Step 1 − Log in to the AWS Management Console, and then open the Data Pipeline console.
Step 2 - 如果打算执行跨区域导入,则应选择目标区域。
Step 2 − If you are intending to execute a cross region import, then you should select the destination region.
Step 3 - 选择 Create new pipeline 。
Step 3 − Select Create new pipeline.
Step 4 - 在 Name 字段中输入管道名称,为源参数选择 Build using a template ,并在模板列表中选择 Import DynamoDB backup data from S3 。
Step 4 − Enter the pipeline name in the Name field. Choose Build using a template for the Source parameter, and in the template list, select Import DynamoDB backup data from S3.
在 Input S3 Folder 文本框中输入源文件的位置。在 Target DynamoDB table name 字段中输入目标表名。然后在 S3 location for logs 文本框中输入日志文件的位置。
Enter the location of the source file in the Input S3 Folder text box. Enter the destination table name in the Target DynamoDB table name field. Then enter the location for the log file in the S3 location for logs text box.
Step 5 - 在输入所有设置后,选 Activate 。
Step 5 − Select Activate after entering all settings.
在创建管道后,导入会立即开始。管道完成创建过程可能需要几分钟时间。
The import starts immediately after the pipeline creation. It may take several minutes for the pipeline to complete the creation process.
Errors
当出现错误时,数据管道控制台会显示 ERROR 作为管道状态。点击出错的管道会转到其详细信息页面,该页面显示该过程的每一步以及失败发生的位置。其中的日志文件也会提供一些见解。
When errors occur, the Data Pipeline console displays ERROR as the pipeline status. Clicking the pipeline with an error takes you to its detail page, which reveals every step of the process and the point at which the failure occurred. Log files within also provide some insight.
你可以按如下方式查看常见错误原因 −
You can review the common causes of the errors as follows −
-
The destination table for an import does not exist, or does not use identical key schema to the source.
-
The S3 bucket does not exist, or you do not have read/write permissions for it.
-
The pipeline timed out.
-
You do not have the necessary export/import permissions.
-
Your AWS account reached its resource limit.