宝塔使用clickhouse踩坑

前言

最近有个物联网项目,需要存储物联网终端发送过来的信息(类似log日志,但又要存储在数据库里,方便后期聚合统计),本来想写文件的奈何客户要求聚合统计,所以只能用数据库才能达到更高的计算效率,当然mysql对这种日志型数据库并没有优势,数据量上去后反而不利于计算,所以就研究了一下列式数据库,看到宝塔有clickhouse就研究了一下,但是期间遇到很多坑这里把解决方案分享出来供大家参考

踩坑

1号坑 docker内部无法访问宿主机的clickhouse

shell 复制代码
[error] failed to initialize database, got error dial tcp 172.17.0.1:9000: connect: connection refused
  • 解决方案:
    1) 使用网卡docker0的ip地址访问,在宿主机执行ip add即可看到这个网卡

    我的env配置如下

    DB_CLICK_HOST=172.17.0.1

2)上面ip配置后依然无法访问,提示connect: connection refused,这里还要修改配置文件,在端口下面添加listen_host即可:

conf 复制代码
<listen_host>0.0.0.0</listen_host>

3)上面ip配置后依然无法访问,提示connect: connection refused,这里还要进行宝塔>安全>系统防火墙端口放行(如果需要外网访问clickhouse,那还需要到运营商那边放开对应端口,只是docker容器访问不需要到运营商放):

2号坑 能链接了,但是提示密码或者用户不对

报错如下:

shell 复制代码
[0m[31m[error] [0mfailed to initialize database, got error code: 516, message: default: Authentication failed: password is incorrect, or there is no user with such name.

If you have installed ClickHouse and forgot password you can reset it in the configuration file.
The password for default user is typically located at /etc/clickhouse-server/users.d/default-password.xml
and deleting this file will reset the password.
See also /etc/clickhouse-server/users.xml on the server where ClickHouse is installed.

出现这个问题需要将密码放到user.xml配置中去(clickhouse面板配置的密码好像无效,这个问题我反馈给宝塔官方了看这里https://www.bt.cn/bbs/thread-139714-1-1.html)

相关推荐
梦想与想象-广州大智汇5 天前
MySQL 同步数据到 ClickHouse 方案对比分析
数据库·mysql·clickhouse
Smile_2542204186 天前
clickhouse日志疯涨问题
linux·运维·服务器·clickhouse
计算机魔术师6 天前
【技术硬核 | 存储】ClickHouse 原理与 Langfuse 存储实践:当 LLM Trace 爆炸时,PG 还扛得住吗?
人工智能·clickhouse·工程实践·sbti·职场焦虑
fire-flyer9 天前
ClickHouse系列(九):慢查询、内存 OOM 与稳定性治理
android·clickhouse
fire-flyer9 天前
ClickHouse系列(十):生产架构与最佳实践总结
clickhouse·架构
fire-flyer10 天前
ClickHouse系列(八):ClickHouse 的 UPDATE / DELETE 正确姿势
大数据·数据库·clickhouse
fire-flyer10 天前
ClickHouse系列(七):Materialized View 与多分辨率 Rollup 设计
大数据·数据库·clickhouse·架构
fire-flyer11 天前
ClickHouse系列(二):MergeTree 家族详解
大数据·数据库·clickhouse
fire-flyer11 天前
ClickHouse系列(四):压缩不是为了省磁盘,而是为了更快的查询
数据库·clickhouse
l1t11 天前
测试clickhouse 26.3的新功能
数据库·clickhouse