一、环境准备
- starrocks 安装包
- jdk8
- centos7服务器3台
二、服务器互信任
在三台服务器之间建立互信任,使得ssh 连接时,无需输入密码,可参考170. 【Linux】ssh-keyscan 解决“离线环境”多节点互信任问题,里面的脚本可直接使用。
互信任完成之后,就可以使用 sync_scripts.sh
脚本了,该脚本支持将一个命令同时在互信任的几个服务器中执行,省去了一些时间。有需要的自己写一个,或者也可以私信我。
三、开始安装
./sync_scripts.sh 'cd /home/path_install_starrocks ; tar -zxvf jdk-8u202-linux-x64.tar.gz &&tar -zxvf StarRocks-2.5.2.tar.gz'
- 解压 jdk和starrocks安装包
./sync_scripts.sh "echo 'JAVA_HOME=/home/path_install_starrocks/jdk1.8.0_202' >>/etc/bashrc" ./sync_scripts.sh "echo 'export PATH=\${PATH}:\${JAVA_HOME}/bin' >>/etc/bashrc" ./sync_scripts.sh "source /etc/bashrc"
配置 JAVA_HOME
可以看到我三台服务器上的java都已经配置好了
./sync_scripts.sh 'echo 0 | tee /proc/sys/vm/swappiness' ./sync_scripts.sh 'echo 1 | tee /proc/sys/vm/overcommit_memory'
配置参数
./sync_scripts.sh 'cd /home/path_install_starrocks/StarRocks-2.5.2/fe/conf &&ls&& echo JAVA_HOME=${JAVA_HOME} >> fe.conf'
修改 fe.conf
./sync_scripts.sh 'cd /home/path_install_starrocks/StarRocks-2.5.2/fe && mkdir -p meta'
创建 meta 目录
# 停止 ./sync_scripts.sh 'cd /home/path_install_starrocks/StarRocks-2.5.2/fe/bin && ./stop_fe.sh --daemon' # 启动 ./sync_scripts.sh 'cd /home/path_install_starrocks/StarRocks-2.5.2/fe/bin && ./start_fe.sh --daemon'
启动fe
可以看到fe已经启动成功了
./sync_scripts.sh "echo 'export LD_LIBRARY_PATH=\${JAVA_HOME}/jre/lib/amd64/server' >> ~/.bashrc" ./sync_scripts.sh 'source ~/.bashrc'
解决starrocks_be 缺少依赖库的问题
./sync_scripts.sh 'cd /home/path_install_starrocks/StarRocks-2.5.2/be && mkdir -p storage'
创建 storage 目录
C:\Users\FENG>mysql -h xx.xxx.xxx.xxx -P9030 -uroot Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 0 Server version: 5.1.0 Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ALTER SYSTEM ADD BACKEND "172.16.7.216:9050"; Query OK, 0 rows affected (0.02 sec) mysql> ALTER SYSTEM ADD BACKEND "172.16.7.217:9050"; Query OK, 0 rows affected (0.01 sec) mysql> ALTER SYSTEM ADD BACKEND "172.16.7.218:9050"; Query OK, 0 rows affected (0.01 sec) mysql>
添加后端be节点
./sync_scripts.sh 'cd /home/path_install_starrocks/StarRocks-2.5.2/be && ./bin/start_be.sh --daemon'
启动be节点
mysql> SHOW PROC '/backends'\G; *************************** 1. row *************************** BackendId: 11001 IP: 172.16.7.216 HeartbeatPort: 9050 BePort: 9060 HttpPort: 8040 BrpcPort: 8060 LastStartTime: 2023-02-25 16:13:58 LastHeartbeat: 2023-02-25 16:15:43 Alive: true SystemDecommissioned: false ClusterDecommissioned: false TabletNum: 30 DataUsedCapacity: 0.000 AvailCapacity: 1.947 TB TotalCapacity: 1.952 TB UsedPct: 0.24 % MaxDiskUsedPct: 0.24 % ErrMsg: Version: 2.5.2-c3772fb Status: {"lastSuccessReportTabletsTime":"2023-02-25 16:14:59"} DataTotalCapacity: 1.947 TB DataUsedPct: 0.00 % CpuCores: 4 NumRunningQueries: 0 MemUsedPct: 0.97 % CpuUsedPct: 0.2 % *************************** 2. row *************************** BackendId: 11005 IP: 172.16.7.217 HeartbeatPort: 9050 BePort: 9060 HttpPort: 8040 BrpcPort: 8060 LastStartTime: 2023-02-25 16:13:58 LastHeartbeat: 2023-02-25 16:15:43 Alive: true SystemDecommissioned: false ClusterDecommissioned: false TabletNum: 30 DataUsedCapacity: 0.000 AvailCapacity: 1.947 TB TotalCapacity: 1.952 TB UsedPct: 0.24 % MaxDiskUsedPct: 0.24 % ErrMsg: Version: 2.5.2-c3772fb Status: {"lastSuccessReportTabletsTime":"2023-02-25 16:14:59"} DataTotalCapacity: 1.947 TB DataUsedPct: 0.00 % CpuCores: 4 NumRunningQueries: 0 MemUsedPct: 0.97 % CpuUsedPct: 0.0 % *************************** 3. row *************************** BackendId: 11006 IP: 172.16.7.218 HeartbeatPort: 9050 BePort: 9060 HttpPort: 8040 BrpcPort: 8060 LastStartTime: 2023-02-25 16:13:58 LastHeartbeat: 2023-02-25 16:15:43 Alive: true SystemDecommissioned: false ClusterDecommissioned: false TabletNum: 30 DataUsedCapacity: 0.000 AvailCapacity: 1.947 TB TotalCapacity: 1.952 TB UsedPct: 0.24 % MaxDiskUsedPct: 0.24 % ErrMsg: Version: 2.5.2-c3772fb Status: {"lastSuccessReportTabletsTime":"2023-02-25 16:14:58"} DataTotalCapacity: 1.947 TB DataUsedPct: 0.00 % CpuCores: 4 NumRunningQueries: 0 MemUsedPct: 0.97 % CpuUsedPct: 0.2 % 3 rows in set (0.01 sec)
可以看到3个节点都是Active=true。启动完毕
navicat 也连接测试成功了