ClickHouse常见问题整理
Code: 210. DB::NetException: Connection refused (localhost:9000)
root@test:# clickhouse-client ClickHouse client version 20.1.4.14 (official build). Password for user (default): Connecting to localhost:9000 as user default. Code: 210. DB::NetException: Connection refused (localhost:9000)
解决办法:
root@test:# service clickhouse-server start
root@test:# clickhouse-client
Code: 194. DB::Exception: Received from localhost:9000. DB::Exception: Password required for user default.
root@test:# clickhouse-client ClickHouse client version 20.1.4.14 (official build). Connecting to localhost:9000 as user default. Code: 194. DB::Exception: Received from localhost:9000. DB::Exception: Password required for user default.
解决办法:
root@test:# clickhouse-client --password 输入定义的密码
ClickHouse开启远程连接
先查看ClickHouse server端监听端口的状态:
root@ubuntu:/var/lib/clickhouse/# lsof -i :8123 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME clickhous 653 clickhouse 41u IPv6 32544 0t0 TCP ip6-localhost:8123 (LISTEN) clickhous 653 clickhouse 44u IPv4 32547 0t0 TCP localhost:8123 (LISTEN
这里显示监听本地端口,需要修改配置:
sudo vim /etc/clickhouse-server/config.xml <!-- Listen specified host. use :: (wildcard IPv6 address), if you want to accept connections both with IPv4 and IPv6 from everywhere. --> <!--<listen_host>::</listen_host> --> <!-- Same for hosts with disabled ipv6: --> <!-- <listen_host>0.0.0.0</listen_host> --> <!-- Default values - try listen localhost on ipv4 and ipv6: --> <!-- <listen_host>::1</listen_host> <listen_host>127.0.0.1</listen_host> --> <!-- Don't exit if ipv6&nbs***bsp;ipv4 unavailable, but listen_host with this protocol specified --> <!-- <listen_try>0</listen_try> -->
把注释掉的::取消注释,然后重启服务:
systemctl restart clickhouser-server