CentOS Stream 9 搭建单机版Clickhouse
安装包下载地址:https://mirrors.aliyun.com/clickhouse/rpm/stable/?spm=a2c6h.25603864.0.0.242c3e7fMSQTpc
安装包下载列表
名称 |
---|
clickhouse-common-static-24.6.1.4423.x86_64.rpm |
clickhouse-server-24.6.1.4423.x86_64.rpm |
clickhouse-client-24.6.1.4423.x86_64.rpm |
安装Clickhouse
将下载的安装包上传至/home/目录,执行如下命令
rpm -ivh clickhouse-common-static-24.6.1.4423.x86_64.rpm
rpm -ivh clickhouse-client-24.6.1.4423.x86_64.rpm
rpm -ivh clickhouse-server-24.6.1.4423.x86_64.rpm
执行server服务安装包时会让写默认用户的密码,可根据需求填写即可。
修改配置
安装完毕无误后/etc/clickhouse-server和 /etc/clickhouse-client配置目录如下
vim /etc/clickhouse-server/config.xml
开放端口
将<listen_host>::</listen_host>
配置项放开
调整数据目录
存放数据的目录为默认,可根据现场酌情调整
<path>/var/lib/clickhouse/</path>
添加用户名密码
设置密码
PASSWORD='zyh_root_123'; echo "$PASSWORD"; echo -n "$PASSWORD" | sha1sum | tr -d '-' | xxd -r -p | sha1sum | tr -d '-'
添加用户
vim /etc/clickhouse-server/users.xml
<root>
<password_double_sha1_hex>ee879f11e94429315c02ae5500890341eeff51d7</password_double_sha1_hex>
<networks incl="networks" replace="replace">
<ip>::/0</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
</root>
注:<password_double_sha1_hex>标签中的就是一步中设置密码加密后的字符串,进行相应的替换即可。
如下图:
启动验证
启动服务:service clickhouse-server start
查看状态:service clickhouse-server status
停止服务:service clickhouse-server stop
重启服务:systemctl restart clickhouse-server.service
输入:clickhouse-client
即可进入客户端交互
通过查询验证:select 1