一、安装:
按照官方文档推荐,用yum方式安装最方便
#yum install yum-utils -y
# rpm --import https://repo.yandex.ru/clickhouse/CLICKHOUSE-KEY.GPG
# yum-config-manager --add-repo https://repo.yandex.ru/clickhouse/rpm/stable/x86_64
Loaded plugins: fastestmirror
adding repo from: https://repo.yandex.ru/clickhouse/rpm/stable/x86_64
[repo.yandex.ru_clickhouse_rpm_stable_x86_64]
name=added from: https://repo.yandex.ru/clickhouse/rpm/stable/x86_64
baseurl=https://repo.yandex.ru/clickhouse/rpm/stable/x86_64
enabled=1
# yum install clickhouse-server clickhouse-client -y (此步时间有点长,多等会)
二、使用
启动client
退出client
显示已有数据库
创建数据库
创建表
例如: CREATE TABLE colleague (Date Date,Name char,Age UInt16,Year UInt16) ENGINE = MergeTree(Date, (Year,Date), 8192);
给表插入一些测试数据
例如:insert into colleague (Date,Name,Age,Year)values('2020-07-16','james','28','2020');