CentOS7单机快速安装clickhouse,


Centos(CommunityEnterprise Operating System)是社区企业操作系统,是Linux发行版之一。 centos是由Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成,但它并不包含封闭源代码软件。

 国内镜像站

Clickhouse 官方的下载地址在国外,下载速度比较慢,可以使用国内镜像站进行安装比较快。

Debian/Ubuntu 用户

新建/etc/apt/sources.list.d/clickhouse.list,内容为

  1. deb https://mirrors.tuna.tsinghua.edu.cn/clickhouse/deb/stable/ main/ 

RHEL/CentOS 用户

新建 /etc/yum.repos.d/clickhouse.repo,内容为

  1. [clickhouse] 
  2. name=clickhouse stable 
  3. baseurl=https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64 
  4. enabled=1 
  5. gpgcheck=0 

安装

在CentOS7上直接使用yum直接安装就可以。

  1. yum install clickhouse-server clickhouse-client -y 

启动服务并设置开机启动

  1. systemctl start clickhouse-server 
  2. systemctl enable clickhouse-server 

测试

直接使用clickhouse-client进行连接

  1. clickhouse-client 

创建数据库和一张表测试

  1. create database metrics; 
  2. use metrics 
  3. create table servers( id UInt64 ,ip String ,count UInt64) engine=TinyLog; 
  4. insert into servers (id , ip , count) values (1,'127.0.0.1',100); 
  5. select * from servers; 

  1. centos7 :) select * from servers; 
  2. ​ 
  3. SELECT * 
  4. FROM servers 
  5. ​ 
  6. ┌─id─┬─ip────────┬─count─┐ 
  7. │ 1 │ 127.0.0.1 │ 100 │ 
  8. └────┴───────────┴───────┘ 
  9. ​ 
  10. 1 rows in set. Elapsed: 0.002 sec. 
  11. ​ 
  12. centos7 :) 

相关内容