Docker
docker run -d -p 3000:3000 --name metabase metabase/metabase
具体用法可参考Metabase官方网站:https://www.metabase.com/start/oss/
在浏览器中打开 http://localhost:3000/ 以访问Metabase界面。
因为Metabase通过 docker 容器部署,所以需要进入容器下载 clickhouse metabase 插件 jar 到plugins目录下。
docker exec -it <container_id> bash cd plugins wget https://github.com/ClickHouse/metabase-clickhouse-driver/releases/download/1.3.3/clickhouse.metabase-driver.jar
退出并重启容器
docker restart <container_id>
重新打开 http://localhost:3000/ 以访问Metabase界面。
这里以SSB数据集为例,执行下面的命令生成数据。请注意,如果您不需要执行性能测试,您可以缩减数据量。
./dbgen -s 1 -T c ./dbgen -s 1 -T l ./dbgen -s 1 -T p ./dbgen -s 1 -T s
目前您需要手动(自动化逻辑正在进行中)在ByteHouse后端创建系统视图。这用于为Metadata提供元数据查找。请注意替换您的<account_id>。
Metabase需要将以下视图用于同步数据库元数据和表元数据。
CREATE DATABASE `<account_id>.system`; -- the USE step is very important, -- if you don't execute this, you'll -- end up creating the tables in the default database USE `<account_id>.system`; -- this is an additional table required from quickbi CREATE VIEW settings AS SELECT `name`, `value`, `changed`, `description`, `min`, `max`, `readonly`, `type` FROM system.settings CREATE VIEW databases as SELECT substring_index(name, '.', -1) `name`, `engine`, `data_path` , `metadata_path` , `uuid` FROM system.databases WHERE system.databases.name LIKE '<account_id>%' CREATE VIEW tables as SELECT substring_index(database, '.', -1) `database`, name, uuid, engine, is_temporary, data_paths, metadata_path, metadata_modification_time, dependencies_database, dependencies_table, create_table_query, engine_full, partition_key, sorting_key, primary_key, sampling_key, storage_policy, total_rows, total_bytes, lifetime_rows, lifetime_bytes, comment FROM system.tables WHERE system.tables.database LIKE '<account_id>%' CREATE VIEW columns as SELECT substring_index(database, '.', -1) `database`, table, name, type, position, default_kind, default_expression, data_compressed_bytes, data_uncompressed_bytes, marks_bytes, comment, is_in_partition_key, is_in_sorting_key, is_in_primary_key, is_in_sampling_key, compression_codec FROM system.columns WHERE system.columns.database LIKE '<account_id>%' CREATE VIEW mutations as SELECT substring_index(database, '.', -1) `database`, `table` , `mutation_id` , `query_id` , `command` , `create_time` , `block_numbers.partition_id` , `block_numbers.number`, `parts_to_do_names` , `parts_to_do` , `is_done` , `latest_failed_part` , `latest_fail_time` , `latest_fail_reason` FROM cnch(server, system.mutations) WHERE database LIKE '<account_id>%'
首页->设置->管理员设置->数据库->添加数据库->配置数据库->保存数据库
Host
:网关地址Port
:8123Username
: 用户名Password
: 密码Databases
: 数据库名