本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 Neptune-Export API 執行 Neptune-Export 工作
CloudFormation 堆疊的輸出索引標籤也包含 NeptuneExportApiUri。每當您將請求傳送到 Neptune-Export 端點時,請使用此 URI。
執行匯出工作
請確定匯出執行所在的使用者或角色已獲授與
execute-api:Invoke許可。如果在安裝 Neptune-Export 時,於 CloudFormation 堆疊中將
EnableIAM參數設為true,則您需要以Sigv4簽署對 Neptune-Export API 的所有請求。我們建議您使用 awscurl向 API 提出請求。這裡的所有範例都假設 IAM 身分驗證已啟用。 如果在安裝 Neptune-Export 時,於 CloudFormation 堆疊中將
VPCOnly參數設為true,則必須從 VPC 內呼叫 Neptune-Export API,通常從位於 VPC 的 Amazon EC2 執行個體進行此呼叫。
若要開始匯出資料,請使用 command 和 outputS3Path 請求參數以及 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 Logs 中的日誌,則接著可以詳細監控匯出的進度:
取消執行中的匯出工作
使用 取消執行中的匯出任務 AWS 管理主控台
在 https://https://console.aws.amazon.com/batch/
開啟 AWS Batch 主控台。 選擇 Jobs (任務)。
根據
jobID找出您要取消的執行中工作。選取取消工作。
若要使用 Neptune 匯出 API 取消執行中的匯出工作:
將 HTTP DELETE 請求傳送到附加 jobID 的 NeptuneExportApiUri,如下所示:
curl -X DELETE \(your NeptuneExportApiUri)/(the job ID)