Deploy Raft Listener for Nebula Storage service¶
Full-Text index data is written to the Elasticsearch cluster asynchronously. The Raft Listener (hereinafter shortened as Listener) is a separate process that fetches data from the Storage Service and writes them into the Elasticsearch cluster.
Prerequisites¶
- You have read and fully understand the restrictions for using Full-Text indexes.
- You have deployed a Nebula Graph cluster.
- You have prepared at least one extra Storage Server. To use the Full-Text search, you must run one or more Storage Server as the Raft Listener.
Precautions¶
- The Storage Service that you want to run as a Listener must have the same or later version with all the other Nebula Graph services in the cluster.
- For now, you can only add Listeners to a graph space once and for all. Trying to add listeners to a graph space that already has a listener will fail. To add multiple listeners, set them in one statement.
Step 1: Prepare the configuration file for the Listeners¶
You have to prepare a Listener configuration file on the machine that you want to deploy the Listeners. The file name must be nebula-storaged-listener.conf
. A template is provided for your reference.
Note
Use real IP addresses in the configuration file instead of domain names or loopback IP addresses such as 127.0.0.1
.
Step 2: Start the Listeners¶
Run the following command to start the Listeners.
./bin/nebula-storaged --flagfile ${listener_config_path}/nebula-storaged-listener.conf
${listener_config_path}
is the path where you store the Listener configuration file.
Step 3: Add Listeners to Nebula Graph¶
Connect to Nebula Graph and run USE <space>
to enter the graph space that you want to create Full-Text indexes for. Then run the following statement to add the Listener into Nebula Graph.
Note
You must use real IPs for the listeners.
ADD LISTENER ELASTICSEARCH <listener_ip:port> [,<listener_ip:port>, ...]
Multiple listener_ip:port
pairs are separated with commas. For example:
nebula> ADD LISTENER ELASTICSEARCH 192.168.8.5:46780,192.168.8.6:46780;
Show Listeners¶
Run the SHOW LISTENER
statement to list the Listeners.
For example:
nebula> SHOW LISTENER;
+--------+-----------------+-----------------------+----------+
| PartId | Type | Host | Status |
+--------+-----------------+-----------------------+----------+
| 1 | "ELASTICSEARCH" | "[192.168.8.5:46780]" | "ONLINE" |
+--------+-----------------+-----------------------+----------+
| 2 | "ELASTICSEARCH" | "[192.168.8.5:46780]" | "ONLINE" |
+--------+-----------------+-----------------------+----------+
| 3 | "ELASTICSEARCH" | "[192.168.8.5:46780]" | "ONLINE" |
+--------+-----------------+-----------------------+----------+
Remove Listeners¶
Run the REMOVE LISTENER ELASTICSEARCH
statement to remove all the Elasticsearch Listeners for a graph space.
For example:
nebula> REMOVE LISTENER ELASTICSEARCH;
What to do next¶
After deploying the Elasticsearch cluster and the Listeners, Full-Text indexes are created automatically on the Elasticsearch cluster. You can do Full-Text search now. For more information, see Full-Text search.