基于linux安装部署clickhouse+基本操作

基于linux安装部署clickhouse+基本操作

1.clickhouse简介

ClickHouse 是俄罗斯的Yandex于2016年开源的列式存储数据库(DBMS),使用C++语言编写,主要用于在线分析处理查询(OLAP),能够使用SQL查询实时生成分析数据报告。

2.ClickHouse的安装

2.1确定防火墙处于关闭状态

2.2CentOS取消打开文件数限制

在 /etc/security/limits.conf文件的末尾加入以下内容

vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

在/etc/security/limits.d/20-nproc.conf文件的末尾加入以下内容

vim /etc/security/limits.d/20-nproc.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

2.3安装依赖

yum install -y libtool
yum install -y *unixODBC*

2.4CentOS取消SELINUX

修改/etc/selinux/config中的SELINUX=disabled

vim /etc/selinux/config
SELINUX=disabled
#注意:别改错了

2.5单机安装,包下载

官网:https://clickhouse.tech/
下载地址:http://repo.red-soft.biz/repos/clickhouse/stable/el7/

2.6在/opt/software下创建clickhouse目录

mkdir clickhouse

2.7将资料中4个文件上传到software/clickhouse目录下

在这里插入图片描述

2.8安装这4个rpm文件

rpm -ivh *.rpm

rpm -qa|grep clickhouse查看安装情况
在这里插入图片描述

2.9修改配置文件

vim /etc/clickhouse-server/config.xml
把 <listen_host>::</listen_host> 的注释打开,这样的话才能让ClickHouse被除本机以外的服务器访问
在这里插入图片描述
在这里插入图片描述

**在这个文件中,有ClickHouse的一些默认路径配置,比较重要的
数据文件路径:<path>/var/lib/clickhouse/</path>
日志文件路径:<log>/var/log/clickhouse-server/clickhouse-server.log</log>**

2.10 启动Server

systemctl start clickhouse-server
#关闭开机自启
systemctl disable clickhouse-server

2.11使用client连接server

如果在2.8步骤中没有输入密码使用第一个连接,如果输入了密码使用第二个连接

#第一种连接
clickhouse-client -m
#第二种连接
clickhouse-client --host=你的IP --port=9000 --user=default --password=你的密码

-m :可以在命令窗口输入多行命令
在这里插入图片描述

3.操作记录

3.1启动

#查看命令
clickhouse --help 
#启动
clickhouse start 
#重启
clickhouse restart

3.2clickhouse相关目录

#  命令目录
/usr/bin
# 配置文件目录
 cd /etc/clickhouse-server/
# 日志目录
 cd /var/log/clickhouse-server/
# 数据文件目录
cd /var/lib/clickhouse/

3.3使用datagrip连接Clickhouse

#所需大概内容
jdbc:clickhouse://192.168.2.221:8123
 --user=default --password=你的密码

在这里插入图片描述

4.持续更新中…

猜你喜欢

转载自blog.csdn.net/Liu__sir__/article/details/131041867