乐趣区

关于clickhouse:clickhouse学习1clickhouse安装卸载

1. centos7 下卸载删除:

yum list installed | grep clickhouse
yum remove -y clickhouse-common-static
yum remove -y clickhouse-server-common
rm -rf /var/lib/clickhouse
rm -rf /etc/clickhouse-*
rm -rf /var/log/clickhouse-server

2. centos7 装置 clickhouse

2.1 装置:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://packages.clickhouse.com/rpm/clickhouse.repo
sudo yum install -y clickhouse-server clickhouse-client

sudo /etc/init.d/clickhouse-server start
clickhouse-client # or "clickhouse-client --password" if you set up a password.

2.2 查问以后版本:

SELECT version()

Query id: 8c3867fc-df94-456e-9b2c-863459a6d03b

┌─version()─┐
│ 22.12.3.5 │
└───────────┘

1 row in set. Elapsed: 0.002 sec.

3. 创立用户

创立一个新用户 niewj/246810 有所有权限:

vim /etc/clickhouse-server/users.xml

3.1 配置批改 access_management

<!-- User can create other users and grant rights to them. -->
88             <access_management>1</access_management>

重启
/etc/init.d/clickhouse-server restart

如果不批改就创立, 会报错如下:

CREATE USER niewj IDENTIFIED WITH plaintext_password BY ‘246810’ HOST ANY DEFAULT ROLE ALL;

CREATE USER zhili IDENTIFIED WITH plaintext_password BY '246810' HOST ANY DEFAULT ROLE ALL

Query id: 3b1f8e98-5bc7-4be9-bc1f-70b05c9e1f25


0 rows in set. Elapsed: 0.003 sec. 

Received exception from server (version 22.12.3):
Code: 497. DB::Exception: Received from localhost:9000. DB::Exception: default: Not enough privileges. To execute this query it's necessary to have grant CREATE USER ON *.*. (ACCESS_DENIED)

批改配置后:

CREATE USER niewj IDENTIFIED WITH plaintext_password BY '246810' HOST ANY DEFAULT ROLE ALL

Query id: 065e8142-7e63-49d9-b69c-108a0d4ccfbd

Ok.

0 rows in set. Elapsed: 0.001 sec.

3.2 dbeaver 连贯 clickhouse

批改配置: config.xml: 放开此处正文

vim /etc/clickhouse-server/config.xml

211     <!-- Same for hosts without support for IPv6: -->
212     <listen_host>0.0.0.0</listen_host>

4. 端口凋谢

如果端口不凋谢当然拜访不了, 这里例举了凋谢 80 和 443 和 8123, 只须要开 8123 就能够了!

4.1 开启端口 80 和 443

如果你的服务器关上了防火墙,你须要运行上面的命令,关上 80 和 443 端口。

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

4.2 开启端口 8123

# 1. 查问端口是否开启
firewall-cmd --query-port=8123/tcp
# 2. 开启端口 8123
firewall-cmd --zone=public --add-port=8123/tcp --permanent
# 3. 使失效
firewall-cmd --reload
退出移动版