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.
Compatibility
- Starting from NebulaGraph 3.0.0, you have to run
ADD HOSTS
before reading or writing data into the Storage Service. - For NebulaGraph of versions earlier than 3.0.0 and NebulaGraph Cloud clusters,
ADD HOSTS
is 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;
If enabling the Zone feature, you still need to specify
INTO ZONE <zone_name>
to add Storage hosts, otherwise the Storage hosts will fail to be added.ADD HOSTS <ip>:<port> [,<ip>:<port> ...] INTO ZONE <zone_name>;
Example:
nebula> ADD HOSTS 192.168.8.111:9779,192.168.8.112:9779 INTO ZONE az1;
Caution
Make sure that the IP you added is the same as the IP configured for
local_ip
in thenebula-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" | "3.5.0" | | "192.168.10.101" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.5.0"| | "192.168.10.102" | 9779 | "ONLINE" | 0 | "No valid partition" | "No valid partition" | "3.5.0"| +------------------+------+----------+--------------+---------------------- +------------------------+---------+
The
Status
column of the result above shows that all Storage hosts are online.