Skip to content

Version 1.7 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.

Graphspace API

2.0 Graphspace

HugeGraph implements multi-tenancy through graph spaces, which isolate compute/storage resources per tenant.

Prerequisites

  1. Graphspace currently only works in HStore mode.
  2. In non-HStore mode you can only use the default graphspace DEFAULT; creating/deleting/updating other graphspaces is not supported.
  3. Set usePD=true in rest-server.properties and backend=hstore in hugegraph.properties.
  4. Graphspace enables strict authentication by default (default credential: admin:pa). Change the password immediately to avoid unauthorized access.

2.0.1 Create a graphspace

Method & Url
1POST http://localhost:8080/graphspaces
Request Body

Note: CPU/memory and Kubernetes-related capabilities are not publicly available yet.

NameRequiredTypeDefaultRange/NoteDescription
nameYesStringLowercase letters, digits, underscore; must start with a letter; max length 48Graphspace name
descriptionYesStringDescription
cpu_limitYesInt> 0CPU cores for the graphspace
memory_limitYesInt> 0 (GB)Memory quota in GB
storage_limitYesInt> 0Maximum disk usage
compute_cpu_limitNoInt0>= 0Extra HugeGraph-Computer CPU cores; falls back to cpu_limit if unset or 0
compute_memory_limitNoInt0>= 0Extra HugeGraph-Computer memory in GB; falls back to memory_limit if unset or 0
oltp_namespaceYesStringKubernetes namespace for OLTP HugeGraph-Server
olap_namespaceYesStringResources are merged when identical to oltp_namespaceKubernetes namespace for OLAP / HugeGraph-Computer
storage_namespaceYesStringKubernetes namespace for HugeGraph-Store
operator_image_pathNoStringHugeGraph-Computer operator image registry
internal_algorithm_image_urlNoStringHugeGraph-Computer algorithm image registry
max_graph_numberYesInt> 0Maximum number of graphs that can be created inside the graphspace
max_role_numberYesInt> 0Maximum number of roles that can be created inside the graphspace
authNoBooleanfalsetrue / falseWhether to enable authentication for the graphspace
configsNoMapAdditional configuration
 1{
 2  "name": "gs1",
 3  "description": "1st graph space",
 4  "max_graph_number": 100,
 5  "cpu_limit": 1000,
 6  "memory_limit": 8192,
 7  "storage_limit": 1000000,
 8  "max_role_number": 10,
 9  "auth": true,
10  "configs": {}
11}
Response Status
1201
Response Body
 1{
 2  "name": "gs1",
 3  "description": "1st graph space",
 4  "cpu_limit": 1000,
 5  "memory_limit": 8192,
 6  "storage_limit": 1000000,
 7  "compute_cpu_limit": 0,
 8  "compute_memory_limit": 0,
 9  "oltp_namespace": "hugegraph-server",
10  "olap_namespace": "hugegraph-server",
11  "storage_namespace": "hugegraph-server",
12  "operator_image_path": "127.0.0.1/hugegraph-registry/hugegraph-computer-operator:3.1.1",
13  "internal_algorithm_image_url": "127.0.0.1/hugegraph-registry/hugegraph-computer-algorithm:3.1.1",
14  "max_graph_number": 100,
15  "max_role_number": 10,
16  "cpu_used": 0,
17  "memory_used": 0,
18  "storage_used": 0,
19  "graph_number_used": 0,
20  "role_number_used": 0,
21  "auth": true
22}

2.0.2 List all graphspaces

Method & Url
1GET http://localhost:8080/graphspaces
Response Status
1200
Response Body
1{
2  "graphSpaces": [
3    "gs1",
4    "DEFAULT"
5  ]
6}

2.0.3 Get graphspace details

Params

Path parameters

  • graphspace: Graphspace name
Method & Url
1GET http://localhost:8080/graphspaces/gs1
Response Status
1200
Response Body
 1{
 2  "name": "gs1",
 3  "description": "1st graph space",
 4  "cpu_limit": 1000,
 5  "memory_limit": 8192,
 6  "storage_limit": 1000000,
 7  "oltp_namespace": "hugegraph-server",
 8  "olap_namespace": "hugegraph-server",
 9  "storage_namespace": "hugegraph-server",
10  "operator_image_path": "127.0.0.1/hugegraph-registry/hugegraph-computer-operator:3.1.1",
11  "internal_algorithm_image_url": "127.0.0.1/hugegraph-registry/hugegraph-computer-algorithm:3.1.1",
12  "compute_cpu_limit": 0,
13  "compute_memory_limit": 0,
14  "max_graph_number": 100,
15  "max_role_number": 10,
16  "cpu_used": 0,
17  "memory_used": 0,
18  "storage_used": 0,
19  "graph_number_used": 0,
20  "role_number_used": 0,
21  "auth": true
22}

2.0.4 Update a graphspace

auth cannot be changed once a graphspace is created.

Params

Path parameter

  • graphspace: Graphspace name

Request parameters

  • action: Must be "update"
  • update: Container for the actual fields to update (see table below)
NameRequiredTypeRange/NoteDescription
nameYesStringGraphspace name
descriptionYesStringDescription
cpu_limitYesInt> 0CPU cores for OLTP HugeGraph-Server
memory_limitYesInt> 0 (GB)Memory quota (GB) for OLTP HugeGraph-Server
storage_limitYesInt> 0Maximum disk usage
compute_cpu_limitNoInt>= 0Extra HugeGraph-Computer CPU cores; falls back to cpu_limit if unset or 0
compute_memory_limitNoInt>= 0Extra HugeGraph-Computer memory in GB; falls back to memory_limit if unset or 0
oltp_namespaceYesStringKubernetes namespace for OLTP HugeGraph-Server
olap_namespaceYesStringResources are merged when identical to oltp_namespaceKubernetes namespace for OLAP
storage_namespaceYesStringKubernetes namespace for HugeGraph-Store
operator_image_pathNoStringHugeGraph-Computer operator image registry
internal_algorithm_image_urlNoStringHugeGraph-Computer algorithm image registry
max_graph_numberYesInt> 0Maximum number of graphs
max_role_numberYesInt> 0Maximum number of roles
Method & Url
1PUT http://localhost:8080/graphspaces/gs1
Request Body
 1{
 2  "action": "update",
 3  "update": {
 4    "name": "gs1",
 5    "description": "1st graph space",
 6    "cpu_limit": 2000,
 7    "memory_limit": 40960,
 8    "storage_limit": 2048,
 9    "oltp_namespace": "hugegraph-server",
10    "olap_namespace": "hugegraph-server",
11    "operator_image_path": "127.0.0.1/hugegraph-registry/hugegraph-computer-operator:3.1.1",
12    "internal_algorithm_image_url": "127.0.0.1/hugegraph-registry/hugegraph-computer-algorithm:3.1.1",
13    "max_graph_number": 1000,
14    "max_role_number": 100
15  }
16}
Response Status
1200
Response Body
 1{
 2  "name": "gs1",
 3  "description": "1st graph space",
 4  "cpu_limit": 2000,
 5  "memory_limit": 40960,
 6  "storage_limit": 2048,
 7  "oltp_namespace": "hugegraph-server",
 8  "olap_namespace": "hugegraph-server",
 9  "storage_namespace": "hugegraph-server",
10  "operator_image_path": "127.0.0.1/hugegraph-registry/hugegraph-computer-operator:3.1.1",
11  "internal_algorithm_image_url": "127.0.0.1/hugegraph-registry/hugegraph-computer-algorithm:3.1.1",
12  "compute_cpu_limit": 0,
13  "compute_memory_limit": 0,
14  "max_graph_number": 1000,
15  "max_role_number": 100,
16  "cpu_used": 0,
17  "memory_used": 0,
18  "storage_used": 0,
19  "graph_number_used": 0,
20  "role_number_used": 0,
21  "auth": true
22}

2.0.5 Delete a graphspace

Params

Path parameter

  • graphspace: Graphspace name
Method & Url
1DELETE http://localhost:8080/graphspaces/gs1
Response Status
1204

Warning: deleting a graphspace releases all resources that belong to it.