赞
踩
mkdir -p /opt/software/clickhouse/
cd /opt/software/clickhouse/
rpm -ivh clickhouse-server-common-19.3.6-1.el7.x86_64.rpm
rpm -ivh clickhouse-common-static-19.3.6-1.el7.x86_64.rpm
rpm -ivh clickhouse-server-19.3.6-1.el7.x86_64.rpm
rpm -ivh clickhouse-test-19.3.6-1.el7.x86_64.rpm
rpm -ivh clickhouse-client-19.3.6-1.el7.x86_64.rpm
systemctl stop firewalld //停止firewall
systemctl disable firewalld //精致firewall开机启动
vi /etc/clickhouse-server/config.xml
/etc/clickhouse-server/config.xml
,找到这个代码快listen specified host
,放开注释即可,修改之后的内容如下:vi /etc/clickhouse-server/users.xml
vi /etc/clickhouse-server/config.xml
三个节点全部按照上面的知道部署单节点成功后开始配置部署集群需要的配置
<?xml version="1.0"?> <yandex> <clickhouse_remote_servers> <perftest_3shards_1replicas> <shard> <internal_replication>true</internal_replication> <replica> <host>dataqin01</host> <port>9000</port> </replica> </shard> <shard> <replica> <internal_replication>true</internal_replication> <host>dataqin02</host> <port>9000</port> </replica> </shard> <shard> <internal_replication>true</internal_replication> <replica> <host>dataqin03</host> <port>9000</port> </replica> </shard> </perftest_3shards_1replicas> </clickhouse_remote_servers> <!--zookeeper相关配置--> <zookeeper-servers> <node index="1"> <host>dataqin01</host> <port>2182</port> </node> <node index="2"> <host>dataqin02</host> <port>2182</port> </node> <node index="3"> <host>dataqin03</host> <port>2182</port> </node> </zookeeper-servers> <macros> <replica>dataqin03</replica> </macros> <networks> <ip>::/0</ip> </networks> <clickhouse_compression> <case> <min_part_size>10000000000</min_part_size> <min_part_size_ratio>0.01</min_part_size_ratio> <method>lz4</method> </case> </clickhouse_compression> </yandex>
注意 : 为什么直接vi /etc/metrika.xml
一个新文件,这里很难去理解,有点莫名其妙,其实如果仔细看过clickhouse的配置文件 /etc/clickhouse-server/config.xml就能明白,有那么一段被注释的配置说明:
<!-- If element has 'incl' attribute, then for it's value will be used corresponding substitution from another file.
By default, path to file with substitutions is /etc/metrika.xml. It could be changed in config in 'include_from' element.
Values for substitutions are specified in /yandex/name_of_substitution elements in that file.
-->
配置一个节点完成之后,将/etc/metrika.xml
文件scp到其他两个节点并配置
<macros>
<replica>dataqin01</replica>
</macros>
在每个节点上启动clickhouse客户端,和单节点启动完全一样
/etc/init.d/clickhouse-server start
clickhouse-client –m
select * from system.clusters;
(三个节点都会如下图所示)/etc/init.d/clickhouse-server start
上述内容完成,则clickhouse集群配置完成。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。