栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

docker部署Clickhouse集群遇到的坑--第一部

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

docker部署Clickhouse集群遇到的坑--第一部

项目场景: 在使用docker部署Clickhouse集群时,遇到的各种坑 问题一

``执行select * from system.clusters;查看集群信息,没有显示出集群信息,说明分布式集群搭建失败,如以下图1:

┌─cluster───────────────────────────┬─shard_num─┬─replica_num─┬─host_name─┬─port─┬─user────┐
 default │
1 │ test_cluster_two_shards           │         1 │           1 │ 127.0.0.1 │ 9000 │ default │
2 │ test_cluster_two_shards           │         2 │           1 │ 127.0.0.2 │ 9000 │ default │
3 │ test_cluster_two_shards_localhost │         1 │           1 │ localhost │ 9000 │ default │
4 │ test_cluster_two_shards_localhost │         2 │           1 │ localhost │ 9000 │ default │
5 │ test_shard_localhost              │         1 │           1 │ localhost │ 9000 │ default │
6 │ test_shard_localhost_secure       │         1 │           1 │ localhost │ 9440 │ default │
7 │ test_unavailable_shard            │         1 │           1 │ localhost │ 9000 │ default │
8 │ test_unavailable_shard            │         2 │           1 │ localhost │    1 │ default │
9 └───────────────────────────────────┴───────────┴─────────────┴───────────┴──────┴───────

原因分析:

看了下资料中显示的集群信息是要有集群名,集群节点ip等信息的,而不是以上只显示出单机信息:

例如:以下图2为正确的,其中perf_3s_1r是集群的名字,在/etc/metrika.xml里面设置`┌─cluster───────────────────────────┬─shard_num─┬─replica_num─┬─host_name─┬─port─┬─user────┐
1 │ perf_3s_1r │ 1 │ 1 │ master │ 9000 │ default │
2 │ perf_3s_1r │ 2 │ 1 │ slaver1 │ 9000 │ default │
3 │ perf_3s_1r │ 3 │ 1 │ slaver2 │ 9000 │ default │
4 │ test_cluster_two_shards │ 1 │ 1 │ 127.0.0.1 │ 9000 │ default │
5 │ test_cluster_two_shards │ 2 │ 1 │ 127.0.0.2 │ 9000 │ default │
6 │ test_cluster_two_shards_localhost │ 1 │ 1 │ localhost │ 9000 │ default │
7 │ test_cluster_two_shards_localhost │ 2 │ 1 │ localhost │ 9000 │ default │
8 │ test_shard_localhost │ 1 │ 1 │ localhost │ 9000 │ default │
9 │ test_shard_localhost_secure │ 1 │ 1 │ localhost │ 9440 │ default │
10 │ test_unavailable_shard │ 1 │ 1 │ localhost │ 9000 │ default │
11 │ test_unavailable_shard │ 2 │ 1 │ localhost │ 1 │ default │
└───────────────────────────────────┴───────────┴─────────────┴–仔细分析,现在的现象就是集群配置没有生效。clickhouse应该是通过config.xml文件加载集群配置,看了这篇文章后,幡然醒悟:https://www.cnblogs.com/fkdby/articles/15242373.html 链接可能已经失效,暂时只贴出config.xml的关键信息:

/etc/metrika-node1.xml



从这里面可以看出,config.xml是通过以上配置和metrika.xml文件进行联动,以下贴出部分metrika.xml的配置,clickhouse_remote_servers、 zookeeper-servers、macros命名要与metrika.xml中一致:







true

ch201
9000




true
ch202
9000



true

ch203
9000








ch201
2181


ch202
2181


ch203
2181




ch203



::/0




10000000000
0.01
lz4






ch201


解决方案:

在config.xml里添加以下配置,请在集群每台节点上添加:

/etc/metrika-node1.xml



搭建参考1
集群信息未显示参考2

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/756888.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号