本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
您可以使用以下步驟,來使用 neptune-export
命令列公用程式,將資料從 Neptune 資料庫叢集匯出至 Amazon S3:
使用 neptune-export
命令列公用程式的先決條件
開始之前
具有第 8 版 JDK – 您需要安裝 Java SE 開發套件 (JDK)
第 8 版。 下載 neptune-export 公用程式 – 下載並安裝 neptune-export.jar
檔案。 -
確定
neptune-export
可以存取 Neptune VPC – 從其可存取 VPC (Neptune 資料庫叢集所在) 的位置執行 neptune-export。例如,您可以在 Neptune VPC 內的 Amazon EC2 執行個體上執行它,或在與 Neptune VPC 對等互連的個別 VPC 中執行,或在個別的堡壘主機上執行。
-
確定 VPC 安全群組授與
neptune-export
的存取權 – 檢查附加至 Neptune VPC 的 VPC 安全群組是否允許從與neptune-export
環境相關聯的 IP 地址或安全群組存取您的資料庫叢集。 -
設定必要的 IAM 許可 – 如果您的資料庫已啟用 AWS Identity and Access Management (IAM) 資料庫身分驗證,請確定
neptune-export
執行 的角色與允許連線至 Neptune 的 IAM 政策相關聯。如需 Neptune 政策的相關資訊,請參閱 使用 IAM 政策。如果您想要在查詢請求中使用
clusterId
匯出參數,neptune-export
執行所在的角色需要下列 IAM 許可:rds:DescribeDBClusters
rds:DescribeDBInstances
rds:ListTagsForResource
如果想要從複製的叢集匯出,
neptune-export
執行所在的角色需要下列 IAM 許可:rds:AddTagsToResource
rds:DescribeDBClusters
rds:DescribeDBInstances
rds:ListTagsForResource
rds:DescribeDBClusterParameters
rds:DescribeDBParameters
rds:ModifyDBParameterGroup
rds:ModifyDBClusterParameterGroup
rds:RestoreDBClusterToPointInTime
rds:DeleteDBInstance
rds:DeleteDBClusterParameterGroup
rds:DeleteDBParameterGroup
rds:DeleteDBCluster
rds:CreateDBInstance
rds:CreateDBClusterParameterGroup
rds:CreateDBParameterGroup
若要將匯出的資料發佈到 Amazon S3,
neptune-export
執行所在的角色需要 Amazon S3 位置的下列 IAM 許可:s3:PutObject
s3:PutObjectTagging
s3:GetObject
-
設定
SERVICE_REGION
環境變數 – 設定SERVICE_REGION
環境變數以識別資料庫叢集所在的區域 (如需區域識別符清單,請參閱連線至 Neptune)。
執行 neptune-export
公用程式以啟動匯出操作
使用下列命令從命令行執行 neptune-export 並啟動匯出操作:
java -jar neptune-export.jar nesvc \ --root-path
(path to a local directory)
\ --json(the JSON file that defines the export)
此命令有兩個參數:
開始匯出時 neptune-export 的參數
--root-path
– 本機目錄的路徑,其中匯出檔案在發佈到 Amazon S3 之前會寫入該目錄。--json
– 定義匯出的 JSON 物件。
使用 neptune-export
命令列公用程式的範例命令
若要直接從來源資料庫叢集匯出屬性圖資料:
java -jar neptune-export.jar nesvc \
--root-path /home/ec2-user/neptune-export \
--json '{
"command": "export-pg",
"outputS3Path" : "s3://(your Amazon S3 bucket)
/neptune-export",
"params": {
"endpoint" : "(your neptune DB cluster endpoint)
"
}
}'
若要直接從來源資料庫叢集匯出 RDF 資料:
java -jar neptune-export.jar nesvc \
--root-path /home/ec2-user/neptune-export \
--json '{
"command": "export-rdf",
"outputS3Path" : "s3://(your Amazon S3 bucket)
/neptune-export",
"params": {
"endpoint" : "(your neptune DB cluster endpoint)
"
}
}'
如果您省略了 command
請求參數,根據預設,neptune-export
公用程式會嘗試從 Neptune 匯出屬性圖資料。
若要從您複製的資料庫叢集匯出:
java -jar neptune-export.jar nesvc \
--root-path /home/ec2-user/neptune-export \
--json '{
"command": "export-pg",
"outputS3Path" : "s3://(your Amazon S3 bucket)/neptune-export",
"params": {
"endpoint" : "(your neptune DB cluster endpoint)",
"cloneCluster" : true
}
}'
若要使用 IAM 身分驗證從資料庫叢集匯出:
java -jar neptune-export.jar nesvc \
--root-path /home/ec2-user/neptune-export \
--json '{
"command": "export-pg",
"outputS3Path" : "s3://(your Amazon S3 bucket)
/neptune-export",
"params": {
"endpoint" : "(your neptune DB cluster endpoint)
"
"useIamAuth" : true
}
}'