欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DBeaver连接ClickHouse实操

程序员文章站 2022-03-20 21:58:11
...

DBeaver和ClickHouse已经安装好。

DBeaver连接ClickHouse需要开放远程访问权限。

先查看ClickHouse server端监听端口的状态:

[aaa@qq.com clickhouse-server]# lsof -i :8123
COMMAND    PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
clickhous 2158 clickhouse   43u  IPv6  13430      0t0  TCP localhost:8123 (LISTEN)
clickhous 2158 clickhouse   46u  IPv4  13433      0t0  TCP localhost:8123 (LISTEN)

这里显示监听本地端口,需要修改配置:

nano /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 or ipv4 unavailable, but listen_host with this protocol specified -->
    <!-- <listen_try>0</listen_try> -->

把注释掉的<listen_host>::</listen_host>取消注释,然后重启服务:

service clickhouse-server restart 

现在就的端口监听情况:

[aaa@qq.com clickhouse-server]# lsof -i :8123
COMMAND     PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
clickhous 28995 clickhouse   43u  IPv6 169928      0t0  TCP *:8123 (LISTEN)

一般来说不需要修改 users.xml这个文件。

-> # locate users.xml
/etc/clickhouse-server/users.xml
/var/lib/clickhouse/preprocessed_configs/users.xml
-> # nano /etc/clickhouse-server/users.xml

里面的内容如果是::/0那就不用修改了:

            <networks incl="networks" replace="replace">
                <ip>::/0</ip>
            </networks>

 

测试DBeaver连接ClickHouse

DBeaver连接ClickHouse实操

相关标签: ClickHouse