This topic describes how to query data in Fluss from Serverless StarRocks. You can register Fluss as an external data source in StarRocks by creating an external catalog. This lets you run ad hoc queries and analyze your Fluss data.
Limitations
Serverless StarRocks 3.3.13-1.2.0 or later.
Procedure
Step 1: Create a Fluss catalog
Execute the following SQL statement in StarRocks to register Fluss as an external catalog:
CREATE EXTERNAL CATALOG <catalog_name>[COMMENT <comment>]
PROPERTIES
("type" = "fluss",
CatalogParams
);Parameters
Parameter | Required | Description |
catalog_name | Yes | The name of the catalog. It must start with a letter, contain only letters, digits, and underscores (_), and be no more than 64 characters long. |
comment | No | A description of the catalog. |
type | Yes | The type of the external data source. This parameter must be set to |
bootstrap.servers | Yes | The service discovery address of the Fluss cluster. You can find this address on the Fluss instance details page. |
fluss.option.client.security.protocol | Yes | The authentication protocol. On Alibaba Cloud, the default value is |
fluss.option.client.security.sasl.mechanism | Yes | The SASL authentication mechanism. The default value is |
fluss.option.client.security.sasl.username | Yes | The username for SASL authentication. |
fluss.option.client.security.sasl.password | Yes | The password for SASL authentication. |
Example
CREATE EXTERNAL CATALOG `fluss_catalog`
PROPERTIES
("type" = "fluss","bootstrap.servers" = "internal.svc.cluster.local.fluss:9123","fluss.option.client.security.protocol" = "SASL","fluss.option.client.security.sasl.mechanism" = "PLAIN","fluss.option.client.security.sasl.username" = "xxx","fluss.option.client.security.sasl.password" = "xxx");Step 2: Query Fluss data
After creating the catalog, you can query data in Fluss in two ways.
Method 1: Direct cross-catalog queries
Use the three-part naming convention (Catalog.Database.Table) to query data directly without switching the context:
SELECT * FROM <catalog_name>.<database_name>.<table_name>;Method 2: Switch to the Fluss catalog before querying
Switch the catalog and database for the current session:
-- Switch catalog SET CATALOG <catalog_name>; -- Switch database USE <db_name>;Alternatively, you can switch both in a single statement:
USE <catalog_name>.<db_name>;Query the target table directly:
SELECT count(*) FROM <table_name> LIMIT 10;
Related operations
View created catalogs
-- View all catalogs
SHOW CATALOGS;
-- View the CREATE statement for a specific catalog
SHOW CREATE CATALOG fluss_catalog;View Fluss table schema
DESCRIBE <catalog_name>.<database_name>.<table_name>;View Fluss databases
SHOW DATABASES FROM <catalog_name>;Drop a Fluss catalog
Dropping a catalog removes its mapping in StarRocks but does not affect the actual data in Fluss.
DROP CATALOG fluss_catalog;