在使用 clickhouse 的过程中你都遇到哪些坑,可以一起交流下。
1、 背景描述
目前生产运维的两套 clickhouse 集群数据库采用的版本是 22.5.1.2079,这个版本的数据库目前存在一个 bug ,就是调用 hive 里的数据时会会导致 clickhouse 集群实例宕,导致无法对外正常提供业务服务。
每当遇到这种情况的时候,我们都是手工进行处理,通过登录 zookeeper 集群,在其中一个节点上进行操作,创建相应对象,这个后面我会抽时间整理文章给大家分享。
为了解决这个 bug,计划对这个版本进行补丁升级,在发布的 24.9 版本中通过changelog 查看是已经解决了这个补丁问题,并且这个版本已经发布整合到了stable版本中。
我上周通过编写自动化 clickhouse 集群部署脚本,完成了一套 clickhouse 集群的安装,但安装后发现版本不对,需要重新安装和生产相同的版本,因为阿里云曾提供过一个镜像,提供了 clickhouse 的下载链接 https://mirrors.aliyun.com/clickhouse/rpm
2、 遇到的坑
我登录阿里云镜像,下载了 clickhouse-common-static-22.5.1.2079.x86_64.rpm 版本,但在安装的时候遇到了 rpm 校验失败的报错,如下所示:
[root@test-ck-xxxx-db1 soft]# wget https://mirrors.aliyun.com/clickhouse/rpm/stable/clickhouse-common-static-22.5.1.2079.x86_64.rpm
--2024-10-28 14:06:28-- https://mirrors.aliyun.com/clickhouse/rpm/stable/clickhouse-common-static-22.5.1.2079.x86_64.rpm
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 61.170.77.223, 61.170.77.229, 61.170.77.228
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|61.170.77.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 76121425 (73M) [application/x-rpm]
Saving to: ‘clickhouse-common-static-22.5.1.2079.x86_64.rpm’
clickhouse-common-static-22.5.1.2079.x86_64.rpm 100%[========================================================================================================================================>] 72.59M 5.74MB/s in 13s
2024-10-28 14:06:41 (5.74 MB/s) - ‘clickhouse-common-static-22.5.1.2079.x86_64.rpm’ saved [76121425/76121425]
[root@test-ck-xxxx-db1 soft]# ll
total 74340
-rw-r--r-- 1 root root 76121425 Feb 9 2023 clickhouse-common-static-22.5.1.2079.x86_64.rpm
[root@test-ck-xxxx-db1 soft]# du -sk clickhouse-common-static-22.5.1.2079.x86_64.rpm
74340 clickhouse-common-static-22.5.1.2079.x86_64.rpm
[root@test-ck-xxxx-db1 soft]# du -sh clickhouse-common-static-22.5.1.2079.x86_64.rpm
73M clickhouse-common-static-22.5.1.2079.x86_64.rpm
-- 安装报错
[root@test-ck-xxxx-db1 soft]# rpm -ivh clickhouse-common-static-22.5.1.2079.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
package clickhouse-common-static-0:22.5.1.2079-1.x86_64 does not verify: Payload SHA256 digest: BAD (Expected 350aa4a1ffe67dc0d7ab3cf388a300cff090559577e3cf38f40c86ad403d6965 != 0098cfa43f3c551c20f73c322748d70da68d1421bc26baed14a561adc238e9f3)
期初我以为是我网络或者是操作系统问题,当前操作系统和生产操作系统相同,区别是生产是物理机,测试是虚拟机,操作系统版本都是 Rocky Linux release 8.10 (Green Obsidian),我又重新找了之前下载的安装包,但安装依然报错。
最后我决定到 clickhouse 官网下载这个版本的rpm 包。
[root@test-ck-xxxx-db1 soft]# sha256sum clickhouse-common-static-22.5.1.2079.x86_64.rpm
e6abd6792fd215f06b0527e503ddd776bcf42db5ee435821f8a2798d390b5b5a clickhouse-common-static-22.5.1.2079.x86_64.rpm
[root@test-ck-xxxx-db1 soft]# mv clickhouse-common-static-22.5.1.2079.x86_64.rpm clickhouse-common-static-22.5.1.2079.x86_64.rpm_bak
[root@test-ck-xxxx-db1 soft]# wget wget https://packages.clickhouse.com/rpm/stable/clickhouse-common-static-22.5.1.2079.x86_64.rpm
--2024-10-28 14:09:19-- http://wget/
Resolving wget (wget)... failed: Name or service not known.
wget: unable to resolve host address ‘wget’
--2024-10-28 14:09:19-- https://packages.clickhouse.com/rpm/stable/clickhouse-common-static-22.5.1.2079.x86_64.rpm
Resolving packages.clickhouse.com (packages.clickhouse.com)... 172.66.40.249, 172.66.43.7, 2606:4700:3108::ac42:28f9, ...
Connecting to packages.clickhouse.com (packages.clickhouse.com)|172.66.40.249|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 252239162 (241M)
Saving to: ‘clickhouse-common-static-22.5.1.2079.x86_64.rpm’
clickhouse-common-static-22.5.1.2079.x86_64.rpm 100%[========================================================================================================================================>] 240.55M 5.00MB/s in 45s
2024-10-28 14:10:05 (5.36 MB/s) - ‘clickhouse-common-static-22.5.1.2079.x86_64.rpm’ saved [252239162/252239162]
FINISHED --2024-10-28 14:10:05--
Total wall clock time: 46s
Downloaded: 1 files, 241M in 45s (5.36 MB/s)
[root@test-ck-xxxx-db1 soft]# du -sh clickhouse-common-static-22.5.1.2079*
241M clickhouse-common-static-22.5.1.2079.x86_64.rpm
73M clickhouse-common-static-22.5.1.2079.x86_64.rpm_bak
[root@test-ck-xxxx-db1 soft]# sha256sum clickhouse-common-static-22.5.1.2079.x86_64.rpm
41470955af95d87cf3557064e5bfc8717f86f71f21ff3c07f7c4073254ef99f8 clickhouse-common-static-22.5.1.2079.x86_64.rpm
对比了下载官网和阿里云上下载的 rpm 包,发现大小竟然相差很大。官网上下载的 rpm 包发现大小是 241 MB,而阿里云上下载的竟然是 72 MB.
从官网上下载的该版本的 rpm 包可以正常安装没有报错。
[root@test-ck-xxxx-db1 soft]# rpm -ivh clickhouse-common-static-22.5.1.2079.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:clickhouse-common-static-0:22.5.1################################# [100%]
[root@test-ck-xxxx-db1 soft]# rpm -qa|grep clickhouse
clickhouse-common-static-22.5.1.2079-1.x86_64
之后我又尝试对比了下 官网和阿里云上的 clickhouse-common-static-dbg-22.5.1.2079.x86_64.rpm 包,惊奇的发现,官网上该 rpm 包大小是 803 MB,而阿里云官网上竟然才 55.7 MB。
![](https://files.mdnice.com/user/66051/40ad68cd-2c01-419e-9b3d-8ecde238ab9d.png)
真的是不比不知道,一比吓一跳。
我不知道阿里云镜像为什么会出现这种情况,以后下载安装软件,一定要去到官网上下载。