首页 > 解决方案 > clickhouse外部字典加载错误

问题描述

我计划升级 clickhouse 集群。从 v19.14.6 开始。到 v21.3.10。但是当我在 v21.3.10 上加载 mysql 外部字典时,出现错误:

Query:
SYSTEM RELOAD DICTIONARY dim_subject_movie


Received exception from server:
Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = Exception: Connections to all replicas failed: frodo@mysql1:3306 as user test, frodo@mysql1:3306 as user test (version 21.3.10.1 (official build))

配置如下

  <dictionary>
  <name>dim_subject_movie</name>
  <source>
    <mysql>
      <port>3306</port>
      <user>test</user>
      <password>test1</password>
      <replica>
        <host>mysql1</host>
        <priority>1</priority>
      </replica>
      <db>frodo</db>
      <table>subject_movie_collection</table>
      <where>date=subdate(current_date, 1)</where>
     </mysql>
  </source>
  <lifetime>
    <min>300</min>
    <max>360</max>
  </lifetime>
  <layout><hashed /></layout>
  <structure>
    <id>
      <name>movie_id</name>
    </id>
    <attribute>
      <name>movie_title</name>
      <type>String</type>
      <null_value></null_value>
    </attribute>
  </structure>
  </dictionary>

有人遇到过同样的问题吗?谢谢!</p>

标签: clickhouse

解决方案


找到原因是因为 dic 源码(mysql 5.1)太旧,无法兼容高版本的clickhouse。最后我把clickhouse的版本改回19.14.6。


推荐阅读