Install and deploy clickhouse+ basic operations based on linux
1.Introduction to clickhouse
ClickHouse is a columnar storage database (DBMS) open sourced by Russia's Yandex in 2016. It is written in C++ language and is mainly used for online analytical processing queries (OLAP). It can generate analysis data reports in real time using SQL queries.
2.ClickHouse installation
2.1 Make sure the firewall is turned off
2.2CentOS cancels the limit on the number of open files
Add the following content to the end of the /etc/security/limits.conf file
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
Add the following content to the end of the /etc/security/limits.d/20-nproc.conf file
vim /etc/security/limits.d/20-nproc.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
2.3 Install dependencies
yum install -y libtool
yum install -y *unixODBC*
2.4CentOS cancels SELINUX
Modify SELINUX=disabled in /etc/selinux/config
vim /etc/selinux/config
SELINUX=disabled
#注意:别改错了
2.5 Stand-alone installation, package download
官网:https://clickhouse.tech/
下载地址:http://repo.red-soft.biz/repos/clickhouse/stable/el7/
2.6 Create the clickhouse directory under /opt/software
mkdir clickhouse
2.7 Upload the 4 files in the information to the software/clickhouse directory
2.8 Install these 4 rpm files
rpm -ivh *.rpm
rpm -qa|grep clickhouse to check the installation status
2.9 Modify configuration file
vim /etc/clickhouse-server/config.xml
open the comment of <listen_host>::</listen_host> so that ClickHouse can be accessed by servers other than this machine.
**在这个文件中,有ClickHouse的一些默认路径配置,比较重要的
数据文件路径:<path>/var/lib/clickhouse/</path>
日志文件路径:<log>/var/log/clickhouse-server/clickhouse-server.log</log>**
2.10 Start Server
systemctl start clickhouse-server
#关闭开机自启
systemctl disable clickhouse-server
2.11 Use client to connect to server
If you did not enter a password in step 2.8, use the first connection. If you entered a password, use the second connection.
#第一种连接
clickhouse-client -m
#第二种连接
clickhouse-client --host=你的IP --port=9000 --user=default --password=你的密码
-m: You can enter multi-line commands in the command window
3. Operation records
3.1 Startup
#查看命令
clickhouse --help
#启动
clickhouse start
#重启
clickhouse restart
3.2clickhouse related directories
# 命令目录
/usr/bin
# 配置文件目录
cd /etc/clickhouse-server/
# 日志目录
cd /var/log/clickhouse-server/
# 数据文件目录
cd /var/lib/clickhouse/
3.3 Use datagrip to connect to Clickhouse
#所需大概内容
jdbc:clickhouse://192.168.2.221:8123
--user=default --password=你的密码