Host | System OS | 硬件配置 |
---|---|---|
10.196.17.57 | Centos 7.8.2003 | 32Core,64G |
10.196.17.58 | Centos 7.8.2003 | 32Core,64G |
10.196.17.60 | Centos 7.8.2003 | 32Core,64G |
zookeeper-3.4.9.tar.gz算法
推薦使用yum安裝方式,此處按解壓安裝方式部署vim
教程參考官文:Clickhouse-installbash
tar -zxvf clickhouse-common-static-21.7.6.39.tgz
tar -zxvf clickhouse-server-21.7.6.39.tgz
tar -zxvf clickhouse-client-21.7.6.39.tgz
複製代碼
sudo clickhouse-client-21.7.6.39/install/doinst.sh
sudo clickhouse-common-static-21.7.6.39/install/doinst.sh
sudo clickhouse-server-21.7.6.39/install/doinst.sh
複製代碼
/etc/clickhouse-server/config.xml
文件[root@hadoop-prod-datanode5 clickhouse-server]# vim /etc/clickhouse-server/config.xml
因爲我這邊9000端口號被其餘服務佔用,故把端口號更改成9999
<tcp_port>9999</tcp_port>
放開該配置
<listen_host>::</listen_host>
複製代碼
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.markdown
能夠發現Clickhouse默認使用/etc/metrika.xml配置文件,用默認路徑也能夠,若是你跟我同樣但願自定義配置文件路徑,請新增以下配置app
<include_from>/etc/clickhouse-server/config.d/metrika.xml</include_from>
複製代碼
/etc/clickhouse-server/config.d/metrika.xml
文件,黏貼以下內容:<yandex>
<!--ck集羣節點-->
<remote_servers>
<test_ck_cluster>
<!--分片1-->
<shard>
<weight>1</weight>
<internal_replication>false</internal_replication>
<replica>
<host>10.196.17.57</host>
<port>9999</port>
<user>default</user>
<password></password>
<compression>true</compression>
</replica>
<replica>
<host>10.196.17.58</host>
<port>9999</port>
<user>default</user>
<password></password>
<compression>true</compression>
</replica>
</shard>
<!--分片2-->
<shard>
<weight>1</weight>
<internal_replication>false</internal_replication>
<replica>
<host>10.196.17.60</host>
<port>9999</port>
<user>default</user>
<password></password>
<compression>true</compression>
</replica>
<replica>
<host>10.196.17.58</host>
<port>9999</port>
<user>default</user>
<password></password>
<compression>true</compression>
</replica>
</shard>
<!--分片3-->
<shard>
<weight>1</weight>
<internal_replication>false</internal_replication>
<replica>
<host>10.196.17.60</host>
<port>9999</port>
<user>default</user>
<password></password>
<compression>true</compression>
</replica>
<replica>
<host>10.196.17.58</host>
<port>9999</port>
<user>default</user>
<password></password>
<compression>true</compression>
</replica>
</shard>
</test_ck_cluster>
</remote_servers>
<!--zookeeper相關配置-->
<zookeeper>
<node index="1">
<host>10.196.17.26</host>
<port>2181</port>
</node>
<node index="2">
<host>10.196.17.27</host>
<port>2181</port>
</node>
<node index="3">
<host>10.196.17.28</host>
<port>2181</port>
</node>
</zookeeper>
<macros>
<replica>10.196.17.58</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> <!--壓縮算法lz4壓縮比zstd快, 更佔磁盤-->
</case>
</clickhouse_compression>
</yandex>
複製代碼
三個節點配置文件區別tcp
<macros>
<replica>10.196.17.58</replica> <!--當前節點主機名-->
</macros>
複製代碼
若是你不清楚不少配置選項是作什麼的,請打開ClickhouseDocument文檔翻閱相關內容。oop
若是此頁面沒有找到你想搜尋的配置,請複製配置到搜索框中搜索
參考知乎博主文章
CSDN
[root@hadoop-prod-datanode4 clickhouse-server]# clickhouse-client --port 9999
複製代碼
我是由於修改了端口號,若是你使用默認9000,那麼直接clickhouse-client
便可,進入後輸入
select * from system.clusters;
複製代碼
如今幾點?開心一點~