天天看點

clickhouse linux安裝1.安裝curl系統包2.安裝clickhouse repositories3.查詢clickhouse包4.安裝clickhouse包5.啟動資料庫

#yum install -y curl

#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

#yum install -y 'clickhouse*'

#yum list installed 'clickhouse*'

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

#/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

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

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

INSERT INTO arrays_test VALUES

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.

本文轉自 pgmia 51CTO部落格,原文連結:http://blog.51cto.com/heyiyi/2071308