1. Install the Curl System Package
#yum Install-y Curl
2. Install Clickhouse repositories
#curl-S https://packagecloud.io/install/repositories/altinity/clickhouse/script.rpm.sh |bash
3. Query Clickhouse Package
#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. Install the Clickhouse package
#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. Start the database
#/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. Connect to the database
#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 ', [+]), (' 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 Installation