Overview
The shared-data cluster is specifically engineered for the cloud on the premise of separation of storage and computing. It allows data to be stored in remote storage (for example, HDFS, AWS S3, Google GCS, Azure Blob Storage, Azure Data Lake Storage Gen2, and MinIO). You can achieve not only cheaper storage and better resource isolation, but elastic scalability for your cluster. The query performance of the shared-data cluster aligns with that of a shared-nothing cluster when the local disk cache is hit. The database shared-data cluster is made up of Frontend Engines (FEs) and Compute Nodes (CNs), which replace the classic Backend Engines (BEs) in shared-nothing clusters. Compared to the classic shared-nothing cluster architecture, separation of storage and computing offers a wide range of benefits. By decoupling these components, the database provides:- Inexpensive and seamlessly scalable storage.
- Elastic scalable computing. Because data is not stored in Compute Nodes (CNs), scaling can be done without data migration or shuffling across nodes.
- Local disk cache for hot data to boost query performance.
- Asynchronous data ingestion into remote storage, allowing a significant improvement in loading performance.

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. Set shared-data run mode.
b. Specify the metadata directory in the configuration item
meta_dir.c. 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
d. 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
e. 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 CN 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 CN instances. You can deploy CN nodes with the BE deployment files.-
Create a dedicated directory for data cache. We recommend caching data in a separate directory from the CN 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 CN configuration file be/conf/cn.conf.
a. Specify the data directory in the configuration item
storage_root_path. Multiple volumes are separated by semicolon (;). Example:/data1;/data2.Local cache is effective when queries are frequent and the data being queried is recent, but there are cases that you may wish to turn off the local cache completely.- In a Kubernetes environment with CN pods that scale up and down in number on demand, the pods may not have storage volumes attached.
- When the data being queried is in a data lake in remote storage and most of it is archive (old) data, if the queries are infrequent, the data cache will have a low hit ratio and the benefit may not be worth having the cache.
NOTE From v3.4.0 onwards, the data is cached under the directory
b. If any of the CN ports mentioned in the Environment Configuration Checklist are occupied, you must assign valid alternatives in the CN configuration file.<storage_root_path>/datacache. When the CN starts, the existing cache data in<storage_root_path>/starlet_cacheis automatically moved to this directory. In earlier versions, the data is cached under the directory<storage_root_path>/starlet_cache.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 CN 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 because most of CN’s parameters are inherited from BE. -
Start the CN node.
CAUTION
- Before starting the CN 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 CN nodes.
-
Check the CN logs to verify if the CN node is started successfully.
A record of log like “I0313 15:03:45.820030 412450 thrift_server.cpp:375] heartbeat has started listening port on 9050” suggests that the CN node is started properly.
- You can start new CN nodes by repeating the above procedures on other instances.
Step 3: Set up the cluster
After all FE and CN 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 CN nodes to the cluster.
NOTE You can add multiple CN nodes with one SQL. Each
<cn_address>:<heartbeat_service_port>pair represents one CN node. -
Check the status of the CN nodes by executing the following SQL.
Example:If the field
Aliveistrue, this CN 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
Step 5: Create and set the default storage volume
To give your shared-data cluster permission to store data in your remote storage, you must reference a storage volume when you create databases or cloud-native tables. A storage volume consists of the properties and credential information of the remote data storage. If you have deployed a new shared-data cluster, you must define a default storage volume before you can create databases and tables in the cluster. Choose your cloud provider and service, and execute the corresponding statements to create and set the default storage volume. AWS S3 The following example creates a storage volumedef_volume for an AWS S3 bucket defaultbucket with the IAM user-based credential (Access Key and Secret Key), enables the Partitioned Prefix feature, and sets it as the default storage volume:
def_volume for a GCS bucket defaultbucket with Service Account-based credentials, enables the storage volume, and sets it as the default storage volume:
def_volume for an Azure Blob Storage bucket defaultbucket with shared key access, enables the storage volume, and sets it as the default storage volume:
adls2 for an Azure Data Lake Storage Gen2 file system testfilesystem with SAS token, and disables the storage volume:
def_volume for a MinIO bucket defaultbucket with Access Key and Secret Key credentials, enables the Partitioned Prefix feature, and sets it as the default storage volume:
def_volume for an HDFS storage, enables the storage volume, and sets it as the default storage volume:
Use shared-data cluster
The usage of shared-data clusters is also similar to that of a classic shared-nothing cluster, except that the shared-data cluster uses storage volumes and cloud-native tables to store data in remote storage.Create a database and a cloud-native table
After you create a default storage volume, you can then create a database and a cloud-native table using this storage volume. Shared-data clusters support all table types. The following example creates a databasecloud_db and a table detail_demo based on Duplicate Key table type, enables the local disk cache, sets the hot data validity duration to one month, and disables asynchronous data ingestion into remote storage:
NOTE The default storage volume is used when you create a database or a cloud-native table in a shared-data cluster if no storage volume is specified.
PROPERTIES
In addition to the regular table PROPERTIES, you need to specify the following PROPERTIES when creating a table for shared-data cluster:
datacache.enable
Whether to enable the local disk cache.
true(Default) When this property is set totrue, the data to be loaded is simultaneously written into the remote storage and the local disk (as the cache for query acceleration).falseWhen this property is set tofalse, the data is loaded only into the remote storage.
NOTE
To enable the local disk cache, you must specify the directory of the disk in the CN configuration item storage_root_path.
datacache.partition_duration
The time range of the hot partitions, counted back from the current time. For a table partitioned by a DATE or DATETIME column, when a query scans a partition, the database populates the cache with the scanned data only if the partition’s range overlaps this time range (or, for list partitioning, if a partition value falls within it). Queries on other partitions still read data that is already cached, but they do not populate the cache and do not use the in-memory page cache. This property is checked against partition bounds at query time, not against the time when data was loaded, and it does not evict data that is already cached. It has no effect on tables that are neither range-partitioned by a single DATE or DATETIME column nor list-partitioned by a DATE or DATETIME column. This property is a string value in the format <number> <unit>, where the unit can be YEAR, MONTH, WEEK, DAY, HOUR, MINUTE, or SECOND (case-insensitive, singular or plural), for example, 7 DAY and 12 HOUR. You can combine several pairs, such as 1 DAY 12 HOUR, but YEAR, MONTH, and WEEK cannot be combined with HOUR, MINUTE, or SECOND. If it is not specified, queries on all partitions populate the cache.
NOTE This property is available only whendatacache.enableis set totrue.
View table information
You can view the information of tables in a specific database usingSHOW PROC "/dbs/<db_id>". See SHOW PROC for more information.
Example:
Type of a table in shared-data cluster is CLOUD_NATIVE. In the field StoragePath, the database returns the remote storage directory where the table is stored.
Load data into a shared-data cluster
Shared-data clusters support all loading methods provided by the database. See Loading options for more information.Query in a shared-data cluster
Tables in a shared-data cluster support all types of queries provided by the database. See the database SELECT for more information.NOTE Shared-data clusters support synchronous materialized views from v3.4.0.
Stop the cluster
You can stop the cluster by running the following commands on the corresponding instances.-
Stop an FE node.
-
Stop a CN node.
Troubleshooting
Try the following steps to identify the errors that occur when you start the FE or CN 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 CN node is not started properly, you can identify the problem by checking its log in be/log/cn.WARNING.
Having identified and resolved the problem, you must first terminate the existing CN process, and then restart the CN node with the correct configuration.