标签:cat exchange get 测试 creat 公司 case 脚本 1.4
1.防火墙转发规则:
[root@docker ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: em1
sources:
services: dhcpv6-client ssh
ports: 50001/tcp 3306/tcp 5672/tcp 6379/tcp 15672/tcp
protocols:
masquerade: no
forward-ports: port=8012:proto=tcp:toport=8012:toaddr=172.17.0.5
port=50001:proto=tcp:toport=22:toaddr=172.17.0.2
port=27017:proto=tcp:toport=27017:toaddr=172.17.0.6
port=8070:proto=tcp:toport=8070:toaddr=172.17.0.3
port=8056:proto=tcp:toport=8056:toaddr=172.17.0.4
port=15672:proto=tcp:toport=15672:toaddr=172.17.0.9
port=8080:proto=tcp:toport=8080:toaddr=172.17.0.2
port=5672:proto=tcp:toport=5672:toaddr=172.17.0.9
port=6379:proto=tcp:toport=6379:toaddr=172.17.0.7
port=3306:proto=tcp:toport=3306:toaddr=172.17.0.8
sourceports:
icmp-blocks:
rich rules:
[root@docker ~]#
注意删转发规则的时候记得:--permanent,在这里卡了一下
2,启动的容器:用母鸡目录做的数据卷儿:
[root@docker ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
627d468a004a 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp rabbitmq
c96f41b44943 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp mysql
aada204303bd 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp redis
385a5ae88f46 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp mongodb
4fe159f3e1c2 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp statistics
3ff1bb4aa177 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp filter
9e876e75b836 894a84a4a21f "/usr/sbin/init" 8 hours ago Up 8 hours 22/tcp message
b50807faca74 894a84a4a21f "/usr/sbin/init" 9 hours ago Up 9 hours 22/tcp java
[root@docker ~]#
3.考虑自动部署的问题:
容器脚本1:就是jar包修改了就自动重启。
[root@b50807faca74 ~]# cat duibi.sh
#!/bin/bash
b=`sed -n ‘1p‘ a`
a=`stat -c %Y /data/exchange/exchange-1.4.jar`
echo $a > a
if [ "$a" == "$b" ];then
echo "ok" >> a
else
cd /data/exchange/
ps -ef|grep exchange-1.4.jar | grep -v grep|awk -F ‘ ‘ ‘{print $2}‘|xargs kill -9
nohup java -jar exchange-1.4.jar & > nohup.out >/dev/null
fi
母鸡脚本2:
[root@docker ~]# cat genxin.sh
#!/bin/bash
genxin(){
wget $3 -O $2
mv $2 $1
}
echo ‘Input a number between e,f,m,s‘
echo ‘and‘
echo ‘Input url ‘
echo ‘Your number is:\c‘
read -p "number:" a
read -p "url:" url
read -p "downurl:" downurl
bao=`echo "$url"|awk -F "/" ‘{print $NF}‘`
case $a in
e)
echo ‘You select e‘
dir=/data/exchange
genxin $dir $bao $downurl
;;
s)
echo ‘You select s‘
dir=/data/statistics
genxin $dir $bao $downurl
;;
f) echo ‘You select f‘
dir=/data/filter
genxin $dir $bao $downurl
;;
m) echo ‘You select m‘
dir=/data/message
genxin $dir $bao $downurl
;;
*) echo ‘You do not select a number between 1 to 4‘
;;
esac
注意:jar包在文件服务器seafile,里面,只需要传两个下载地址就可以了!感觉心里还是不是这么自动!!!明天再想想
标签:cat exchange get 测试 creat 公司 case 脚本 1.4
原文地址:http://www.cnblogs.com/Jt00/p/6994293.html