ClickHouse系列2-CK单机安装

一.下载安装介质及安装

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一些默认路径配置:

数据文件路径: /home/ckdata/
日志文件路径:/home/cklog/clickhouse-server.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 :) 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值