Register the Storage Service
When connecting to NebulaGraph for the first time, you have to add the Storage hosts, and confirm that all the hosts are online.
- Starting from NebulaGraph 3.0.0, you have to run
ADD HOSTSbefore reading or writing data into the Storage Service. - For NebulaGraph of versions earlier than 3.0.0 and NebulaGraph Cloud clusters,
ADD HOSTSis not needed.
Prerequisites
You have connected to NebulaGraph.
Steps
- Add the Storage hosts.
Run the following command to add hosts:
ADD HOSTS <ip>:<port> [,<ip>:<port> ...];
Example:
nebula> ADD HOSTS 192.168.10.100:9779, 192.168.10.101:9779, 192.168.10.102:9779;
caution
Make sure that the IP you added is the same as the IP configured for local_ip in the nebula-storaged.conf file. Otherwise, the Storage service will fail to start. For information about configurations, see Configurations.
- Check the status of the hosts to make sure that they are all online.
nebula> SHOW HOSTS;
+------------------+------+----------+--------------+---------------------- +------------------------+---------+
| Host | Port | Status | Leader count | Leader distribution | Partition distribution | Version |
+------------------+------+----------+--------------+---------------------- +------------------------+---------+
| "192.168.10.100" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "<Var name="nebula_release" />" |
| "192.168.10.101" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "<Var name="nebula_release" />"|
| "192.168.10.102" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "<Var name="nebula_release" />"|
+------------------+------+----------+--------------+---------------------- +------------------------+---------+
The Status column of the result above shows that all Storage hosts are online.