【问题标题】:fail to connect to remote clickhouse-server with clickhouse-client无法使用 clickhouse-client 连接到远程 clickhouse-server
【发布时间】:2021-04-29 23:01:27
【问题描述】:

我在 azure VM 上托管了一个 clickhouse 服务器 (我可以在 VM 内运行 clickhouse-client) 使用 nginx 代理,下面是 nginx 设置

      server {
           listen  5000;
           server_name     myhost.cloudapp.azure.com;
           location / {
                   proxy_pass http://localhost:8123;
           }


   server {
           listen  6000;
           server_name     myhost.cloudapp.azure.com;
           location / {
                   proxy_pass http://localhost:9000;
           }
   

我能够以正确的响应卷曲两个端点,例如

curl http://myhost.cloudapp.azure.com:6000                
Port 9000 is for clickhouse-client program.
You must use port 8123 for HTTP.

curl http://myhost.cloudapp.azure.com:5000                
Ok.

但是,当我尝试执行 clickhouse-client -h myhost.cloudapp.azure.com --port 6000 时,我得到以下信息。

 clickhouse-client -h myhost.cloudapp.azure.com --port 6000
 ClickHouse client version 21.1.2.15 (official build).
 Connecting to myhost.cloudapp.azure.com:6000 as user default.
 Code: 102. DB::NetException: Unexpected packet from server bs- 
 clickhouse.westeurope.cloudapp.azure.com:6000 (expected Hello or Exception, got Unknown packet)

clickhouse-server的连接设置如下:

<listen_host>::</listen_host>

我不知道我做错了什么,感谢任何提示。

【问题讨论】:

标签: clickhouse


【解决方案1】:

9000 -- tcp 协议不是 HTTP。需要将 nginx 配置为 TCP 反向代理

NGINX transparent TCP proxy

溪流 { 上游系统日志 { 服务器 sapvmlogstash01.sa.projectplace.com:514; 服务器 sapvmlogstash02.sa.projectplace.com:514; } 服务器 { 听514; proxy_pass 系统日志; } }

【讨论】:

    猜你喜欢
    • 2019-03-10
    • 2021-04-05
    • 2019-06-22
    • 1970-01-01
    • 2021-05-06
    • 2019-08-18
    • 1970-01-01
    • 2018-03-25
    • 1970-01-01
    相关资源
    最近更新 更多