View a markdown version of this page

使用 Neptune-Export API 运行 Neptune-Export 作业 - Amazon Neptune

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 Neptune-Export API 运行 Neptune-Export 作业

CloudFormation 堆栈的 “输出” 选项卡还包括NeptuneExportApiUri。每当向 Neptune-Export 终端节点发送请求时,请使用此 URI。

运行导出任务
  • 请确保运行导出的用户或角色已被授予 execute-api:Invoke 权限。

  • 如果您在安装时在 CloudFormation 堆栈true中将EnableIAM参数设置为 Neptune-Export,则需要对所有向 Neptune-Export API 发出的请求进行Sigv4签名。我们建议使用 awscurl 向 API 发出请求。此处的所有示例都假设已启用 IAM 身份验证。

  • 如果您在安装时在 CloudFormation 堆栈true中将VPCOnly参数设置为 Neptune-Export,则必须从 VPC 内部调用 Neptune-Export API,通常是从位于 VPC 中的 Amazon EC2 实例调用 API。

要开始导出数据,请使用 commandoutputS3Path 请求参数以及 endpoint 导出参数向 NeptuneExportApiUri 端点发送请求。

以下是从 Neptune 导出属性图数据并将其发布到 Amazon S3 的请求示例:

curl \ (your NeptuneExportApiUri) \ -X POST \ -H 'Content-Type: application/json' \ -d '{ "command": "export-pg", "outputS3Path": "s3://(your Amazon S3 bucket)/neptune-export", "params": { "endpoint": "(your Neptune endpoint DNS name)" } }'

同样,以下是将 RDF 数据从 Neptune 导出到 Amazon S3 的请求示例:

curl \ (your NeptuneExportApiUri) \ -X POST \ -H 'Content-Type: application/json' \ -d '{ "command": "export-rdf", "outputS3Path": "s3://(your Amazon S3 bucket)/neptune-export", "params": { "endpoint": "(your Neptune endpoint DNS name)" } }'

如果省略command请求参数,则默认会 Neptune-Export尝试从 Neptune 导出属性图数据。

如果前面的命令成功运行,则输出将如下所示:

{ "jobName": "neptune-export-abc12345-1589808577790", "jobId": "c86258f7-a9c9-4f8c-8f4c-bbfe76d51c8f" }

监控您刚刚启动的导出任务

要监控正在运行的任务,请将其 jobID 附加到您的 NeptuneExportApiUri 之后,如下所示:

curl \ (your NeptuneExportApiUri)/(the job ID)

如果服务尚未启动导出任务,则响应将如下所示:

{ "jobId": "c86258f7-a9c9-4f8c-8f4c-bbfe76d51c8f", "status": "pending" }

当您在导出任务开始后重复该命令时,响应将如下所示:

{ "jobId": "c86258f7-a9c9-4f8c-8f4c-bbfe76d51c8f", "status": "running", "logs": "https://us-east-1.console.aws.amazon.com/cloudwatch/home?..." }

如果您使用状态调用提供的 URI 在 CloudWatch 日志中打开日志,则可以详细监控导出进度:

CloudWatch 日志显示屏的屏幕截图。

取消正在运行的导出任务

要取消正在运行的导出作业,请使用 AWS 管理控制台
  1. 打开 AWS Batch 控制台,网址为https://console.aws.amazon.com/batch/

  2. 选择 Jobs (作业)

  3. 根据要取消的正在运行的任务的 jobID,找到该任务。

  4. 选择取消任务

使用 Neptune 导出 API 取消正在运行的导出任务

向附有 jobIDNeptuneExportApiUri 发送 HTTP DELETE 请求,如下所示:

curl -X DELETE \ (your NeptuneExportApiUri)/(the job ID)