ClickHouse常用配置

编辑配置文件/etc/clickhouse-server/config.xml

1、允许远程访问

<listen_host>用于限制来源主机的请求

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

(1)允许IP4和IP6源主机远程访问

<listen_host>::</listen_host>

(2)仅允许IP4主机远程访问

<listen_host>0.0.0.0</listen_host>

(3)仅允许本地访问

    <!-- Default values - try listen localhost on ipv4 and ipv6: -->
    <!--
    <listen_host>::1</listen_host>
    <listen_host>127.0.0.1</listen_host>
    -->

(4)我的设置

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

2、数据目录

(1)设置参数如下

    <!-- Path to data directory, with trailing slash. -->
    <path>/data/clickhouse/</path>

    <!-- Path to temporary data for processing hard queries. -->
    <tmp_path>/data/clickhouse/tmp/</tmp_path>

(2)创建目录

[root@client app]# mkdir -p /data/clickhouse
[root@client app]# chown -R clickhouse:clickhouse /data/clickhouse

(3)重启服务,查看数据目录

[root@client app]# systemctl restart clickhouse-server
[root@client app]# ll /data/clickhouse/
total 28
drwxr-x--- 4 clickhouse clickhouse 4096 Sep 11 15:23 data
drwxr-x--- 2 clickhouse clickhouse 4096 Sep 11 15:23 dictionaries_lib
drwxr-x--- 2 clickhouse clickhouse 4096 Sep 11 15:23 flags
drwxr-x--- 4 clickhouse clickhouse 4096 Sep 11 15:23 metadata
drwxr-x--- 2 clickhouse clickhouse 4096 Sep 11 15:23 preprocessed_configs
-rw-r----- 1 clickhouse clickhouse   59 Sep 11 15:23 status
drwxr-x--- 2 clickhouse clickhouse 4096 Sep 11 15:23 tmp
[root@client app]#
©️2020 CSDN 皮肤主题: 创作都市 设计师:CSDN官方博客 返回首页