Clickhouse 连接被拒绝
Clickhouse connection refuse
我在通过 8123 端口通过 http 连接到 clickhouse-server 时遇到问题。所有参数都是默认的。
Status: Downloaded newer image for yandex/clickhouse-server:latest
Include not found: clickhouse_remote_servers
Include not found: clickhouse_compression
2017.11.09 13:05:37.975332 [ 1 ] <Warning> Application: Logging to console
2017.11.09 13:05:37.978638 [ 1 ] <Information> : Starting daemon with revision 54310
2017.11.09 13:05:37.978733 [ 1 ] <Information> Application: starting up
2017.11.09 13:05:37.979947 [ 1 ] <Debug> Application: rlimit on number of file descriptors is 1048576
2017.11.09 13:05:37.979979 [ 1 ] <Debug> Application: Initializing DateLUT.
2017.11.09 13:05:37.980015 [ 1 ] <Trace> Application: Initialized DateLUT with time zone Zulu'.
2017.11.09 13:05:37.980651 [ 1 ] <Debug> Application: Configuration parameter 'interserver_http_host' doesn't exist or exists and empty. Will use 'c9a1a0a75b97' as replica host.
2017.11.09 13:05:37.980783 [ 1 ] <Debug> ConfigReloader: Loading config /etc/clickhouse-server/users.xml'
2017.11.09 13:05:37.983605 [ 1 ] <Warning> ConfigProcessor: Include not found: networks
2017.11.09 13:05:37.983633 [ 1 ] <Warning> ConfigProcessor: Include not found: networks
2017.11.09 13:05:37.984168 [ 1 ] <Information> Application: Loading metadata.
2017.11.09 13:05:37.984738 [ 1 ] <Information> DatabaseOrdinary (default): Total 0 tables.
2017.11.09 13:05:37.984766 [ 1 ] <Information> DatabaseOrdinary (default): Starting up tables.
2017.11.09 13:05:37.984999 [ 1 ] <Debug> Application: Loaded metadata.
2017.11.09 13:05:37.985454 [ 1 ] <Information> Application: Listening http://0.0.0.0:8123
2017.11.09 13:05:37.987644 [ 1 ] <Information> Application: Listening tcp: 0.0.0.0:9000
2017.11.09 13:05:37.987692 [ 1 ] <Information> Application: Listening interserver: 0.0.0.0:9009
2017.11.09 13:05:37.988186 [ 1 ] <Information> Application: Available RAM = 1.95 GiB; physical cores = 4; threads = 4.
2017.11.09 13:05:37.988212 [ 1 ] <Information> Application: Ready for connections.
2017.11.09 13:05:39.980980 [ 2 ] <Debug> ConfigReloader: Loading config /etc/clickhouse-server/config.xml'
2017.11.09 13:05:39.985393 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_remote_servers
2017.11.09 13:05:39.985462 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_compression
$ curl 'http://localhost:8123/'
curl: (7) Failed to connect to localhost port 8123: Connection refused
请帮我解决这个问题。
UPD
如果您不想更改网络类型,一个好的解决方案是将容器的端口发布到主机。可以使用 -p HOST_PORT:CONTAINER_PORT
参数来完成。在您的情况下,它将是 -p 8123:8123
。一个例子:
docker run -d --name clickhouse-server --ulimit nofile=262144:262144 -p 8123:8123 yandex/clickhouse-server
原回答
似乎有一个 docker 容器连接到您无法从您的主机访问的网络。尝试启动带有 --net=host
标志的图像。然后,运行又是curl
。
有关 docker 网络类型及其功能的其他信息,请参见 official documentation
首先检查你的 clickhouse-server 是否正确 运行ning 或者没有使用这个命令:
sudo lsof -i :8123
您应该能够看到类似的输出:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
clickhous 8752 root 9u IPv6 38265 0t0 TCP ip6-localhost:8123 (LISTEN)
clickhous 8752 root 12u IPv4 38268 0t0 TCP localhost:8123 (LISTEN)
确保位于 /etc/clickhouse-server
的 config.xml 文件中包含这些条目
<listen_host>::1</listen_host>
<!-- Localhost Binding -->
<listen_host>127.0.0.1</listen_host>
<!-- Remote Access Binding -->
<listen_host>< IP / URL></listen_host>
一旦您确定这些条目存在,运行这些命令将重新启动您的服务器:
cd /usr/bin
sudo ./clickhouse-server --config /etc/clickhouse-server/config.xml &
再次执行 sudo lsof -i :8123
以查看您的 clickhouse-server 是否正在监听该端口。
我在通过 8123 端口通过 http 连接到 clickhouse-server 时遇到问题。所有参数都是默认的。
Status: Downloaded newer image for yandex/clickhouse-server:latest
Include not found: clickhouse_remote_servers
Include not found: clickhouse_compression
2017.11.09 13:05:37.975332 [ 1 ] <Warning> Application: Logging to console
2017.11.09 13:05:37.978638 [ 1 ] <Information> : Starting daemon with revision 54310
2017.11.09 13:05:37.978733 [ 1 ] <Information> Application: starting up
2017.11.09 13:05:37.979947 [ 1 ] <Debug> Application: rlimit on number of file descriptors is 1048576
2017.11.09 13:05:37.979979 [ 1 ] <Debug> Application: Initializing DateLUT.
2017.11.09 13:05:37.980015 [ 1 ] <Trace> Application: Initialized DateLUT with time zone Zulu'.
2017.11.09 13:05:37.980651 [ 1 ] <Debug> Application: Configuration parameter 'interserver_http_host' doesn't exist or exists and empty. Will use 'c9a1a0a75b97' as replica host.
2017.11.09 13:05:37.980783 [ 1 ] <Debug> ConfigReloader: Loading config /etc/clickhouse-server/users.xml'
2017.11.09 13:05:37.983605 [ 1 ] <Warning> ConfigProcessor: Include not found: networks
2017.11.09 13:05:37.983633 [ 1 ] <Warning> ConfigProcessor: Include not found: networks
2017.11.09 13:05:37.984168 [ 1 ] <Information> Application: Loading metadata.
2017.11.09 13:05:37.984738 [ 1 ] <Information> DatabaseOrdinary (default): Total 0 tables.
2017.11.09 13:05:37.984766 [ 1 ] <Information> DatabaseOrdinary (default): Starting up tables.
2017.11.09 13:05:37.984999 [ 1 ] <Debug> Application: Loaded metadata.
2017.11.09 13:05:37.985454 [ 1 ] <Information> Application: Listening http://0.0.0.0:8123
2017.11.09 13:05:37.987644 [ 1 ] <Information> Application: Listening tcp: 0.0.0.0:9000
2017.11.09 13:05:37.987692 [ 1 ] <Information> Application: Listening interserver: 0.0.0.0:9009
2017.11.09 13:05:37.988186 [ 1 ] <Information> Application: Available RAM = 1.95 GiB; physical cores = 4; threads = 4.
2017.11.09 13:05:37.988212 [ 1 ] <Information> Application: Ready for connections.
2017.11.09 13:05:39.980980 [ 2 ] <Debug> ConfigReloader: Loading config /etc/clickhouse-server/config.xml'
2017.11.09 13:05:39.985393 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_remote_servers
2017.11.09 13:05:39.985462 [ 2 ] <Warning> ConfigProcessor: Include not found: clickhouse_compression
$ curl 'http://localhost:8123/'
curl: (7) Failed to connect to localhost port 8123: Connection refused
请帮我解决这个问题。
UPD
如果您不想更改网络类型,一个好的解决方案是将容器的端口发布到主机。可以使用 -p HOST_PORT:CONTAINER_PORT
参数来完成。在您的情况下,它将是 -p 8123:8123
。一个例子:
docker run -d --name clickhouse-server --ulimit nofile=262144:262144 -p 8123:8123 yandex/clickhouse-server
原回答
似乎有一个 docker 容器连接到您无法从您的主机访问的网络。尝试启动带有 --net=host
标志的图像。然后,运行又是curl
。
有关 docker 网络类型及其功能的其他信息,请参见 official documentation
首先检查你的 clickhouse-server 是否正确 运行ning 或者没有使用这个命令:
sudo lsof -i :8123
您应该能够看到类似的输出:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
clickhous 8752 root 9u IPv6 38265 0t0 TCP ip6-localhost:8123 (LISTEN)
clickhous 8752 root 12u IPv4 38268 0t0 TCP localhost:8123 (LISTEN)
确保位于 /etc/clickhouse-server
的 config.xml 文件中包含这些条目<listen_host>::1</listen_host>
<!-- Localhost Binding -->
<listen_host>127.0.0.1</listen_host>
<!-- Remote Access Binding -->
<listen_host>< IP / URL></listen_host>
一旦您确定这些条目存在,运行这些命令将重新启动您的服务器:
cd /usr/bin
sudo ./clickhouse-server --config /etc/clickhouse-server/config.xml &
再次执行 sudo lsof -i :8123
以查看您的 clickhouse-server 是否正在监听该端口。