ClickHouse系列2-CK单机安装

2022-03-30  本文已影响0人  只是甲

一.下载安装介质及安装

1.1 下载

官网:https://clickhouse.tech/

下载地址:https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/

需要以下四个rpm包:

cd /usr/local/src
mkdir ck
cd ck
wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-client-22.2.2.1-2.noarch.rpm
wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-common-static-22.2.2.1-2.x86_64.rpm
wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-common-static-dbg-22.2.2.1-2.x86_64.rpm
wget https://repo.yandex.ru/clickhouse/rpm/stable/x86_64/clickhouse-server-22.2.2.1-2.noarch.rpm


1.2 安装

安装前需要关闭防火墙和SELinux

取消打开文件限制

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

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

安装依赖

yum install -y libtool

安装

cd /usr/local/src/ck
rpm -ivh *.rpm
image.png

二. 修改配置文件

cd /etc/clickhouse-server/
chmod 777 config.xml 
vim config.xml 

把<listen_host>0.0.0.0</listen_host>的注释打开,这样的话才能让ClickHouse被除本机之外的服务器访问

这个配置文件中,ClickHouse一些默认路径配置:

数据文件路径:<path>/home/ckdata/</path>
日志文件路径:<log>/home/cklog/clickhouse-server.log</log>

mkdir -p /home/ckdata
mkdir -p /home/cklog
chmod -R 777 /home/ckdata
chmod -R 777 /home/cklog

三. 启动Server

3.1 启动Server

systemctl start clickhouse-server
or
clickhouse start

3.2 关闭开启自启

systemctl disable clickhouse-server

3.3 使用Client连接server

命令:

clickhouse-client -m --password

测试记录:

[root@hp5 clickhouse-server]# clickhouse-client -m --password
ClickHouse client version 22.2.2.1.
Password for user (default): 
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 22.2.2 revision 54455.

Warnings:
 * Effective user of the process (clickhouse) does not match the owner of the data (root).

hp5 :) show databases;

SHOW DATABASES

Query id: a14be4b3-1b04-478d-877f-36d83255f7a6

┌─name───────────────┐
│ INFORMATION_SCHEMA │
│ default            │
│ information_schema │
│ system             │
└────────────────────┘

4 rows in set. Elapsed: 0.003 sec. 

hp5 :) use information_schema
       ;

USE information_schema

Query id: 8c00cb8d-271c-4174-980e-28adf6fcd8c2

Ok.

0 rows in set. Elapsed: 0.001 sec. 

hp5 :) show tables;

SHOW TABLES

Query id: 62cc7564-ca36-4f3c-abb0-f1ac89d66826

┌─name─────┐
│ columns  │
│ schemata │
│ tables   │
│ views    │
└──────────┘

4 rows in set. Elapsed: 0.004 sec. 

hp5 :) 
上一篇下一篇

猜你喜欢

热点阅读