当前位置: 首页>后端>正文

clickhouse 升级操作记录

  1. 上传新版rpm安装包

clickhouse rpm官方地址
https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/
使用清华镜像下载
https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/
使用阿里云镜像下载
https://developer.aliyun.com/mirror/clickhouse
下载
找到类似这几个开头的
clickhouse-client-22.2.2.1-2.noarch.rpm

clickhouse-common-static-22.2.2.1-2.x86_64.rpm

clickhouse-server-22.2.2.1-2.noarch.rpm

https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64/clickhouse-client-22.2.2.1-2.noarch.rpm

https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64/clickhouse-common-static-22.2.2.1-2.x86_64.rpm

https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64/clickhouse-server-22.2.2.1-2.noarch.rpm

  1. 停止原先clickhouse服务
systemctl stop clickhouse-server

查看进程号

ps -ef | grep clickhouse

杀死所有clickhouse进程

kill -9 xxxx
  1. 备份配置文件
cd /etc/clickhouse-server 

cp config.xml config.xml.bak

cp users.xml users.xml.bak

备份数据
/var/lib/clickhouse/data
稳妥的话可以整个目录备份
/var/lib/clickhouse/

  1. 查看安装列表
yum list | grep clickhouse
  1. 依次卸载显示的组件
yum remove -y clickhouse-client.noarch

yum remove -y clickhouse-common-static.x86_64

yum remove -y clickhouse-server.noarch
 
  1. 安装新版本
# 进入存放安装包的路径
yum install -y *rpm
  1. 恢复配置文件
cd /etc/clickhouse-server 
cp config.xml.bak config.xml #注意文件权限对clickhouse用户开放

cp users.xml.bak users.xml #注意文件权限对clickhouse用户开放
   chown -R clickhouse /var/log/clickhouse-server/  # 注意刷新日志权限
  chmod 777 -R /var/lib/clickhouse/ # /data/clickhouse 配置数据等文件的路径需要开放读写执行权限。
  1. 启动服务
systemctl start clickhouse-server

检查服务

systemctl status clickhouse-server

日志位置
/var/log/clickhouse-server
数据位置
/var/lib/clickhouse/


https://www.xamrdz.com/backend/3n91942715.html

相关文章: