Step 1: Start the Leader FE node
The following procedures are performed on an FE instance.-
Create a dedicated directory for metadata storage. We recommend storing metadata in a separate directory from the FE deployment files. Make sure that this directory exists and that you have write access to it.
-
Navigate to the directory that stores the the database FE deployment files you prepared earlier, and modify the FE configuration file fe/conf/fe.conf.
a. Specify the metadata directory in the configuration item
meta_dir.b. If any of the FE ports mentioned in the Environment Configuration Checklist are occupied, you must assign valid alternatives in the FE configuration file.CAUTION If you want to deploy multiple FE nodes in a cluster, you must assign the same
c. If you want to enable IP address access for your cluster, you must add the configuration itemhttp_portto each FE node.priority_networksin the configuration file and assign a dedicated IP address (in the CIDR format) to the FE node. You can ignore this configuration item if you want to enable FQDN access for your cluster.NOTE
d. If you have multiple JDKs installed on the instance, and you want to use a specific JDK that is different from the one specified in the environment variable- You can run
ifconfigin your terminal to view the IP address(es) owned by the instance. - From v3.3.0, StarRocks supports deployment based on IPv6.
JAVA_HOME, you must specify the path where the chosen JDK is installed by adding the configuration itemJAVA_HOMEin the configuration file.For information about advanced configuration items, see Parameter Configuration - FE configuration items. - You can run
-
Start the FE node.
-
To enable IP address access for your cluster, run the following command to start the FE node:
-
To enable FQDN access for your cluster, run the following command to start the FE node:
Note that you only need to specify the parameter
--host_typeONCE when you start the node for the first time.CAUTION Before starting the FE node with FQDN access enabled, make sure you have assigned hostnames for all instances in /etc/hosts. See Environment Configuration Checklist - Hostnames for more information.
-
To enable IP address access for your cluster, run the following command to start the FE node:
-
Check the FE logs to verify if the FE node is started successfully.
A record of log like “2022-08-10 16:12:29,911 INFO (UNKNOWN x.x.x.x_9010_1660119137253(-1)|1) [FeServer.start():52] thrift server started with port 9020.” suggests that the FE node is started properly.
Step 2: Start the BE service
Note You can only add BE nodes to shared-nothing clusters and CN nodes to shared-data clusters. Otherwise, it may lead to unknown behaviors. The following procedures are performed on the BE instances.-
Create a dedicated directory for data storage. We recommend storing data in a separate directory from the BE deployment directory. Make sure that this directory exists and you have write access to it.
-
Navigate to the directory that stores the the database BE deployment files you prepared earlier, and modify the BE configuration file be/conf/be.conf.
a. Specify the data directory in the configuration item
storage_root_path. Multiple volumes are separated by semicolon (;). Example:/data1;/data2.b. If any of the BE ports mentioned in the Environment Configuration Checklist are occupied, you must assign valid alternatives in the BE configuration file.c. If you want to enable IP address access for your cluster, you must add the configuration itempriority_networksin the configuration file and assign a dedicated IP address (in the CIDR format) to the BE node. You can ignore this configuration item if you want to enable FQDN access for your cluster.NOTE
d. If you have multiple JDKs installed on the instance, and you want to use a specific JDK that is different from the one specified in the environment variable- You can run
ifconfigin your terminal to view the IP address(es) owned by the instance. - From v3.3.0, StarRocks supports deployment based on IPv6.
JAVA_HOME, you must specify the path where the chosen JDK is installed by adding the configuration itemJAVA_HOMEin the configuration file.For information about advanced configuration items, see Parameter Configuration - BE configuration items. - You can run
-
Start the BE node.
CAUTION
- Before starting the BE node with FQDN access enabled, make sure you have assigned hostnames for all instances in /etc/hosts. See Environment Configuration Checklist - Hostnames for more information.
- You do not need to specify the parameter
--host_typewhen you start BE nodes.
-
Check the BE logs to verify if the BE node is started successfully.
A record of log like “I0810 16:18:44.487284 3310141 task_worker_pool.cpp:1387] Waiting to receive first heartbeat from frontend” suggests that the BE node is started properly.
- You can start new BE nodes by repeating the above procedures on other BE instances.
NOTE
- A high-availability cluster of BEs is automatically formed when at least three BE nodes are deployed and added to a cluster.
- If you want to deploy just one BE node, you must set
default_replication_numto1in the FE configuration file fe/conf/fe.conf.
Step 3: Set up the cluster
After all FE and BE nodes are started properly, you can set up the cluster. The following procedures are performed on a MySQL client. You must have MySQL client 5.5.0 or later installed.-
Connect to the database via your MySQL client. You need to log in with the initial account
root, and the password is empty by default. -
Check the status of the Leader FE node by executing the following SQL.
Example:
- If the field
Aliveistrue, this FE node is properly started and added to the cluster. - If the field
RoleisFOLLOWER, this FE node is eligible to be elected as the Leader FE node. - If the field
RoleisLEADER, this FE node is the Leader FE node.
- If the field
-
Add the BE nodes to the cluster.
NOTE You can use the preceding command to add multiple BE nodes at a time. Each
<be_address>:<heartbeat_service_port>pair represents one BE node. -
Check the status of the BE nodes by executing the following SQL.
Example:If the field
Aliveistrue, this BE node is properly started and added to the cluster.
Step 4: (Optional) Deploy a high-availability FE cluster
A high-availability FE cluster requires at least THREE Follower FE nodes in the cluster. After the Leader FE node is started successfully, you can then start two new FE nodes to deploy a high-availability FE cluster.-
Connect to the database via your MySQL client. You need to log in with the initial account
root, and the password is empty by default. -
Add the new Follower FE node to the cluster by executing the following SQL.
NOTE
- You can use the preceding command to add a single Follower FE nodes each time.
- If you want to add Observer FE nodes, execute
ALTER SYSTEM ADD OBSERVER "<fe_address>:<edit_log_port>". For detailed instructions, see ALTER SYSTEM - FE.
-
Launch a terminal on the new FE instance, create a dedicated directory for metadata storage, navigate to the directory that stores the database FE deployment files, and modify the FE configuration file fe/conf/fe.conf. For more instructions, see Step 1: Start the Leader FE node. Basically, you can repeat the procedures in Step 1 except for the command used to start the FE node.
After configuring the Follower FE node, execute the following SQL to assign a helper node for Follower FE node and start the Follower FE node.
NOTE When adding new Follower FE node to a cluster, you must assign a helper node (essentially an existing Follower FE node) to the new Follower FE node to synchronize the metadata.
-
To start a new FE node with IP address access, run the following command to start the FE node:
Note that you only need to specify the parameter
--helperONCE when you start the node for the first time. -
To start a new FE node with FQDN access, run the following command to start the FE node:
Note that you only need to specify the parameters
--helperand--host_typeONCE when you start the node for the first time.
-
To start a new FE node with IP address access, run the following command to start the FE node:
-
Check the FE logs to verify if the FE node is started successfully.
A record of log like “2022-08-10 16:12:29,911 INFO (UNKNOWN x.x.x.x_9010_1660119137253(-1)|1) [FeServer.start():52] thrift server started with port 9020.” suggests that the FE node is started properly.
-
Repeat the preceding procedure 2, 3, and 4 until you have start all the new Follower FE nodes properly, and then check the status of the FE nodes by executing the following SQL from your MySQL client:
Example:
- If the field
Aliveistrue, this FE node is properly started and added to the cluster. - If the field
RoleisFOLLOWER, this FE node is eligible to be elected as the Leader FE node. - If the field
RoleisLEADER, this FE node is the Leader FE node.
- If the field
Stop the cluster
You can stop the cluster by running the following commands on the corresponding instances.-
Stop an FE node.
-
Stop a BE node.
Troubleshooting
Try the following steps to identify the errors that occur when you start the FE or BE nodes:-
If an FE node is not started properly, you can identify the problem by checking its log in fe/log/fe.warn.log.
Having identified and resolved the problem, you must first terminate the current FE process, delete the existing meta directory, create a new metadata storage directory, and then restart the FE node with the correct configuration.
-
If a BE node is not started properly, you can identify the problem by checking its log in be/log/be.WARNING.
Having identified and resolved the problem, you must first terminate the existing BE process, delete the existing storage directory, create a new data storage directory, and then restart the BE node with the correct configuration.