1. 环境准备
IP | 系统 | 数据库 | 版本 | 内存 | CPU | 磁盘 |
---|---|---|---|---|---|---|
192.168.5.31 | CentOS Linux release 7.6.1810 (Core) | clickhouse | 1.1.54236 | 96GB | 2X16核 | 4X600GB sas raid 10 |
192.168.5.32 | CentOS Linux release 7.6.1810 (Core) | clickhouse | 1.1.54236 | 96GB | 2X16核 | 8X600GB sas raid 10 |
192.168.5.33 | CentOS Linux release 7.6.1810 (Core) | clickhouse | 1.1.54236 | 96GB | 2X16核 | 8X600GB sas raid 10 |
所需包:
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
2. 安装配置clickhouse
2.1 创建用户
useradd -m clickhouse
passwd clickhouse
clickhouse@123
2.2 安装clickhouse软件(root)
#上传clickhouse安装帮到/opt/clickhouse下:
cat /opt/clickhouse/
rpm -ivh clickhouse*
2.3 磁盘规划
su - clickhouse
mkdir -p /home/clickhouse/{log,data}
2.4 修改启动脚本
vim /etc/rc.d/init.d/clickhouse-server
CLICKHOUSE_LOGDIR=/home/clickhouse/log
CLICKHOUSE_LOGDIR_USER=clickhouse
CLICKHOUSE_DATADIR=/home/clickhouse/data
# 修改其中一个,将修改的文件发送到其他两台主机
scp -rp /etc/rc.d/init.d/clickhouse-server 192.168.5.32:/etc/rc.d/init.d/
2.5 修改config.xml配置
注意其中不同sever配置对应不同主机ip地址
修改config.xml中相关内容
vim /etc/clickhouse-server/config.xml
<log>/home/clickhouse/log/clickhouse-server.log</log>
<errorlog>/home/clickhouse/log/clickhouse-server.err.log</errorlog>
<path>/home/clickhouse/data/clickhouse/</path>
<tmp_path>/home/clickhouse/data/clickhouse/tmp/</tmp_path>
<users_config>users.xml</users_config>
<interserver_http_host>192.168.5.31</interserver_http_host>
<listen_host>::1</listen_host>
<listen_host>0.0.0.0</listen_host>
<format_schema_path>/home/clickhouse/data/clickhouse/format_schemas/</format_schema_path>
在<zookeeper incl="zookeeper-servers" optional="true" />上面
添加下面一条
<include_from>/etc/clickhouse-server/metrika.xml</include_from>
--=================================================
<!-- 修改其中一个,将修改的文件发送到其他两台主机,修改本机ip即可 -->
scp -rp /etc/clickhouse-server/config.xml 192.168.5.32:/etc/clickhouse-server/config.xml
<!--给clickhouse-server 所属为clickhouse-->
chown -R clickhouse:clickhouse /var/lock/clickhouse-server
3. 安装配置zookpeer
3.1 安装配置jdk
# 查看Java版本
java –version
#上传jdk1.8.0_271 到 /opt/java/
mkdir -p /opt/java/
#安装jdk1.8.0_271
echo " ">>/etc/profile
echo "# Made