This commit is contained in:
2021-11-14 15:52:46 +08:00
parent 915c231124
commit 1e344dc204
112 changed files with 1039 additions and 1039 deletions

View File

@@ -6,8 +6,8 @@ tags: []
categories: ["clickhouse"]
---
# 环境
## Zookeeper 服务器
## 环境
### Zookeeper 服务器
eth0 IP | eth1 IP | 操作系统 | ZK 版本 | myid
---- | ---- | ---- | ---- | ----
10.0.4.101 | 10.1.4.101 | CentOS7.8 | 3.4.14 | 101
@@ -17,7 +17,7 @@ eth0 IP | eth1 IP | 操作系统 | ZK 版本 | myid
- eth0 网卡用于向客户端提供服务eth1 网卡用于 Zookeeper 集群内部通信
- 配置时间同步,关闭 selinux 和 firewalld
## ClickHouse 服务器
### ClickHouse 服务器
eth0 IP | eth1 IP | 操作系统 | CH 版本 | shard 值 | replica 值
---- | ---- | ---- | ---- | ---- | ----
10.0.4.181 | 10.1.4.181 | CentOS7.8 | 20.3 LTS | 1 | 10.1.4.181
@@ -30,13 +30,13 @@ eth0 IP | eth1 IP | 操作系统 | CH 版本 | shard 值 | replica 值
- eth0 网卡用于向客户端提供服务eth1 网卡用于 ClickHouse 集群内部通信
- 配置时间同步,关闭 selinux 和 firewalld
# 安装 Zookeeper 集群
## 安装 Zookeeper 集群
- ClickHouse 集群依赖 zookeeper 管理集群配置
- 安装过程参考: [CentOS7 安装 zookeeper 集群](/post/zk-install/)
- 启动 zookeeper 集群zookeeper 正常运行后,才能进行后续步骤
# 安装 ClickHouse 集群
## 配置 ClickHouse yum 源
## 安装 ClickHouse 集群
### 配置 ClickHouse yum 源
- 在每台 ClickHouse 服务器上执行如下操作
- 生成 clickhouse.repo 文件
```bash
@@ -56,14 +56,14 @@ eth0 IP | eth1 IP | 操作系统 | CH 版本 | shard 值 | replica 值
yum makecache fast
```
## 安装 ClickHouse
### 安装 ClickHouse
- 在每台 ClickHouse 服务器上执行如下操作
- 安装 clickhouse-server 和 clickhouse-client
```bash
yum install clickhouse-server clickhouse-client
```
## 修改 ClickHouse 配置
### 修改 ClickHouse 配置
- 在每台 ClickHouse 服务器上执行如下操作
- 我没用 /etc/metrika.xml 和 config.d 子目录,直接修改的 config.xml先备份
```bash
@@ -197,21 +197,21 @@ eth0 IP | eth1 IP | 操作系统 | CH 版本 | shard 值 | replica 值
</macros>
```
## 启动 ClickHouse
### 启动 ClickHouse
- 在每台 ClickHouse 服务器上执行如下操作
- 启动 clickhouse-server 服务
```bash
systemctl start clickhouse-server
```
# 查看集群状态
## 查看集群状态
- 在任一 ClickHouse 服务器上执行如下操作
- 查询 system.cluster 表
```sql
SELECT * FROM system.clusters;
```
# 简单使用
## 简单使用
- 在任意节点上登陆 clickhouse
```bash
clickhouse-client -h 127.0.0.1