CMQ-1.0.2-软件包.tar安装包放在家目录,脚本也放在家目录,然后执行:sh -x cmq_install.sh [ip1] [ip2] [ip3] 即可
下列脚本代码保存为:cmq_install.sh
sh -x cmq_install.sh 10.0.0.101 10.0.0.102 10.0.0.103
#!/bin/bash
#CMQ一键部署
#如:sh -x cmq_install.sh 10.0.0.101 10.0.0.102 10.0.0.103
soft='CMQ-1.0.2-软件包.tar'
ip_a=$1
ip_b=$2
ip_c=$3
password=123456
coreNum=6
if [ $# != 3 ];then
echo "请输入3个主机IP"
exit 1;
fi
mkdir -p /opt/tmp
cd /root
#安装cmq_console组件
if [ ! -f $soft ];then
echo "软件包: ${soft}不存在"
exit 1
else
tar xf ${soft}
cp -r v1.0.0/cmq_console/precomponent/* /opt/tmp/
cd /opt/tmp/
sh pre_component_install.sh $ip_a $ip_a
echo "安装cmq_console组件完成..."
fi
cp -r /root/v1.0.0/cmq_console/auth-access/* /opt/tmp
sh access_auto_install.sh $ip_a $ip_a
#安装cmq_backserver
cp -r /root/v1.0.0/cmq_backserver /opt/tmp
cd /opt/tmp/cmq_backserver
sed -i "s/^passwd=.*/passwd=${password}
/" config.txt
sed -i "s/^routeProxy=.*/routeProxy=${ip_c}
/" config.txt
sed -i "s/^access=.*/access=${ip_b} ${ip_c}
/" config.txt
sed -i "s/^pushServer=.*/pushServer=${ip_b}
/" config.txt
sed -i "s/^broker=.*/broker=${ip_a} ${ip_b} ${ip_c}
/" config.txt
sed -i "s/^monitor=.*/monitor=${ip_a} ${ip_c}
/" config.txt
sed -i "s/^master=.*/master=${ip_a} ${ip_b}
/" config.txt
sed -i "s/^oss=.*/oss=${ip_b}
/" config.txt
sed -i "/^coreNum=.*/d" config.txt
sed -i "/^oss=.*/a\coreNum=${coreNum}
" config.txt
sed -i "s/^barad=.*/barad=${ip_c}
/" config.txt
sed -i "s/^ctsdb=.*/ctsdb=${ip_a} ${ip_b} ${ip_c}
/" config.txt
sed -i "s/^jvmMem=.*/jvmMem=4g
/" config.txt
sed -i "s/^indexTtl=.*/indexTtl=30
/" config.txt
sed -i "s/^metricTtl=.*/metricTtl=7
/" config.txt
sed -i "s/^nameserverVip=.*/nameserverVip=${ip_c}
/" config.txt
sed -i "s/^baradIp=.*/baradIp=${ip_c}
/" config.txt
sed -i "s/^ctsdbIp=.*/ctsdbIp=${ip_a}
/" config.txt
sed -i "s/^dbhost=.*/dbhost=${ip_a}
/" config.txt
#安装
sh install_all.sh config.txt
安装后配置:
http://[ip]/tsf-manager/action-path?rid=1
搜索cmq,两个带IP结果都改为oss组件IP
[root@node_66 ~]# cd /opt/tmp/cmq_backserver
[root@node_66 cmq_backserver]# grep oss config.txt
#oss=172.16.66.198 172.16.67.224
oss=192.168.1.110
搜索monitor,确定barad IP monitor的IP需要改为barad的IP,IP写第一个就可以了
[root@tdsql1 cmq_backserver]# grep monit config.txt
monitor=10.0.0.101 10.0.0.103
至此CMQ基本搭建完成