CentOS7单机一键安装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 , countvalues (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. rows in set. Elapsed: 0.002 sec. 
  11. ​ 
  12. centos7 🙂 
【声明】:芜湖站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

相关文章