ClickHouse系列教程四:允许远程连接 allow remote access

ClickHouse系列教程: 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)

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

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> -->

把注释掉的::取消注释,然后重启服务:

service clickhouse-server restart 

现在就的端口监听情况:

root@ubuntu:/var/lib/clickhouse/data/# lsof -i :8123
COMMAND    PID       USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
clickhous 9188 clickhouse   32u  IPv6  61573      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>

你可能感兴趣的:(行走的问题解决机,数据库,clickhouse)