Import data from OSS to GDB
After you upload test data to Object Storage Service (OSS), you can import it into Graph Database (GDB). This tutorial shows how to run a curl command on an Elastic Compute Service (ECS) instance to import the test data from OSS into GDB.
Prerequisites
- You have configured the whitelist and uploaded test data to OSS. For more information, see Set a whitelist and Upload data to OSS.
- You have created a Linux ECS instance. For more information, see Create a custom instance.
This tutorial imports data into Graph Database over a private network. Ensure that the ECS and Graph Database instances are in the same VPC.
Procedure
- Connect to the ECS instance. For more information, see Connect to an instance using VNC.
- Run the
curlcommand to import the node and edge files.The following is an example of an import statement for a point file:
curl -u <user>:<password> -X POST \ -H 'Content-Type: application/json' \ http://gds-*****.graphdb.rds.aliyuncs.com:8182/loader -d ' { "source" : "oss://<bucketname>/air-routes-latest-nodes.csv", "ramRoleArn" : "acs:ram::1***************:role/aliyunserviceroleforgdb" }'The following is a sample statement to import the edge file:
curl -u <user>:<password> -X POST \ -H 'Content-Type: application/json' \ http://gds-*****.graphdb.rds.aliyuncs.com:8182/loader -d ' { "source" : "oss://<bucketname>t/air-routes-latest-edges.csv", "ramRoleArn" : "acs:ram::1***************:role/aliyunserviceroleforgdb" }'The following table describes the parameters.
Parameter Description Example <user>:<password>The username and password for the Graph Database instance. For more information, see Create an account.
gdb_user:PassWordgds-*****.graphdb.rds.aliyuncs.com:8182The endpoint and port number of the Graph Database instance. To obtain them:
- Log on to the Graph Database console.
- Click the instance ID to go to the Basic Information page.
- In the Basic Information section, find the endpoint and port.
gds-*****.graphdb.rds.aliyuncs.com:8182oss://<bucketname>/air-routes-latest-edges.csvThe endpoint of the file in the OSS bucket. It consists of three parts:
oss://,the bucket name and file path, andthe file name.oss://bucketname/air-routes-latest-edges.csvacs:ram::1***************:role/aliyunserviceroleforgdbThe Alibaba Cloud Resource Name (ARN) of the service-linked role. To obtain the ARN, see Grant GDB permissions to access OSS.
acs:ram::1***************:role/aliyunserviceroleforgdbAfter the parameters are verified, the Graph Database import program returns the import task ID loadId. The following is an example:
{ "status" : "200 OK", "payload" : { "loadId" : "552617AF-4F1E-4CD8-9533-************" } }