Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to remote clickhouse db via clickhouse command line

Tags:

clickhouse

When I try to connect to remote clickhouse db via clickhouse command line:
$ clickhouse-client -h some_ip.com --port 8123 -u some_user --password some_password -d some_db

I get:

ClickHouse client version 18.12.17.
Connecting to database some_db at some_ip.com:8123 as user some_user.
Code: 102. DB::NetException: Unexpected packet from server some_ip:8123, another_ip (expected Hello or Exception, got Unknown packet)

However this:
$ curl http://some_ip.com:8123
Returns:

Ok

How to connect to remote clickhouse db via clickhouse command line?

P.S. connection establishes well with IDE such as datagrip but not with ch command-line

like image 363
techkuz Avatar asked Oct 05 '18 07:10

techkuz


People also ask

How do I access ClickHouse?

To connect to ClickHouse with native TCP you need this information: The HOST and PORT: typically, the port is 9440 when using TLS, or 9000 when not using TLS. The DATABASE NAME: out of the box there is a database named default , use the name of the database that you want to connect to.

How do I start a ClickHouse server?

Run sudo ./clickhouse install to install ClickHouse system-wide (also with needed configuration files, configuring users etc.). Then run sudo clickhouse start commands to start the clickhouse-server and clickhouse-client to connect to it.


1 Answers

clickhouse-client work with server over TCP which binds on 9000 port, and datagrip works over HTTP protocol with port 8123.

You should: $ clickhouse-client -h some_ip.com --port 9000 -u some_user --password some_password -d some_db

like image 164
techkuz Avatar answered Sep 24 '22 14:09

techkuz