I hosted a clickhouse server on azure VM (I'm able to run clickhouse-client inside the VM) with a nginx proxy, below is the nginx setting
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;
}
I'm able to curl both endpoint with proper response, e.g.
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.
However, when i try to do clickhouse-client -h myhost.cloudapp.azure.com --port 6000
, I get the following.
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)
The connection setting for clickhouse-server is as following:
<listen_host>::</listen_host>
I don't know what I'm doing wrong, any hints are appreciated.
question from:
https://stackoverflow.com/questions/65896643/fail-to-connect-to-remote-clickhouse-server-with-clickhouse-client 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…