1、Not enough privileges. To execute this query it's necessary to have the grant MYSQL ON *.* (version 20.12.3.3 (official build))
clickhouse 文档里没说 有个隐藏的权限 mysql 用来赋予从mysql 同步数据的权限 这是系统级别的 无法赋予给某个库 grant mysql on *.* to xxx即可
2,clickhouse+ superset报错
sqlalchemy.exc.NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:clickhouse
网上说下载py里的sqlalchemy连接clickhouse插件,这个没错,但是sqlalchemy版本号可能有问题,一定要选高版本的
3,clickhouse+ superset报错
DB::Exception: default: Authentication failed: password is
incorrect or there is no user with such name
这个报错不是因为账号密码不对,又是因为包版本号问题
这里需要把infi.clickhouse_orm降级
pip3 install infi.clickhouse_orm==1.0.4
4,给表改名
RENAME TABLE map_ch_goodssearch_goods to map_ch_goodssearch_goods_20210514
5、 DB::Exception: Memory limit (for query) exceeded: would use 9.32 GiB (attempt to allocate chunk of 8388608 bytes), maximum: 9.31 GiB: While executing AggregatingTransform. (MEMORY_LIMIT_EXCEEDED)
这个网络上的文档比较多。。临时的方案是直接set ,永久的方案是user.xml里增加配置 ,不过不知道是有意还是无意, 都漏了一个非常重要的点
<profiles> 里的参数也需要调整 。这个直接限制了用户的内存用量。单纯调用户内存是无效,默认情况下是10000000000就是9.31gb 这里调整完了再去<users>下调整
即
<profiles>
<!-- Default settings. -->
<default>
<!-- Maximum memory usage for processing single query, in bytes. -->
<max_memory_usage>100000000000</max_memory_usage>
这里也要调整 我直接复用了default 你可以根据你本身的调整
然后再调整user
<users>
<admin>
<password>pwd</password>
<access_management>1</access_management>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
<max_memory_usage>100000000000</max_memory_usage>
<use_uncompressed_cache>0</use_uncompressed_cache>
</admin>
</users>
6、DB::Exception: default: Authentication failed: password is incorrect or there is no user with such name.
clickhouse 创建分布式表(distributed)报错
需要在config.xml里给所有节点配上账密
举例
<enic_cluster>
<shard>
<replica>
<host>190.***.***.175</host>
<port>9000</port>
<user>default</user>
<password>okE7heh7</password>
</replica>
</shard>
<shard>
<replica>
<host>190.***.***.176</host>
<port>9000</port>
<user>default</user>
<password>okE7heh7</password>
</replica>
</shard>
<shard>
<replica>
<host>190.***.***.177</host>
<port>9000</port>
<user>default</user>
<password>okE7heh7</password>
</replica>
</shard>
</enic_cluster>
7、<Error> Application: DB::Exception: Listen [::]:8123 failed: Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: Address family for hostname not supported
这不是因为服务器上端口被占用了 是因为你没有注释掉ipv6的地址
注释掉就行了
8、no Zookeeper configuration in server config. (NO_ELEMENTS_IN_CONFIG)
zk的链接没问题 这是因为ck要求用主机名的原因,换成主机名就行了
例子
<zookeeper>
<node>
<host>zoo01.yandex.ru</host>
<port>2181</port>
</node>
<node>
<host>zoo02.yandex.ru</host>
<port>2181</port>
</node>
<node>
<host>zoo03.yandex.ru</host>
<port>2181</port>
</node>
</zookeeper>
9、导入csv格式的文件时,因行格式不统一时报错的临时解决办法,列的数量和列属性不一致时
指定容错参数:
--input_format_allow_errors_num arg 指定允许存在错误的行数或次数(忽略错误,执行下一行)
--input_format_allow_errors_ratio arg (百分比)
举个例子
cat xab | clickhouse-client -h 10.20.2.18 -u admin --password 123.com --ignore-error --input_format_allow_errors_num 100 --format_csv_delimiter "#" --query="insert into ai_datalake.t_tencent_statistic_all FORMAT CSVWithNames"
当然最终还是需要去排查具体什么问题