clickhouse单机版安装部署
时间: 2023-11-29 11:47:53 浏览: 108
以下是ClickHouse单机版安装部署的步骤:
1. 环境准备
确保你的操作系统是64位的,并且至少有1GB的可用内存。如果你的系统是32位的,则需要安装ClickHouse的低版本。此外,你还需要安装以下软件包:
- curl
- gnupg
- lsof
- sudo
2. 添加ClickHouse软件包
运行以下命令添加ClickHouse软件包:
```shell
sudo yum install -y yum-utils
sudo rpm --import https://repo.clickhouse.tech/CLICKHOUSE-KEY.GPG
sudo yum-config-manager --add-repo https://repo.clickhouse.tech/rpm/stable/x86_64
sudo yum install -y clickhouse-server clickhouse-client
```
3. 启动ClickHouse服务
运行以下命令启动ClickHouse服务:
```shell
sudo systemctl start clickhouse-server
```
4. 验证ClickHouse服务
运行以下命令验证ClickHouse服务是否已经启动:
```shell
sudo systemctl status clickhouse-server
```
如果服务已经启动,则会输出类似以下内容:
```
● clickhouse-server.service - ClickHouse Server
Loaded: loaded (/usr/lib/systemd/system/clickhouse-server.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-11-02 09:47:23 UTC; 1min 23s ago
Main PID: 12345 (clickhouse-serv)
Tasks: 47 (limit: 4915)
Memory: 1.1G
CGroup: /system.slice/clickhouse-server.service
├─12345 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/var/run/clickhouse-server/clickhouse-server.pid
└─12346 /usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml --pid-file=/var/run/clickhouse-server/clickhouse-server.pid
```
5. 连接到ClickHouse客户端
运行以下命令连接到ClickHouse客户端:
```shell
clickhouse-client
```
6. 验证ClickHouse客户端
运行以下命令验证ClickHouse客户端是否已经连接到服务端:
```shell
SELECT 1
```
如果连接成功,则会输出类似以下内容:
```
ClickHouse client version 21.10.2.9 (official build).
Connecting to localhost:9000 as user default.
Connected to ClickHouse server version 21.10.2 revision 54429.
ClickHouse server version: 21.10.2 revision 54429
1
```
阅读全文