@zhangyy
2021-09-01T16:49:10.000000Z
字数 2712
阅读 142
ClickHouse系列
环境初始化参考单机版环境初始化:
系统: CentOS7.9x64
cat /etc/hosts
----
192.168.100.11 node01.flyfish.cn
192.168.100.12 node02.flyfish.cn
192.168.100.13 node03.flyfish.cn
192.168.100.14 node04.flyfish.cn
192.168.100.15 node05.flyfish.cn
192.168.100.16 node06.flyfish.cn
192.168.100.17 node07.flyfish.cn
192.168.100.18 node08.flyfish.cn
----
本次安装:使用 前面6台虚拟机
集群配置好ansible
vim /etc/ansible/hosts
---
[clickhouse_all]
192.168.100.11
192.168.100.12
192.168.100.13
192.168.100.14
192.168.100.15
192.168.100.16
[clickhouse_node]
192.168.100.12
192.168.100.13
192.168.100.14
192.168.100.15
192.168.100.16
----
ansible clickhouse_node -m ping
系统初始化:
ansible clickhouse_node -m copy -a "src=/root/.bash_profile dest=/root/"
ansible clickhouse_node -m copy -a "src=/etc/security/limits.conf dest=/etc/security/"
ansible clickhouse_node -m copy -a "src=/etc/sysctl.conf dest=/etc/"
ansible clickhouse_node -m copy -a "src=/etc/rc.d/rc.local dest=/etc/rc.d/"
ansible clickhouse_node -m copy -a "src=/etc/localtime dest=/etc/"
创建安装用户:
groupadd -g 60001 clickhouse
useradd -u 61001 -g clickhouse clickhouse
chown -R clickhouse:clickhouse /clickhouse
chmod -R 775 /clickhouse
echo "clickhouse" | passwd --stdin clickhouse
默认启动字符界面:
systemctl set-default multi-user.target
vim /clickhouse/etc/clickhouse-server/config.xml
----
搜索:metrika
<include_from>/clickhouse/etc/clickhouse-server/config.d/metrika.xml</include_from>
----
vim /clickhouse/etc/clickhouse-server/config.d/metrika.xml
---
<?xml version="1.0"?>
<yandex>
<clickhouse_remote_servers>
</clickhouse_remote_servers>
</yandex>
---
----
cp /clickhouse/etc/clickhouse-server/config.d/metrika.xml /clickhouse/etc/clickhouse-server/config.d/metrika9200.xml
vim /clickhouse/etc/clickhouse-server/config9200.xml
----
<include_from>/clickhouse/etc/clickhouse-server/config.d/metrika9200.xml</include_from>
----
测试启动:
杀掉之前的节点:
查看 加载文件:
clickhouse-server --config=/etc/clickhouse-server/config.xml
clickhouse-server --config=/etc/clickhouse-server/config9200.xml
打包节点:
su - clickhouse
cd /clickhouse
tar -zcvf clickhouse.tar.gz app data data9200 etc log log9200
然后同步所有主机:
scp clickhouse.tar.gz clickhouse@192.168.100.12:/clickhouse/
scp clickhouse.tar.gz clickhouse@192.168.100.13:/clickhouse/
scp clickhouse.tar.gz clickhouse@192.168.100.14:/clickhouse/
scp clickhouse.tar.gz clickhouse@192.168.100.16:/clickhouse/
su - clickhosue
cd /clickhouse/
tar -zxvf clickhouse.tar.gz
以root账号授权;(全部主机执行)
/clickhouse/app/clickhouse-common-static/install/doinst.sh
/clickhouse/app/clickhouse-common-static-dbg/install/doinst.sh
/clickhouse/app/clickhouse-server/install/doinst.sh
/clickhouse/app//clickhouse-client/install/doinst.sh
将/clickhouse 目录授权
chown -R clickhouse:clickhouse /clickhouse
```
全部主机:
cd /etc/
rm -rf /etc/clickhouse-*
ln -sf /clickhouse/etc/* .
ls -ld /etc/click*