Easy to use Doirs cluster operation and maintenance tool
yum install ansible
https://github.com/mklzl/doris_ansible
-
vi /etc/ansible/hosts
## 集群cluster1中参与的机器ip [cluster1.doris_hosts] 192.168.1.239 192.168.1.241 192.168.1.243 ##集群cluster1中fe所在机器的ip [cluster1.frontends] 192.168.1.239 192.168.1.241 192.168.1.243 ##集群cluster1中master节点所在的ip [cluster1.master] 192.168.1.241 ##集群cluster1中follower所在节点的ip [cluster1.follower] 192.168.1.239 192.168.1.243 ##集群cluster1中be所在节点的ip [cluster1.backends] 192.168.1.239 192.168.1.241 192.168.1.243 ## 要进行扩缩容的fe所在的ip [cluster1.scale_fe] 192.168.1.239 ## 要进行扩缩容的be所在的ip [cluster1.scale_be] 192.168.1.239 ## 要进行扩缩容的broker所在的ip [cluster1.scale_broker] 192.168.1.239 ##集群cluster1中broker节点所在的ip [cluster1.brokers] 192.168.1.239 192.168.1.241 192.168.1.243
-
vi setup_vars.yml
--- # 生产环境的fe.conf所在路径。 # 如果没有特殊配置,建议使用安装包内的fe.conf,请根据机器情况酌情配置priority_networks fe_conf_path: /home/doris_ansible/fe.conf #生产环境的be.conf所在路径。 # 如果没有特殊配置,建议使用安装包内的be.conf,请根据机器情况酌情配置priority_networks be_conf_path: /home/doris_ansible/be.conf # heartbeat_service_port,请和be.conf中的heartbeat_service_port配置保持一致 heartbeat_service_port: 9056 # edit_log_port,请和fe.conf中的edit_log_port配置保持一致 edit_log_port: 9016 # query_port,请和fe.conf中的query_port配置保持一致 query_port: 9036 # broker_ipc_port,请和apache_hdfs_broker.conf中的broker_ipc_port保持一致 broker_ipc_port: 8000 # 待安装的doris压缩包所在路径,请写绝对路径 doris_filepath: /home/doris_ansible/PALO-0.15.1-rc09-binary.tar.gz # doris压缩包要解压安装的位置 dest_filepath: /home/doris_ansible #解压后,doris的安装目录 doris_home: /home/doris_ansible/PALO-0.15.1-rc09-binary (已移除) # 安装后,doris中fe所在的位置,如无特殊情况,一般在dest_path下当前安装版本目录下的fe (已移除) fe_path: /home/doris_ansible/PALO-0.15.1-rc09-binary/fe (已移除) # 安装后,doris中be所在的位置,如无特殊情况,一般在dest_path下当前安装版本目录下的be (已移除) be_path: /home/doris_ansible/PALO-0.15.1-rc09-binary/be (已移除) # 安装后,doris中broker所在的位置,如无特殊情况,一般在dest_path下当前安装版本目录下的apache_hdfs_broker (已移除) broker_path: /home/doris_ansible/PALO-0.15.1-rc09-binary/apache_hdfs_broker # 机器java_home所在路径,请确保所有机器保持一致 java_home: /usr/java/jdk1.8.0_131 (已移除) # master所在的机器ip (已移除) master: 192.168.1.241
-
vi ./conf/cluster1.yml
--- follower: [192.168.1.239,192.168.1.243] backends: [192.168.1.239,192.168.1.241,192.168.1.243] brokers: [192.168.1.239,192.168.1.241,192.168.1.243] ##(增加配置,在对应集群配置文件中指定该集群的master) master: 192.168.1.241 ##(增加配置,在对应集群配置文件中指定fe节点的ip网段) fe_ip_conf: 192.168.1.0/24 ##(增加配置,在对应集群配置文件中指定be节点的ip网段) be_ip_conf: 192.168.1.0/24
ansible-playbook -e "cluster=cluster1" ./core/check_env.yml
ansible-playbook -e "cluster=cluster1" ./core/setup.yml
ansible-playbook -e "cluster=cluster1" ./core/add_roles.yml
可以根据自己配置的具体情况,登录集群,通过show frontends;show backends;show broker;查看集群的搭建情况
#stop all
ansible-playbook -e "cluster=cluster1" ./core/stop_all.yml
#start all
ansible-playbook -e "cluster=cluster1" ./core/start_all.yml
-
vi ./conf/upgrade_vars.yml
--- #需要回滚或者升级的压缩包所在路径 newdoris_filepath: /home/doris_ansible/PALO-0.15.3-release-binary.tar.gz #压缩包解压路径 newdoris_destpath: /home/doris_ansible #解压后的doris_home newdoris_home: /home/doris_ansible/PALO-0.15.3-release-binary #java_home所在路径 java_home: /usr/java/jdk1.8.0_131
ansible-playbook -e "cluster=cluster1" ./core/upgrade.yml
-
vi /etc/ansible/hosts 增加以下配置
## 要进行扩缩容的fe所在的ip [cluster1.scale_fe] 192.168.1.239 ## 要进行扩缩容的be所在的ip [cluster1.scale_be] 192.168.1.239 ## 要进行扩缩容的broker所在的ip [cluster1.scale_broker] 192.168.1.239
-
vi ./conf/scale_be_vars.yml
--- ## 要进行扩缩容的be backends: 192.168.1.239
-
vi ./conf/scale_broker_vars.yml
--- ## 要进行扩缩容的broker brokers: 192.168.1.239
-
vi ./conf/scale_fe_vars.yml
--- ## 要进行扩缩容的fe frontends: 192.168.1.239
-
broker
ansible-playbook -e "cluster=cluster1 action=in" ./core/scale_broker.yml
-
be
ansible-playbook -e "cluster=cluster1 action=in" ./core/scale_be.yml
-
fe
ansible-playbook -e "cluster=cluster1 action=in" ./core/scale_fe.yml
-
broker
ansible-playbook -e "cluster=cluster1 action=out" ./core/scale_broker.yml
-
be
ansible-playbook -e "cluster=cluster1 action=out" ./core/scale_be.yml
-
fe
ansible-playbook -e "cluster=cluster1 action=out" ./core/scale_fe.yml
-
(如有多个集群,请在对应配置中配置好对应的cluster配置,host中clusterX应当于配置文件clusterX.yml和启动命令中的clusterX保存一致)
-
节点规划
3fe + 3be + 3broker
-
frontends
192.168.1.239 192.168.1.241 192.168.1.243
-
backends
192.168.1.239 192.168.1.241 192.168.1.243
-
brokers
192.168.1.239 192.168.1.241 192.168.1.243
-
master
192.168.1.241
-
follower
192.168.1.239 192.168.1.243
-
安装所需压缩包所在路径
/home/doris_ansible/PALO-0.15.3-release-binary.tar.gz
-
生产环境fe和be的配置环境所在位置
/home/doris_ansible/fe.conf /home/doris_ansible/be.conf
-
java_home
/usr/java/jdk1.8.0_131
-
编辑主机组
vi /etc/ansible/hosts 添加以下内容 [cluster1.doris_hosts] 192.168.1.239 192.168.1.241 192.168.1.243 [cluster1.frontends] 192.168.1.239 192.168.1.241 192.168.1.243 [cluster1.master] 192.168.1.241 [cluster1.follower] 192.168.1.239 192.168.1.243 193. [cluster1.backends] 192.168.1.239 192.168.1.241 192.168.1.243 [cluster1.scale_fe] 192.168.1.239 [cluster1.scale_be] 192.168.1.239 [cluster1.scale_broker] 192.168.1.239 [cluster1.brokers] 192.168.1.239 192.168.1.241 192.168.1.243
-
编辑初始化配置
vi setup_vars.yml --- heartbeat_service_port: 9050 edit_log_port: 9010 query_port: 9030 broker_ipc_port: 8000 doris_filepath: /home/doris_ansible/PALO-0.15.1-rc09-binary.tar.gz dest_filepath: /home/doris_ansible doris_home: /home/doris_ansible/PALO-0.15.1-rc09-binary fe_conf_path: /home/doris_ansible/fe.conf be_conf_path: /home/doris_ansible/be.conf java_home: /usr/java/jdk1.8.0_131 vi ./conf/cluster1.yml --- follower: [192.168.1.239,192.168.1.243] backends: [192.168.1.239,192.168.1.241,192.168.1.243] brokers: [192.168.1.239,192.168.1.241,192.168.1.243] master: 192.168.1.241
-
启动初始化操作
ansible-playbook -e "cluster=cluster1" setup.yml
-
添加角色
ansible-playbook -e "cluster=cluster1" add_roles.yml
-
前置条件
集群从2.1.3升级为2.1.4 新安装包所在目录为/home/doris_ansible/PALO-0.15.3-release-binary.tar.gz
-
编辑升降级配置文件
vi upgrade_vars.yml --- newdoris_filepath: /home/doris_ansible/PALO-0.15.3-release-binary.tar.gz newdoris_destpath: /home/doris_ansible newdoris_home: /home/doris_ansible/PALO-0.15.3-release-binary java_home: /usr/java/jdk1.8.0_131
-
执行升降级操作
ansible-playbook -e "cluster=cluster1" upgrade.yml
-
查看集群状态
通过show frontends;show backends;show broker;查看版本信息
- 前置条件 这里测试扩缩容 192.168.1.239机器的fe be broker
- 编辑配置文件
vi scale_fe_vars.yml
---
frontends: 192.168.1.239
vi scale_be_vars.yml
---
backends: 192.168.1.239
vi scale_broker_vars.yml
---
brokers: 192.168.1.239
-
执行扩容
ansible-playbook -e "cluster=cluster1 action=out" ./core/scale_broker.yml ansible-playbook -e "cluster=cluster1 action=out" ./core/scale_be.yml ansible-playbook -e "cluster=cluster1 action=out" ./core/scale_fe.yml
-
执行缩容
ansible-playbook -e "cluster=cluster1 action=in" ./core/scale_broker.yml ansible-playbook -e "cluster=cluster1 action=in" ./core/scale_be.yml ansible-playbook -e "cluster=cluster1 action=in" ./core/scale_fe.yml