linux安装:

https://clickhouse.tech/#quick-start

sudo yum install yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/clickhouse.repo
sudo yum install clickhouse-server clickhouse-client

启动

关闭防火墙 
systemctl stop firewalld.service #停止firewall 
systemctl disable firewalld.service #禁止firewall开机启动<


启动clickhouse服务端 
service clickhouse-server start

通过客户端连接 
clickhouse-client –m 

 

更快的体验方式是: 拉取clickhouse 实例到本地运行

 

JDBC 客户端

github链接描述
clickhouse-jdbc官方提供,基于 http 实现,与 server 的 8123 端口进行通信
ClickHouse-Native-JDBC第三方lib,基于 tcp 实现,与 server 的 9000 端口进行通讯 性能相对更优,推荐使用

 

可视化工具:

clickhouse的可视化工具DEeaver:https://blog.csdn.net/weixin_39025362/article/details/105631540

下载:https://www.cnblogs.com/cbugs/p/13358246.html

 

错误记录:

 Address family for hostname not supported (version 20.5.4.40 (official build)) Address family for hostname not supported (version 20.5.4.40 (official build))
 

是禁用了IP6的原因:开启IP6

https://www.cnblogs.com/betx/p/7115396.html

 

 

 

用户配置

设置个新用户玩玩吧~~~(https://blog.csdn.net/jz1993/article/details/82914187


[root@pcdnasdevapp03 etc]# cd clickhouse-server/
[root@pcdnasdevapp03 clickhouse-server]# cat users.xml
<?xml version="1.0"?>
<yandex>
    <profiles>
        <default>
            <max_memory_usage>10000000000</max_memory_usage>
<use_uncompressed_cache>0</use_uncompressed_cache>
            <load_balancing>random</load_balancing>
        </default>
        <readonly>
            <readonly>1</readonly>
        </readonly>
    </profiles>
    <users>
        <default>
            <password></password>
            <networks incl="networks" replace="replace">
                <ip>::/0</ip>
            </networks>
            <profile>default</profile>
            <quota>default</quota>
        </default> 
        <dba>
            <password_sha256_hex>e6cfd8b39bd6c6503a5486e9d7ff23ccca72b1876a7ccdb6e3fb2f8e6a927476  </password_sha256_hex>
            <networks incl="networks" replace="replace">
                <ip>::/0</ip>
            </networks>
            <profile>default</profile>
            <quota>default</quota>
            <allow_databases>
               <database>test</database>
            </allow_databases>
        </dba> 
        <readonly>
            <password></password>
            <networks incl="networks" replace="replace">
                <ip>::1</ip>
                <ip>127.0.0.1</ip>
            </networks>
            <profile>readonly</profile>
            <quota>default</quota>
        </readonly>
    </users>
    <quotas>
        <default>
            <interval>
                <duration>3600</duration>
                <queries>0</queries>
                <errors>0</errors>
                <result_rows>0</result_rows>
                <read_rows>0</read_rows>
                <execution_time>0</execution_time>
            </interval>
        </default>
    </quotas>
</yandex>
[root@pcdnasdevapp03 clickhouse-server]#   

 

dba随便命名  

密码是参照:https://www.cnblogs.com/gomysql/p/6708796.html

[root@pcdnasdevapp03 ~]# PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'
3iD5SG6L
e6cfd8b39bd6c6503a5486e9d7ff23ccca72b1876a7ccdb6e3fb2f8e6a927476 

仅输入PASSWORD=$(base64 < /dev/urandom | head -c8); echo "$PASSWORD"; echo -n "$PASSWORD" | sha256sum | tr -d '-'生成

密码:3iD5SG6L

密文:e6cfd8b39bd6c6503a5486e9d7ff23ccca72b1876a7ccdb6e3fb2f8e6a927476  

[root@pcdnasdevapp03 clickhouse-server]# clickhouse-client -u dba -h 127.0.0.1 --password 3iD5SG6L
ClickHouse client version 18.12.17.
Connecting to 127.0.0.1:9000 as user dba.
Connected to ClickHouse server version 18.12.17 revision 54407.
pcdnasdevapp03 :)

客户端连接成功!

用idea在连接下

ggggggggggg

 

 

CentOS7打开关闭防火墙与端口的基本命令

1、firewalld的基本使用

启动: systemctl start firewalld

关闭: systemctl stop firewalld

查看状态: systemctl status firewalld 

开机禁用  : systemctl disable firewalld

开机启用  : systemctl enable firewalld

 

 

2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service

查看已启动的服务列表:systemctl list-unit-files|grep enabled

查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

查看版本: firewall-cmd --version

查看帮助: firewall-cmd --help

显示状态: firewall-cmd --state

查看所有打开的端口: firewall-cmd --zone=public --list-ports

更新防火墙规则: firewall-cmd --reload

查看区域信息:  firewall-cmd --get-active-zones

查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0

拒绝所有包:firewall-cmd --panic-on

取消拒绝状态: firewall-cmd --panic-off

查看是否拒绝: firewall-cmd --query-panic

 

那怎么开启一个端口呢

添加

firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)

重新载入

firewall-cmd --reload

查看

firewall-cmd --zone= public --query-port=80/tcp

删除

firewall-cmd --zone= public --remove-port=80/tcp --permanent

 

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐