Apache DorisDB 线上部署
一、机器资源(初始)
机器IP | Hostname | 内存 | CPU | 磁盘 |
---|---|---|---|---|
172.16.203.151 | dorisdb203-151 | 16g | 4核 | 500G |
172.16.203.152 | dorisdb203-152 | 16g | 4核 | 500G |
172.16.203.153 | dorisdb203-153 | 16g | 4核 | 500G |
二、角色分配
机器IP | 角色 |
---|---|
172.16.203.151 | FE(Follower)、BE |
172.16.203.152 | FE(Observer)、BE |
172.16.203.153 | BE |
三、准备工作
1. 下载安装包
# 确认安装的服务器的CPU是否支持 avx2 指令:
# 命令:cat /proc/cpuinfo |grep avx2
# 支持 avx2
wget https://apache-doris-releases.oss-accelerate.aliyuncs.com/apache-doris-1.2.7.1-bin-x64.tar.xz
# 不支持 avx2
wget https://apache-doris-releases.oss-accelerate.aliyuncs.com/apache-doris-1.2.7.1-bin-x64-noavx2.tar.xz
2. 安装 jdk, 添加环境变量
tar -zxvf /data/packages/jdk-8u141-linux-x64.tar.gz -C /data/software/
vim /etc/profile
# 添加一下内容
# JAVA_HOME
export JAVA_HOME=/data/software/jdk1.8.0_141
export PATH=:$JAVA_HOME/bin:$PATH
3. 修改系统配置
(1)设置系统最大打开文件句柄数
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
(2)关闭交换分区(swap)(线上永久关闭)
临时关闭
# 临时关闭;关闭swap主要是为了性能考虑
# 0值会命令内核不要使用swap,只有当free和文件使用的内存页数量少于一个zone的高水位,才会使用swap。
echo 0 | sudo tee /proc/sys/vm/swappiness
swapoff -a
永久关闭
# 永久关闭,调整 swappiness 参数
sed -ri 's/.*swap.*/#&/' /etc/fstab
vi /etc/sysctl.conf
# 修改 vm.swappiness 的修改为 0
vm.swappiness=0
# 使配置生效
sysctl -p
(3)Linux内核参数 vm.max_map_count
echo 'vm.max_map_count=2000000' >>/etc/sysctl.conf
四、部署 Dorisdb
1. 解压文件(三台机器均执行)
tar -zxvf /data/packages/apache-doris-1.2.7.1-bin-x64.tar.xz -C /data/software/
mv /data/software/apache-doris-1.2.7.1-bin-x64/ /data/software/doris-1.2.7
2. 新建数据文件夹(三台机器均执行)
# 若此机器不启动 fe 实例, 可不执行
mkdir -p /data/dorisdb_data/doris-meta
# 若此机器不启动 be 实例, 可不执行
mkdir -p /data/dorisdb_data/storage
3. 修改 fe 配置文件, 增加以下内容, 其他配置保持默认值
vim /data/software/doris-1.2.7/fe/conf/fe.conf
机器IP:
- 172.16.203.151
meta_dir = /data/dorisdb_data/doris-meta
priority_networks = 172.16.203.151/24
- 172.16.203.152
meta_dir = /data/dorisdb_data/doris-meta
priority_networks = 172.16.203.152/24
注意:
4. 修改 be 配置文件, 增加以下内容, 其他配置保持默认值
vim /data/software/doris-1.2.7/fe/conf/fe.conf
机器IP:
- 172.16.203.151
JAVA_HOME=/data/software/jdk1.8.0_141
priority_networks = 172.16.203.151/24
storage_root_path = /data/dorisdb_data/storage
- 172.16.203.152
JAVA_HOME=/data/software/jdk1.8.0_141
priority_networks = 172.16.203.152/24
storage_root_path = /data/dorisdb_data/storage
- 172.16.203.153
JAVA_HOME=/data/software/jdk1.8.0_141
priority_networks = 172.16.203.153/24
storage_root_path = /data/dorisdb_data/storage
5. 启动 fe
FE 分为 Leader,Follower 和 Observer 三种角色
默认:第一个启动的 FE 自动成为 Leader,下面输出可以看到 IsMaster: true,在此基础上,可以添加若干 Follower 和 Observer
- 172.16.203.151 (Leader)
cd /data/software/doris-1.2.7/fe
./bin/start_fe.sh --daemon
# 默认没有密码
mysql -h 172.16.203.151 -P 9030 -uroot
mysql> show frontends\G;
*************************** 1. row ***************************
Name: 172.16.203.151_9010_1698139318444
IP: 172.16.203.151
EditLogPort: 9010
HttpPort: 8030
QueryPort: 9030
RpcPort: 9020
Role: FOLLOWER
IsMaster: true
ClusterId: 1453119857
Join: true
Alive: true
ReplayedJournalId: 18444
LastHeartbeat: 2023-10-25 10:26:44
IsHelper: true
ErrMsg:
Version: doris-1.2.7-1-Unknown
CurrentConnected: Yes
- 172.16.203.152(Observer)
先在mysql中添加,再启动 fe
mysql> ALTER SYSTEM ADD OBSERVER "172.16.203.152:9010";
# 首次启动需要使用 命令·1, 其他情况使用 命令·2
# 命令·1
cd /data/software/doris-1.2.7/fe
./bin/start_fe.sh --helper 172.16.203.151:9010 --daemon
#####################################################################
# 命令·2
cd /data/software/doris-1.2.7/fe
./bin/start_fe.sh --daemon
6. 查看 fe 实例 show frontends\G;
mysql> show frontends\G;
*************************** 1. row ***************************
Name: 172.16.203.152_9010_1698140077600
IP: 172.16.203.152
EditLogPort: 9010
HttpPort: 8030
QueryPort: 9030
RpcPort: 9020
Role: OBSERVER
IsMaster: false
ClusterId: 1453119857
Join: true
Alive: true
ReplayedJournalId: 18661
LastHeartbeat: 2023-10-25 10:38:55
IsHelper: false
ErrMsg:
Version: doris-1.2.7-1-Unknown
CurrentConnected: No
*************************** 2. row ***************************
Name: 172.16.203.151_9010_1698139318444
IP: 172.16.203.151
EditLogPort: 9010
HttpPort: 8030
QueryPort: 9030
RpcPort: 9020
Role: FOLLOWER
IsMaster: true
ClusterId: 1453119857
Join: true
Alive: true
ReplayedJournalId: 18663
LastHeartbeat: 2023-10-25 10:38:55
IsHelper: true
ErrMsg:
Version: doris-1.2.7-1-Unknown
CurrentConnected: Yes
2 rows in set (0.03 sec)
7. 启动 be
先在mysql中添加,再启动 be
mysql> ALTER SYSTEM ADD BACKEND "172.16.203.151:9050";
mysql> ALTER SYSTEM ADD BACKEND "172.16.203.152:9050";
mysql> ALTER SYSTEM ADD BACKEND "172.16.203.153:9050";
- 172.16.203.151
cd /data/software/doris-1.2.7/be
./bin/start_be.sh --daemon
- 172.16.203.152
cd /data/software/doris-1.2.7/be
./bin/start_be.sh --daemon
- 172.16.203.153
cd /data/software/doris-1.2.7/be
./bin/start_be.sh --daemon
8. 查看 be 实例 show proc '/backends'\G;
mysql> SHOW PROC '/backends'\G;
*************************** 1. row ***************************
BackendId: 10004
Cluster: default_cluster
IP: 172.16.203.152
HostName: 172.16.203.152
HeartbeatPort: 9050
BePort: 9060
HttpPort: 8040
BrpcPort: 8060
LastStartTime: 2023-10-24 17:39:12
LastHeartbeat: 2023-10-25 10:46:11
Alive: true
SystemDecommissioned: false
ClusterDecommissioned: false
TabletNum: 0
DataUsedCapacity: 0.000
AvailCapacity: 493.198 GB
TotalCapacity: 499.756 GB
UsedPct: 1.31 %
MaxDiskUsedPct: 1.31 %
RemoteUsedCapacity: 0.000
Tag: {"location" : "default"}
ErrMsg:
Version: doris-1.2.7-1-Unknown
Status: {"lastSuccessReportTabletsTime":"2023-10-25 10:45:46","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false}
HeartbeatFailureCounter: 0
NodeRole: mix
*************************** 2. row ***************************
BackendId: 10005
Cluster: default_cluster
IP: 172.16.203.153
HostName: 172.16.203.153
HeartbeatPort: 9050
BePort: 9060
HttpPort: 8040
BrpcPort: 8060
LastStartTime: 2023-10-24 17:42:29
LastHeartbeat: 2023-10-25 10:46:11
Alive: true
SystemDecommissioned: false
ClusterDecommissioned: false
TabletNum: 0
DataUsedCapacity: 0.000
AvailCapacity: 493.253 GB
TotalCapacity: 499.756 GB
UsedPct: 1.30 %
MaxDiskUsedPct: 1.30 %
RemoteUsedCapacity: 0.000
Tag: {"location" : "default"}
ErrMsg:
Version: doris-1.2.7-1-Unknown
Status: {"lastSuccessReportTabletsTime":"2023-10-25 10:45:28","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false}
HeartbeatFailureCounter: 0
NodeRole: mix
*************************** 3. row ***************************
BackendId: 10003
Cluster: default_cluster
IP: 172.16.203.151
HostName: dorisdb203-151
HeartbeatPort: 9050
BePort: 9060
HttpPort: 8040
BrpcPort: 8060
LastStartTime: 2023-10-24 17:39:04
LastHeartbeat: 2023-10-25 10:46:11
Alive: true
SystemDecommissioned: false
ClusterDecommissioned: false
TabletNum: 0
DataUsedCapacity: 0.000
AvailCapacity: 493.234 GB
TotalCapacity: 499.756 GB
UsedPct: 1.30 %
MaxDiskUsedPct: 1.30 %
RemoteUsedCapacity: 0.000
Tag: {"location" : "default"}
ErrMsg:
Version: doris-1.2.7-1-Unknown
Status: {"lastSuccessReportTabletsTime":"2023-10-25 10:45:38","lastStreamLoadTime":-1,"isQueryDisabled":false,"isLoadDisabled":false}
HeartbeatFailureCounter: 0
NodeRole: mix
3 rows in set (0.02 sec)
9. 修改密码
mysql -h 172.16.203.151 -P 9030 -uroot
mysql> SET PASSWORD FOR 'root' = PASSWORD('123456');
五、参考链接
官方网站:https://doris.apache.org/zh-CN/docs/admin-manual/cluster-management/elastic-expansion/
博客:https://zhuanlan.zhihu.com/p/559718796?utm_id=0
标签:10,1.2,203.151,线上,172.16,Apache,DorisDB,data,doris From: https://www.cnblogs.com/yzyang/p/18211463