Upgrade to ClickHouse 20.8 (if version is older than 20.7):


First Stop the ClickHouse server:



systemctl stop clickhouse-server.service

 


Create a tar archive of the data and metadata folders


tar -cvzf clickhouse20.1x.tar /var/lib/clickhouse/data  /var/lib/clickhouse/metadata




uninstall older clickhouse


yum remove clickhouse-client clickhouse-server

download and install latest clickhouse version using following repo add this code in 

vim /etc/yum.repos.d/clickhouse.repo


fllowing are the repo of clickhouse 20.8

[Altinity_clickhouse]
name=Altinity_clickhouse
baseurl=https://packagecloud.io/Altinity/clickhouse/el/7/$basearch
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/Altinity/clickhouse/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[Altinity_clickhouse-source]
name=Altinity_clickhouse-source
baseurl=https://packagecloud.io/Altinity/clickhouse/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/Altinity/clickhouse/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300



yum install clickhouse-client clickhouse-server


download older data from powerrelay server 192.168.54.29

scp root@192.168.54.29:/var/lib/clickhouse20.1.tar ./


delete data and metadata folder in /var/lib/clickhouse

Transfer the archive to the new ClickHouse 20.8 server using scp .

Extract the archive into /var/lib/clickhouse/


tar -xvzf clickhouse20.1.x.tar



change owner of data and metada to clickhouse and change mod to 755 of data and metadata folder


chown -R clickhouse:clickhouse data
chown -R clickhouse:clickhouse metadata
chmod 755 data
chmod 755 metadata


restart clickhouse server using following any command 


sudo /etc/init.d/clickhouse-server restart    or
systemctl restart clickhouse-server.service


 clickhouse is upgraded to 20.8



Upgrade to ClickHouse 23.1:



stop the clickhouse server of 20.8.x version

systemctl stop clickhouse-server.service



Create a tar archive of the data and metadata folders in 20.8.x


tar -cvzf clickhouse20.8.x.tar /var/lib/clickhouse/data  /var/lib/clickhouse/metadata


uninstall older clickhouse


yum remove clickhouse-client clickhouse-server

download and install latest clickhouse version using following repo add this code in 

vim /etc/yum.repos.d/clickhouse.repo



add following repository for latest clickhouse 

[clickhouse-stable]
name=ClickHouse - Stable Repository
baseurl=https://packages.clickhouse.com/rpm/stable/
gpgkey=https://packages.clickhouse.com/rpm/stable/repodata/repomd.xml.key
gpgcheck=0
repo_gpgcheck=1
enabled=1

[clickhouse-lts]
name=ClickHouse - LTS Repository
baseurl=https://packages.clickhouse.com/rpm/lts/
gpgkey=https://packages.clickhouse.com/rpm/lts/repodata/repomd.xml.key
gpgcheck=0
repo_gpgcheck=1
enabled=0



yum install clickhouse-client clickhouse-server


delete data and metadata folder in /var/lib/clickhouse

Transfer the archive to the new ClickHouse 23.1.x server using scp .

Extract the archive into /var/lib/clickhouse/

tar -xvzf clickhouse20.8.x.tar



change owner of data and metada to clickhouse and change mod to 755 of data and metadata folder


chown -R clickhouse:clickhouse data
chown -R clickhouse:clickhouse metadata
chmod 755 data
chmod 755 metadata


restart clickhouse server using following any command 


sudo /etc/init.d/clickhouse-server restart    or
systemctl restart clickhouse-server.service



clickhouse upgradation is complete