StarRocks
Official · maintained by Marmotmarmotdata/starrocks Discover databases, tables, views and materialized views from StarRocks clusters
The StarRocks plugin discovers databases, tables, views and asynchronous materialized views from StarRocks clusters.
StarRocks speaks the MySQL wire protocol, so the plugin connects to a frontend (FE) node on the query port with the go-sql-driver/mysql driver. It records the details a StarRocks table has and a plain SQL table does not: the key model, the aggregate function of each value column, partitioning, bucketing and the sort key.
Required Permissions
The user needs read access to the databases you want in the catalog:
CREATE USER 'marmot_reader'@'%' IDENTIFIED BY 'your-password';
GRANT SELECT ON shop.* TO 'marmot_reader'@'%';
SHOW CATALOGS, SHOW DATABASES and SHOW CREATE TABLE only return objects the user can read, so a reader with no grants discovers nothing rather than failing.
Catalogs
Discovery runs against one catalog per configuration block. catalog defaults to default_catalog, the cluster's own storage. Naming an external catalog runs SET CATALOG first and discovers the tables it exposes; add a second run to cover a second catalog.
Row Counts
Row counts and sizes come from information_schema.tables, which StarRocks fills in from backend tablet reports. A cluster that has not reported yet, and the starrocks/allin1-ubuntu image in particular, returns 0 for both. Set include_statistics: false to leave them out.
Testing
Unit tests need nothing installed:
go test ./...
The end to end tests run against a real cluster and are skipped unless MARMOT_TEST_STARROCKS_HOST is set. They read a shop database holding the four key models, a view and a materialized view, which starrocks/testdata/seed.sql creates:
docker run -d --name starrocks --memory 4g -p 9030:9030 -p 8030:8030 starrocks/allin1-ubuntu:latest
# wait until SHOW BACKENDS reports Alive: true, about one to three minutes
mysql -h127.0.0.1 -P9030 -uroot < starrocks/testdata/seed.sql
MARMOT_TEST_STARROCKS_HOST=localhost MARMOT_TEST_STARROCKS_USER=root go test ./starrocks -run TestE2E
In the UI
Point-and-click, no config file needed.
- 1 Open Runs Create pipeline
- 2 Pick StarRocks from the plugin list.
- 3 Fill in the wizard, set a schedule, save.
With the CLI
Save a YAML config, then run marmot ingest.
name: my-starrocks-pipeline
runs:
- starrocks:
host: "<host>"
user: "<user>"$ marmot ingest -c ingest.yamlNot using plugins? Other ways to populate Marmot
Configuration
15 top-level fields. * marks required fields.
tags multiselect Tags to apply to discovered assets
external_links object[] External links to show on all assets
name string Display name for the link
icon string Icon identifier for the link
url string URL to the external resource
filter object Filter discovered assets by name (regex)
include multiselect Include patterns for resource names (regex)
exclude multiselect Exclude patterns for resource names (regex)
host string Frontend (FE) hostname or IP address
port int Frontend MySQL protocol port
- default
- 9030
user string Username for authentication
password password Password for authentication
catalog string Catalog to discover; an external catalog name switches discovery to it
- default
- default_catalog
tls select TLS mode (false, true, skip-verify, preferred)
- default
- false
databases multiselect Databases to discover; all when empty
exclude_databases multiselect Databases to skip
- default
- ["information_schema","_statistics_","sys"]
include_columns bool Whether to include column information
- default
- true
include_views bool Whether to discover views
- default
- true
include_materialized_views bool Whether to discover asynchronous materialized views
- default
- true
include_statistics bool Whether to include row counts, sizes and column counts
- default
- true
Assets emitted
Metadata this plugin attaches to each discovered asset.
Database
StarRocksDatabaseFieldsThe metadata on a Database asset.
host stringFrontend hostname
port intFrontend MySQL protocol port
catalog stringCatalog the database belongs to
catalog_type stringCatalog type (Internal, Hive, Iceberg, ...)
database stringDatabase name
starrocks_version stringStarRocks version reported by the frontend
table_count intNumber of tables discovered in the database
view_count intNumber of views and materialized views discovered in the database
Table
StarRocksTableFieldsThe metadata on Table and View assets.
host stringFrontend hostname
port intFrontend MySQL protocol port
catalog stringCatalog name
database stringDatabase name
table_name stringBare table or view name
object_type stringObject type (table, view, materialized_view, external_table)
engine stringStorage engine as reported by information_schema
external_engine stringEngine of an external table (MySQL, Hive, JDBC, ...)
key_model stringTable key model (DUPLICATE, AGGREGATE, UNIQUE, PRIMARY)
key_columns stringComma-separated key columns
partition_type stringPartitioning strategy (RANGE, LIST, EXPRESSION)
partition_columns stringComma-separated partition columns
partition_expression stringPartition expression for expression partitioning
partition_count intNumber of partitions
distribution stringBucketing strategy (HASH, RANDOM)
distribution_columns stringComma-separated hash distribution columns
buckets intNumber of buckets, when fixed
order_by stringComma-separated sort key columns from ORDER BY
replication_num intReplica count from table properties
storage_volume stringStorage volume from table properties
comment stringTable comment
created stringCreation timestamp
updated stringLast data change timestamp
ddl stringCREATE statement as printed by SHOW CREATE
materialized boolWhether a view is an asynchronous materialized view
refresh_type stringMaterialized view refresh type (ASYNC, MANUAL)
is_active boolWhether the materialized view is active
last_refresh_state stringState of the last materialized view refresh
last_refresh_start_time stringStart time of the last materialized view refresh
task_name stringRefresh task name of the materialized view
Column
StarRocksColumnFieldsThe per-column fields in an asset's schema.
column_name stringColumn name
data_type stringColumn type as printed by SHOW FULL COLUMNS
is_nullable boolWhether null values are allowed
is_primary_key boolWhether the column is in the PRIMARY KEY or UNIQUE KEY clause
is_sorting_key boolWhether the column is in the DUPLICATE KEY, AGGREGATE KEY or ORDER BY clause
is_key boolWhether StarRocks reports the column as a key column
aggregation_type stringAggregate function of a value column in an AGGREGATE KEY table
is_auto_increment boolWhether the column is AUTO_INCREMENT
description stringColumn comment
default_expression stringDefault value