其他分享
首页 > 其他分享> > clickhouse 自动化分发安装及配置脚本

clickhouse 自动化分发安装及配置脚本

作者:互联网

1.准备安装包及安装部署脚本到httpd下载服务器路径下

2.安装脚本

cat install_clickhouse.sh 
#!bin/bash


mkdir -p /opt/clickhouse

cd /opt/clickhouse

wget  http://192.168.10.111:8080/clickhouse/clickhouse-client-21.9.7.2-2.noarch.rpm
wget  http://192.168.10.111:8080/clickhouse/clickhouse-common-static-21.9.7.2-2.x86_64.rpm
wget  http://192.168.10.111:8080/clickhouse/clickhouse-common-static-dbg-21.9.7.2-2.x86_64.rpm
wget  http://192.168.10.111:8080/clickhouse/clickhouse-server-21.9.7.2-2.noarch.rpm

rpm -ivh *.rpm

3.配置脚本

cat set_conf.sh 
#!bin/bash
##变量传参 分片编号  副本编号

cd /etc/clickhouse-server/

mv config.xml config_tmp.xml && wget -P /etc/clickhouse-server http://192.168.10.111:8080/clickhouse/config.xml 
sed -i "s/sdnum/${1}/" /etc/clickhouse-server/config.xml
sed -i "s/rpnum/${2}/" /etc/clickhouse-server/config.xml

host_ips=`hostname -i` 

host_ip=`echo ${host_ips}`
sed -i "s/host_ip/${host_ip}/" /etc/clickhouse-server/config.xml



chown clickhouse:clickhouse config.xml

mv users.xml users_tmp.xml && wget -P /etc/clickhouse-server http://192.168.10.111:8080/clickhouse/users.xml && chown clickhouse:clickhouse users.xml

cd /data

mkdir clickhouse && chown clickhouse:clickhouse clickhouse

systemctl start clickhouse-server.service

systemctl status clickhouse-server.service 

4.在待部署节点执行

在所有待安装集群节点下载安装包

wget -P /tmp/ http://192.168.10.111:8080/clickhouse/install_clickhouse.sh  && sh /tmp/install_clickhouse.sh

修改配置文件并启动服务

变量传参 分片编号  副本编号
wget -P /tmp/ http://192.168.10.111:8080/clickhouse/set_conf.sh  && sh /tmp/set_conf.sh 5 01
wget -P /tmp/ http://192.168.10.111:8080/clickhouse/set_conf.sh  && sh /tmp/set_conf.sh 5 02

标签:xml,分发,10.111,192.168,server,sh,自动化,clickhouse
来源: https://www.cnblogs.com/whiteY/p/16636814.html