Metabase安装

1. 安装前提

  • 安装mysql8
  • 创建数据库metabaseappdb

1. docker安装

支持clickhouse:
metabase本身不支持clickhouse,clickhouse官方提供了插件支持
下载metabase-clickhouse-driver,地址:https://github.com/ClickHouse/metabase-clickhouse-driver/releases
注意metabasemetabase-clickhouse-driver版本号对应关系
创建目录/home/dockerdata/metabase/plugins,设置权限 chmod 777 /home/dockerdata/metabase/*
clickhouse.metabase-driver.jar放在/home/dockerdata/metabase/plugins目录下

1
2
3
4
docker run -d -p 3000:3000 \
-e "MB_DB_CONNECTION_URI=mysql://192.168.10.128:3306/metabaseappdb?user=root&password=aacopy.cn&allowPublicKeyRetrieval=true" \
-v /home/dockerdata/metabase/plugins:/plugins \
--name metabase metabase/metabase:v0.50.25

访问:http://192.168.10.128:3000

2. 问题

  • 报错Caused by: java.sql.SQLException: RSA public key is not available client side (option serverRsaPublicKeyFile not set)

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    2024-01-12 05:36:58,382 INFO db.setup :: Verifying mysql Database Connection ...
    2024-01-12 05:36:58,475 ERROR metabase.core :: Metabase Initialization FAILED
    clojure.lang.ExceptionInfo: Unable to connect to Metabase mysql DB. {}
    at metabase.db.setup$fn__33730$verify_db_connection__33735$fn__33736$fn__33737.invoke(setup.clj:102)

    ......

    Caused by: java.sql.SQLException: RSA public key is not available client side (option serverRsaPublicKeyFile not set)
    at org.mariadb.jdbc.internal.com.send.authentication.CachingSha2PasswordPlugin.process(CachingSha2PasswordPlugin.java:189)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:745)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
    ... 39 more
    2024-01-12 05:36:58,496 INFO metabase.core :: Metabase Shutting Down ...
    2024-01-12 05:36:58,497 INFO metabase.server :: Shutting Down Embedded Jetty Webserver
    2024-01-12 05:36:58,517 INFO metabase.core :: Metabase Shutdown COMPLETE
    • 使用MB_DB_CONNECTION_URI的方式连接数据库

      1
      2
      3
      docker run -d -p 3000:3000 \
      -e "MB_DB_CONNECTION_URI=mysql://192.168.25.216:3306/metabaseappdb?user=root&password=aacopy.cn&allowPublicKeyRetrieval=true" \
      --name metabase metabase/metabase
    • 指定allowPublicKeyRetrieval=true

  • 报错Caused by: java.sql.SQLSyntaxErrorException: (conn=106) Unknown database ‘metabaseappdb’

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    2024-01-12 05:53:27,754 ERROR metabase.core :: Metabase Initialization FAILED
    clojure.lang.ExceptionInfo: Unable to connect to Metabase mysql DB. {}

    ......

    Caused by: java.sql.SQLSyntaxErrorException: (conn=106) Unknown database 'metabaseappdb'
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
    at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:187)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:769)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:546)
    at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1367)
    ... 39 more
    2024-01-12 05:53:27,768 INFO metabase.core :: Metabase Shutting Down ...
    2024-01-12 05:53:27,770 INFO metabase.server :: Shutting Down Embedded Jetty Webserver
    2024-01-12 05:53:27,789 INFO metabase.core :: Metabase Shutdown COMPLETE
    • 提前在mysql创建metabaseappdb
  • 报错

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    2024-01-16 06:53:58,195 ERROR metabase.core :: Metabase Initialization FAILED
    liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for changeset migrations/001_update_migrations.yaml::v48.00-033::noahmoss:
    Reason: liquibase.exception.DatabaseException: (conn=177) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'agg_recipients as ( [Failed SQL: (1064) create or replace view v_subscriptions as

    ......

    Caused by: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'agg_recipients as (
    select
    pulse_channel_id,
    group_concat(co' at line 1
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1693)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1555)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1518)
    at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:257)
    ... 89 more
    • mysql 5.7不支持,升级到8.0