欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

ClickHouse报错:Code:210.DB::NetException:Connectionrefused

时间:2023-05-01

TNND,我是真的服了,估计玩阿里云集群的兄弟,都会遇到这个个问题。

首先我们来看启动信息:

[root@hadoop101 ~]# clickhouse-client -m ClickHouse client version 20.4.5.36 (official build).Connecting to localhost:9000 as user default.Code: 210、DB::NetException: Connection refused (localhost:9000)

从上面看,完全看不出问题,别信网上说的什么端口占用、进程没关

直接开日志

[root@hadoop101 clickhouse-server]# tail -f clickhouse-server.log

我们截取ERROR日志信息

2022.02.14 17:32:43.642826 [ 2396 ] {} Application: starting up2022.02.14 17:32:43.646257 [ 2396 ] {} Application: rlimit on number of file descriptors is 5000002022.02.14 17:32:43.646274 [ 2396 ] {} Application: Initializing DateLUT.2022.02.14 17:32:43.646282 [ 2396 ] {} Application: Initialized DateLUT with time zone 'Asia/Shanghai'.2022.02.14 17:32:43.646304 [ 2396 ] {} Application: Setting up /var/lib/clickhouse/tmp/ to store temporary data in it2022.02.14 17:32:43.646484 [ 2396 ] {} Application: Configuration parameter 'interserver_http_host' doesn't exist or exists and empty、Will use 'hadoop101' as replica host.2022.02.14 17:32:43.648321 [ 2396 ] {} ConfigReloader: Loading config '/etc/clickhouse-server/users.xml'2022.02.14 17:32:43.649468 [ 2396 ] {} Application: Uncompressed cache size was lowered to 3.75 GiB because the system has low amount of memory2022.02.14 17:32:43.649689 [ 2396 ] {} Application: Mark cache size was lowered to 3.75 GiB because the system has low amount of memory2022.02.14 17:32:43.649726 [ 2396 ] {} Application: Setting max_server_memory_usage was set to 6.75 GiB2022.02.14 17:32:43.649734 [ 2396 ] {} Application: Loading metadata from /var/lib/clickhouse/2022.02.14 17:32:43.651423 [ 2396 ] {} DatabaseOrdinary (system): Total 2 tables and 0 dictionaries.2022.02.14 17:32:43.656837 [ 2401 ] {} BackgroundProcessingPool: Create BackgroundProcessingPool with 16 threads2022.02.14 17:32:43.657703 [ 2401 ] {} system.metric_log: Loading data parts2022.02.14 17:32:43.663843 [ 2401 ] {} system.metric_log: Loaded data parts (2 items)2022.02.14 17:32:43.664195 [ 2401 ] {} system.trace_log: Loading data parts2022.02.14 17:32:43.664937 [ 2401 ] {} system.trace_log: Loaded data parts (3 items)2022.02.14 17:32:43.665026 [ 2396 ] {} DatabaseOrdinary (system): Starting up tables.2022.02.14 17:32:43.665941 [ 2396 ] {} DatabaseOrdinary (default): Total 0 tables and 0 dictionaries.2022.02.14 17:32:43.665958 [ 2396 ] {} DatabaseOrdinary (default): Starting up tables.2022.02.14 17:32:43.666002 [ 2396 ] {} BackgroundSchedulePool/BgSchPool: Create BackgroundSchedulePool with 16 threads2022.02.14 17:32:43.666800 [ 2396 ] {} Application: Loaded metadata.2022.02.14 17:32:43.666835 [ 2396 ] {} Pipe: Pipe capacity is 1.00 MiB2022.02.14 17:32:43.668407 [ 2396 ] {} Application: Shutting down storages.2022.02.14 17:32:43.668460 [ 2420 ] {} SystemLog (system.trace_log): Flushing system log2022.02.14 17:32:43.668545 [ 2420 ] {} SystemLog (system.trace_log): Will use existing table system.trace_log for TraceLog2022.02.14 17:32:43.668793 [ 2420 ] {} DiskLocal: Reserving 1.00 MiB on disk `default`, having unreserved 26.30 GiB.2022.02.14 17:32:43.669562 [ 2420 ] {} system.trace_log: Renaming temporary part tmp_insert_202202_1_1_0 to 202202_19_19_0.2022.02.14 17:32:44.665383 [ 2421 ] {} SystemLog (system.metric_log): Flushing system log2022.02.14 17:32:44.665754 [ 2421 ] {} SystemLog (system.metric_log): Will use existing table system.metric_log for MetricLog2022.02.14 17:32:44.667693 [ 2421 ] {} DiskLocal: Reserving 1.00 MiB on disk `default`, having unreserved 26.30 GiB.2022.02.14 17:32:44.668659 [ 2421 ] {} system.metric_log: Renaming temporary part tmp_insert_202202_1_1_0 to 202202_71_71_0.2022.02.14 17:32:44.669585 [ 2396 ] {} BackgroundSchedulePool/BgSchPool: Waiting for threads to finish.2022.02.14 17:32:44.669831 [ 2396 ] {} Application: Shut down storages.2022.02.14 17:32:44.670359 [ 2396 ] {} Application: Destroyed global context.2022.02.14 17:32:44.670824 [ 2396 ] {} Application: DB::Exception: Listen [::]:8123 failed: Poco::Exception、Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: -9 (version 20.4.5.36 (official build))2022.02.14 17:32:44.670847 [ 2396 ] {} Application: shutting down2022.02.14 17:32:44.670853 [ 2396 ] {} Application: Uninitializing subsystem: Logging Subsystem2022.02.14 17:32:44.670904 [ 2399 ] {} baseDaemon: Received signal -22022.02.14 17:32:44.670925 [ 2399 ] {} baseDaemon: Stop SignalListener thread

提取关键信息:

2022.02.14 17:32:44.670824 [ 2396 ] {} Application: DB::Exception: Listen [::]:8123 failed: Poco::Exception、Code: 1000, e.code() = 0, e.displayText() = DNS error: EAI: -9 (version 20.4.5.36 (official build))

他说连接不上这个端口,好了,我们一般到这就是去查看端口了,结构netstat一看,没被占用,就迷茫了。

重点:我们看配置文件就知道了

0.0.0.0

从上面我们可以看得到,他说你要是用IPV6网络格式的话,就不能用

::

必须的是

0.0.0.0

改好之后,重启一下就好了,主要原因还是你云服务器没开IPV6,应该是这样吧。

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。