当前位置: 首页 > 科技观察

CentOS7单机快速安装clickhouse

时间:2023-03-17 10:43:33 科技观察

Centos(CommunityEnterpriseOperatingSystem)是一个社区企业操作系统,是Linux发行版之一。centos是由红帽企业Linux按照开源代码规定发布的源代码编译而成,但不包括闭源代码软件。国内镜像站Clickhouse官方下载地址在国外,下载速度比较慢。可以使用国内镜像站安装更快。Debian/Ubuntu用户创建/etc/apt/sources.list.d/clickhouse.list,内容为debhttps://mirrors.tuna.tsinghua.edu.cn/clickhouse/deb/stable/main/RHEL/CentOS用户创建/etc/yum.repos.d/clickhouse.repo,内容是[clickhouse]name=clickhousestablebaseurl=https://mirrors.tuna.tsinghua.edu.cn/clickhouse/rpm/stable/x86_64enabled=1gpgcheck=0安装上CentOS7直接用yum安装即可。yuminstallclickhouse-serverclickhouse-client-y启动服务并设置启动系统ctlstartclickhouse-serversystemctlenableclickhouse-servertest直接使用clickhouse-client连接clickhouse-client创建数据库和表testcreatedatabasemetrics;usemetricscreatetableservers(idUInt64,ipString,countUInt64)engine=TinyLog;insertintoservers(id,ip,count)values(1,'127.0.0.1',100);select*fromservers;centos7:)select*fromservers;SELECT*FROMservers┌─id─┬─ip──────────┬──计数──┐┐│1│127.0.0.1│100└──────┴──────────────┴────────┘1rowsinset.Elapsed:0.002秒。centos7:)