clickhouse版本升级-保留数据

it2025-12-29  3

操作准备

版本升级 > 19.11.7.40 升级到 20.9.2.20 系统版本 > CentOS Linux release 7.4.1708 (Core) ( #cat /etc/redhat-release) 显示命令:> yum list installed 'clickhouse*' 卸载命令: > yum -y remove .... 安装命令: > sudo yum -y localinstall clickhouse-*.rpm

升级流程

下载新版本文件(配置文件需要安装后获取并配置) 下载地址: https://mirrors.tuna.tsinghua.edu.cn/clickhouse/ -rw-r--r-- 1 root root 126272 10月 22 14:07 clickhouse-client-20.9.2.20-2.noarch.rpm -rw-r--r-- 1 root root 141936506 10月 22 14:07 clickhouse-common-static-20.9.2.20-2.x86_64.rpm -rw-r--r-- 1 root root 1574898417 10月 22 14:07 clickhouse-common-static-dbg-20.9.2.20-2.x86_64.rpm -rw-r--r-- 1 root root 150248 10月 22 14:07 clickhouse-server-20.9.2.20-2.noarch.rpm -rw-r--r-- 1 root root 33788 10月 22 14:09 config.xml -rw-r--r-- 1 root root 1981 10月 22 14:09 metrika.xml -rw-r--r-- 1 root root 6400 10月 22 14:07 users.xml 老系统关闭命令:

sudo /etc/init.d/clickhouse-server stop 建议:备份老系统配置文件

升级命令:(在新版本rpm包目录下)

yum upgrade *.rpm -y

1回滚命令(如果升级失败 可以进行回滚操作)

/etc/init.d/clickhouse-server stop yum downgrade clickhouse-server-common-18.14.15-1.el7.x86_64 clickhouse-server-18.14.15-1.el7.x86_64 clickhouse-common-static-18.14.15-1.el7.x86_64 clickhouse-client-18.14.15-1.el7.x86_64 -y

替换配置文件后启动

新系统启动命令

sudo systemctl start clickhouse-server sudo systemctl stop clickhouse-server sudo systemctl status clickhouse-server

操作过程中的问题

使用sudo /etc/init.d/clickhouse-server restart 启动命令 报错:Init script is already running 只能使用命令 sudo systemctl start clickhouse-server https://github.com/ClickHouse/ClickHouse/issues/14861 升级后,把19的配置文件选项 逐步复制到20.9.2.20版本的配置文件 启动报错 2020.10.21 17:57:48.758439 [ 114835 ] {} <Error> Application: DB::Exception: A setting 'max_query_size' appeared at top level in config /etc/clickhouse-server/config.xml. But it is user-level setting that should be located in users.xml inside <profiles> section for specific profile. You can add it to <profiles><default> if you want to change default value of this setting. You can also disable the check - specify <skip_check_for_incorrect_settings>1</skip_check_for_incorrect_settings> in the main configuration file. 需要下config.xml中取消配置项 max_query_size
最新回复(0)