ClickHouse常见问题——ClickHouseKeeper配置listen_host后不生效

ClickHouseKeeper配置listen_host后不生效

ClickHouseKeeper配置listen_host后不生效

3节点部署ClickHouse集群后,ClickHouse Server执行报错:

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.106:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.107:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.105:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.106:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.107:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.105:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.106:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.107:9181

Poco::Exception. Code: 1000, e.code() = 111, Connection refused (version 25.7.4.11 (official build)), 192.168.0.105:9181

9181端口是ClickHouseKeeper的连接端口,报错原因为ClickHouseServer连接不上ClickHouseKeeper

使用netstat -nap | grep 9181查看9181端口

发现只暴露127.0.0.1本机地址,再使用curl -kv 本机ip:9181

再查看ClickHouseKeeper配置文件,默认配置路径为/etc/clickhouse-keeper/keeper_config.xml

xml 复制代码
<clickhouse>
    <logger>
        <!--日志配置-->
    </logger> 

    <max_connections>4096</max_connections>

    <keeper_server>
            <tcp_port>9181</tcp_port>
            <listen_host>0.0.0.0</listen_host>
            <!-- Must be unique among all keeper serves -->
            <server_id>1</server_id>
        	<!--其他-->
    </keeper_server>

难道是listen_host配置问题?查找官网文档也没说的很详细

官网地址:https://clickhouse.com/docs/zh/guides/sre/keeper/clickhouse-keeper

翻阅代码,发现取的是clickhouse标签下的listen_host标签。

cpp 复制代码
    std::vector<std::string> listen_hosts = DB::getMultipleValuesFromConfig(config(), "", "listen_host"); // 此处第二个参数代表根节点,说明是直接在<Clickhouse>根节点下

    bool listen_try = config().getBool("listen_try", false);
    if (listen_hosts.empty())
    {
        listen_hosts.emplace_back("::1");
        listen_hosts.emplace_back("127.0.0.1");
        listen_try = true;
    }

所以正常应该如下配置

之后systemctl restart clickhouse-keeper重启ClickHouseKeeper

相关推荐
摇滚侠20 小时前
java.lang.RuntimeException: java.lang.OutOfMemoryError
java·开发语言·intellij-idea
sibylyue20 小时前
IDEA cannot resolve method
java·ide·intellij-idea
翻斗花园刘大胆21 小时前
JavaWeb之快递管理系统(完结)
java·开发语言·前端·jvm·spring·servlet·java-ee
熙客1 天前
SpringCloudStream:消息驱动组件
java·分布式·spring cloud·rabbitmq
necessary6531 天前
explain analyze和直接执行SQL时间相差10倍?
数据库
向宇it1 天前
【Mysql知识】Mysql索引相关知识详解
数据库·mysql
西门吹雪@1321 天前
springboot项目添加请求链路追踪日志traceId
java·spring boot·后端
新知图书1 天前
JMeter的定时器
java·jvm·jmeter
智星云算力1 天前
从保存到加载Docker镜像文件操作全图解
java·spring cloud·eureka
文人sec1 天前
性能测试-jmeter13-性能资源指标监控
数据库·测试工具·jmeter·性能优化·模块测试