安装:
官方推荐使用ubantu安装,对ubantu的支持也最友好。
也可以使用docker安装:https://hub.docker.com/r/yandex/clickhouse-server/
这里使用CentOS安装:https://packagecloud.io/Altinity/clickhouse
rpm安装:
先复制执行RMP的内容,该shell命令可以在installation中找到详细的,如果安装中出现问题可以手动copy shell中的内容执行。
设置系统参数:
CentOS取消打开文件数限制:
在/etc/security/limits.conf /etc/security/limits.d/90-nproc.conf这两个文件最后新增以下内容:
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
根据对应的系统版本安装对应的server和client。
启动连接:
service clickhouse-server start
clickhouse-client
运维指南:
日志默认目录:/var/log/clickhouse-server/
停止: service clickhouse-server stop
启动: service clickhouse-server start
用clickhouse-client连接本机clickhouse-server服务器:
Clickhouse-client
用本机clickhouse-client连接远程clickhouse-server服务器: clickhouse-client –host xxx.xx.xx.xx –port 9000 –database default–user default –password “”
参数配置:
远程访问:
vi /etc/clickhouse-server/config.xml
修改服务器的配置文件/etc/clickhouse-server/config.xml,找到这个代码块Listen specified host.,放开注释即可,修改之后的内容如下:
内存限制设置:
vim /etc/clickhouse-server/users.xml
数据目录:
vim /etc/clickhouse-server/users.xml
开启远程登录之后 通过dbeaver连接clickhouse。(官方不提供jdbc驱动,可以自己通过maven编译),或者使用dbeaver第一次连接clickhouse的时候会自动下载jdbc驱动至图下的目录下。
远程登录一直unknow,错误日志中显示因为stop的时候其实端口还是被占用状态。
修改此配置,然后把默认端口改为没有使用过的再重启即可解决。
网页版工具TABiX连接clickhouse库: