clickhouse linux安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了clickhouse linux安装相关的知识,希望对你有一定的参考价值。

1.安装curl系统包

#yum install -y curl

2.安装clickhouse repositories

#curl -s https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh |bash

3.查询clickhouse包

#yum list ‘clickhouse*‘
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirror.bit.edu.cn
  • extras: mirror.bit.edu.cn
  • updates: mirror.bit.edu.cn
    Available Packages
    clickhouse-client.x86_64 1.1.54343-1.el7 Altinity_clickhouse
    clickhouse-compressor.x86_64 1.1.54336-3.el7 Altinity_clickhouse
    clickhouse-debuginfo.x86_64 1.1.54343-1.el7 Altinity_clickhouse
    clickhouse-server.x86_64 1.1.54343-1.el7 Altinity_clickhouse
    clickhouse-server-common.x86_64 1.1.54343-1.el7 Altinity_clickhouse
    clickhouse-test.x86_64 1.1.54343-1.el7 Altinity_clickhouse

4.安装clickhouse包

#yum install -y ‘clickhouse*‘

#yum list installed ‘clickhouse*‘
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: mirror.bit.edu.cn
  • extras: mirror.bit.edu.cn
  • updates: mirror.bit.edu.cn
    Installed Packages
    clickhouse-client.x86_64 1.1.54343-1.el7 @Altinity_clickhouse
    clickhouse-debuginfo.x86_64 1.1.54343-1.el7 @Altinity_clickhouse
    clickhouse-server.x86_64 1.1.54343-1.el7 @Altinity_clickhouse
    clickhouse-server-common.x86_64 1.1.54343-1.el7 @Altinity_clickhouse
    clickhouse-test.x86_64 1.1.54343-1.el7 @Altinity_clickhouse

5.启动数据库

#/etc/init.d/clickhouse-server restart
Start clickhouse-server service: Path to data directory in /etc/clickhouse-server/config.xml: /var/lib/clickhouse/
DONE

6.连接数据库
#clickhouse-client
ClickHouse client version 1.1.54343.
Connecting to localhost:9000.
Connected to ClickHouse server version 1.1.54343.

:)
:)
:) create database testdb;

CREATE DATABASE testdb

Ok.

0 rows in set. Elapsed: 0.003 sec.

:)

:) use testdb

USE testdb

Ok.

0 rows in set. Elapsed: 0.001 sec.

:)

:) CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = Memory;

CREATE TABLE arrays_test
(
s String,
arr Array(UInt8)
)
ENGINE = Memory

Ok.

0 rows in set. Elapsed: 0.003 sec.

:)

:) INSERT INTO arrays_test VALUES (‘Hello‘, [1,2]), (‘World‘, [3,4,5]), (‘Goodbye‘, [])

INSERT INTO arrays_test VALUES

Ok.

3 rows in set. Elapsed: 0.060 sec.

:)

:) SELECT * FROM arrays_test

SELECT *
FROM arrays_test

┌─s───────┬─arr─────┐
│ Hello │ [1,2] │
│ World │ [3,4,5] │
│ Goodbye │ [] │
└─────────┴─────────┘

3 rows in set. Elapsed: 0.003 sec.

:)

:) SELECT s, arr FROM arrays_test ARRAY JOIN arr

SELECT
s,
arr
FROM arrays_test
ARRAY JOIN arr

┌─s─────┬─arr─┐
│ Hello │ 1 │
│ Hello │ 2 │
│ World │ 3 │
│ World │ 4 │
│ World │ 5 │
└───────┴─────┘

5 rows in set. Elapsed: 0.003 sec.

:)

以上是关于clickhouse linux安装的主要内容,如果未能解决你的问题,请参考以下文章

20210810-基于CentOS7/Linux Grafana 集成 Prometheus并实现对ClickHouse监控

ClickHouse安装及集群搭建

ClickHouse 安装

docker 安装 clickhouse

Clickhouse 客户端无法在 linux 屏幕上正确显示数据

win7上安装 clickhouse可以吗?