clickhouse 版本由20.8.3升级最新版本21.9.4

背景:

初始集群使用的安装包是altinity提供

clickhouse-client-20.8.3.18-1.el7.x86_64.rpm
clickhouse-common-static-20.8.3.18-1.el7.x86_64.rpm
clickhouse-server-20.8.3.18-1.el7.x86_64.rpm
clickhouse-server-common-20.8.3.18-1.el7.x86_64.rpm

现在使用clickhouse官方包进行升级

1、准备安装包,放入自建的ck-21.9目录

clickhouse-client-21.9.4.35-2.noarch.rpm
clickhouse-common-static-21.9.4.35-2.x86_64.rpm
clickhouse-server-21.9.4.35-2.noarch.rpm

2、备份配置文件

/etc/clickhouse-server目录每个节点整体备份,虽然升级版本会新增配置users.xml.rpmnewconfig.xml.rpmnew,不会覆盖,但是保守起见,备份。
数据文件也可以备份,默认目录/var/lib/clickhouse

3、停止服务

service stop clickhouse-server,注意不是systemctl start clickhouse-server,这个命令无法真正停止服务。
验证是否停止
ps -ef | grep clickhouse-server

4、升级

1、进入ck-21.9目录,执行命令yum upgrade *.rpm -y

已加载插件:fastestmirror
正在检查 clickhouse-client-21.9.4.35-2.noarch.rpm: clickhouse-client-21.9.4.35-2.noarch
clickhouse-client-21.9.4.35-2.noarch.rpm 将作为 clickhouse-client-20.8.3.18-1.el7.x86_64 的更新
正在检查 clickhouse-common-static-21.9.4.35-2.x86_64.rpm: clickhouse-common-static-21.9.4.35-2.x86_64
clickhouse-common-static-21.9.4.35-2.x86_64.rpm 将作为 clickhouse-common-static-20.8.3.18-1.el7.x86_64 的更新
正在检查 clickhouse-server-21.9.4.35-2.noarch.rpm: clickhouse-server-21.9.4.35-2.noarch
clickhouse-server-21.9.4.35-2.noarch.rpm 将作为 clickhouse-server-20.8.3.18-1.el7.x86_64 的更新
正在解决依赖关系
--> 正在检查事务
---> 软件包 clickhouse-client.x86_64.0.20.8.3.18-1.el7 将被 升级
---> 软件包 clickhouse-client.noarch.0.21.9.4.35-2 将被 更新
---> 软件包 clickhouse-common-static.x86_64.0.20.8.3.18-1.el7 将被 升级
---> 软件包 clickhouse-common-static.x86_64.0.21.9.4.35-2 将被 更新
---> 软件包 clickhouse-server.x86_64.0.20.8.3.18-1.el7 将被 升级
---> 软件包 clickhouse-server.noarch.0.21.9.4.35-2 将被 舍弃
---> 软件包 clickhouse-server-common.x86_64.0.20.8.3.18-1.el7 将被 取代
--> 解决依赖关系完成

依赖关系解决

=========================================================================================================================================================================================================================================
 Package                                                    架构                                     版本                                           源                                                                              大小
=========================================================================================================================================================================================================================================
正在安装:
 clickhouse-server                                          noarch                                   21.9.4.35-2                                    /clickhouse-server-21.9.4.35-2.noarch                                          156 k
      替换  clickhouse-server-common.x86_64 20.8.3.18-1.el7
正在更新:
 clickhouse-client                                          noarch                                   21.9.4.35-2                                    /clickhouse-client-21.9.4.35-2.noarch                                           88 k
 clickhouse-common-static                                   x86_64                                   21.9.4.35-2                                    /clickhouse-common-static-21.9.4.35-2.x86_64                                   580 M

事务概要
=========================================================================================================================================================================================================================================
安装  1 软件包
升级  2 软件包

总计:580 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
警告:RPM 数据库已被非 yum 程序修改。
  正在更新    : clickhouse-common-static-21.9.4.35-2.x86_64                                                                                                                                                                          1/7 
  正在安装    : clickhouse-server-21.9.4.35-2.noarch                                                                                                                                                                                 2/7 
警告:/etc/clickhouse-server/config.xml 已建立为 /etc/clickhouse-server/config.xml.rpmnew 
警告:/etc/clickhouse-server/users.xml 已建立为 /etc/clickhouse-server/users.xml.rpmnew 
groupadd:“clickhouse”组已存在
useradd:用户“clickhouse”已存在
ClickHouse binary is already located at /usr/bin/clickhouse
Symlink /usr/bin/clickhouse-server already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-server to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-client already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-client to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-local already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-local to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-benchmark already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-benchmark to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-copier already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-copier to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-obfuscator already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-obfuscator to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-git-import to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-compressor already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-compressor to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-format already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-format to /usr/bin/clickhouse.
Symlink /usr/bin/clickhouse-extract-from-config already exists but it points to /clickhouse. Will replace the old symlink to /usr/bin/clickhouse.
Creating symlink /usr/bin/clickhouse-extract-from-config to /usr/bin/clickhouse.
Creating clickhouse group if it does not exist.
 groupadd -r clickhouse
Creating clickhouse user if it does not exist.
 useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse clickhouse
Will set ulimits for clickhouse user in /etc/security/limits.d/clickhouse.conf.
Creating config directory /etc/clickhouse-server/config.d that is used for tweaks of main server configuration.
Creating config directory /etc/clickhouse-server/users.d that is used for tweaks of users configuration.
Config file /etc/clickhouse-server/config.xml already exists, will keep it and extract path info from it.
/etc/clickhouse-server/config.xml has /var/lib/clickhouse/ as data path.
/etc/clickhouse-server/config.xml has /var/log/clickhouse-server/ as log path.
Users config file /etc/clickhouse-server/users.xml already exists, will keep it and extract users info from it.
 chown --recursive clickhouse:clickhouse '/etc/clickhouse-server'
Log directory /var/log/clickhouse-server/ already exists.
Data directory /var/lib/clickhouse/ already exists.
Pid directory /var/run/clickhouse-server already exists.
 chown --recursive clickhouse:clickhouse '/var/log/clickhouse-server/'
 chown --recursive clickhouse:clickhouse '/var/run/clickhouse-server'
 chown clickhouse:clickhouse '/var/lib/clickhouse/'
 groupadd -r clickhouse-bridge
 useradd -r --shell /bin/false --home-dir /nonexistent -g clickhouse-bridge clickhouse-bridge
 chown --recursive clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-odbc-bridge'
 chown --recursive clickhouse-bridge:clickhouse-bridge '/usr/bin/clickhouse-library-bridge'
Password for default user is empty string. See /etc/clickhouse-server/users.xml and /etc/clickhouse-server/users.d to change it.
Setting capabilities for clickhouse binary. This is optional.

ClickHouse has been successfully installed.

Start clickhouse-server with:
 sudo clickhouse start

Start clickhouse-client with:
 clickhouse-client

Created symlink from /etc/systemd/system/multi-user.target.wants/clickhouse-server.service to /etc/systemd/system/clickhouse-server.service.
  正在更新    : clickhouse-client-21.9.4.35-2.noarch                                                                                                                                                                                 3/7 
  清理        : clickhouse-client-20.8.3.18-1.el7.x86_64                                                                                                                                                                             4/7 
  清理        : clickhouse-server-20.8.3.18-1.el7.x86_64                                                                                                                                                                             5/7 
  正在删除    : clickhouse-server-common-20.8.3.18-1.el7.x86_64                                                                                                                                                                      6/7 
  清理        : clickhouse-common-static-20.8.3.18-1.el7.x86_64                                                                                                                                                                      7/7 
  验证中      : clickhouse-server-21.9.4.35-2.noarch                                                                                                                                                                                 1/7 
  验证中      : clickhouse-client-21.9.4.35-2.noarch                                                                                                                                                                                 2/7 
  验证中      : clickhouse-common-static-21.9.4.35-2.x86_64                                                                                                                                                                          3/7 
  验证中      : clickhouse-common-static-20.8.3.18-1.el7.x86_64                                                                                                                                                                      4/7 
  验证中      : clickhouse-server-20.8.3.18-1.el7.x86_64                                                                                                                                                                             5/7 
  验证中      : clickhouse-server-common-20.8.3.18-1.el7.x86_64                                                                                                                                                                      6/7 
  验证中      : clickhouse-client-20.8.3.18-1.el7.x86_64                                                                                                                                                                             7/7 

已安装:
  clickhouse-server.noarch 0:21.9.4.35-2                                                                                                                                                                                                 

更新完毕:
  clickhouse-client.noarch 0:21.9.4.35-2                                                                          clickhouse-common-static.x86_64 0:21.9.4.35-2                                                                         

替代:
  clickhouse-server-common.x86_64 0:20.8.3.18-1.el7                                                                                                                                                                                      
完毕!

5、启动验证

为防止不同版本配置文件有差别,将旧的配置文件内容一条条复制到新的配置文件中,然后重新启动节点。
systemctl start clickhouse-server
systemctl status clickhouse-server

ps -ef | grep clickhouse-server
clickhouse-watchdog
/usr/bin/clickhouse-server 

总结

整体升级过程比较简单,每个节点都要按照如上步骤进行升级重启,最后进行验证

你可能感兴趣的:(clickhouse 版本由20.8.3升级最新版本21.9.4)