阿里巴巴开源镜像站-OPSX镜像站-阿里云开发者社区阿里巴巴开源镜像站,免费提供Linux镜像下载服务,拥有Ubuntu、CentOS、Deepin、MongoDB、Apache、Maven、Composer等多种开源软件镜像源,此外还提供域名解析DNS、网络授时NTP等服务,致力于为互联网用户提供全面,高效和稳定的基础服务。https://developer.aliyun.com/mirror/
选择TLS最新版本
clickhouse-client
clickhouse-common-static
clickhouse-common-static-dbg
clickhouse-server
① clickhouse-common-static-22.2.2.1.tgz
tar -zxvf clickhouse-common-static-22.2.2.1.tgz
./clickhouse-common-static-22.2.2.1/install/doinst.sh
② clickhouse-common-static-dbg-22.2.2.1.tgz
tar -zxvf clickhouse-common-static-dbg-22.2.2.1.tgz
./clickhouse-common-static-dbg-22.2.2.1/install/doinst.sh
③ clickhouse-server-22.2.2.1.tgz
tar -zxvf clickhouse-server-22.2.2.1.tgz
./clickhouse-server-22.2.2.1/install/doinst.sh
注:在运行server的doinst.sh时。clickhouse会默认创建一个default的用户,让你设置密码,不设置密码可以直接回车。
④ clickhouse-client-22.2.2.1.tgz
tar -zxvf clickhouse-client-22.2.2.1.tgz
./clickhouse-client-22.2.2.1/install/doinst.sh
firewall-cmd --zone=public --add-port=8123/tcp --permanent
firewall-cmd reload
firewall-cmd --zone=public --add-port=9000/tcp --permanent
firewall-cmd reload
--查看是否成功
firewall-cmd --list-port
--修改default用户管理权限
vim /etc/clickhouse-server/users.xml
--限制default用户的登录ip为本机,为安全考虑
vim /etc/clickhouse-server/users.xml
--开放远程访问
vim /etc/clickhouse-server/config.xml
clickhouse start
或重启 systemctl restart clickhouse-server
clickhouse-client -m --password <密码>
或 clickhouse-client -m -u default --password <密码>
--注意库名小写
CREATE DATABASE db1;
或 CREATE DATABASE db1 ENGINE=Atomic;
--切库
use db1;
--创建用户并赋权
create user user1 identified with sha256_password by '123456';
GRANT ALL ON db1.* TO user1 WITH GRANT OPTION;