forked from kangliqiang/RocketMQ-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
117 lines (106 loc) · 2.54 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
PROG_NAME=rocketmq
SHELL_PATH=$(cd "$(dirname "$0")"; pwd)
#NS="10.232.26.122 10.232.25.81"
BROKER="10.232.25.82 10.232.25.83"
NS="10.232.26.122"
#BROKER="10.232.25.82"
NS_PORT=9876
TGZ_NAME=alibaba-rocketmq-3.0.0-SNAPSHOT.tar.gz
usage() {
echo "Usage: ${PROG_NAME} {package|dispatch|start|stop|ns|broker|cleanlog|cleanstore|clean|show}"
exit 1;
}
package(){
echo "############################# package #################################"
sh develop.sh
}
dispatch(){
echo "############################# dispatch #################################"
pgmscp -b ${NS} ${BROKER} target/${TGZ_NAME} /home/manhong.yqd
pgm -b ${NS} ${BROKER} "tar zxvf ${TGZ_NAME}"
pgm -b ${NS} ${BROKER} 'rm -rf devenv'
pgm -b ${NS} ${BROKER} 'mv alibaba-rocketmq devenv'
pgm -b ${NS} ${BROKER} 'chmod +x devenv/bin/*'
pgm -b ${NS} ${BROKER} 'sed -i s/#JAVA_OPT_6=/JAVA_OPT_6=/g devenv/bin/runbroker.sh'
pgm -b ${NS} ${BROKER} 'sed -i s/#JAVA_OPT_6=/JAVA_OPT_6=/g devenv/bin/runserver.sh'
}
startup_ns(){
echo "############################# startup nameserver #################################"
pgm -b ${NS} 'killall -9 java'
sleep 1
pgm -b ${NS} 'rm -rf rocketmqlogs'
pgm -b ${NS} './devenv/bin/mqnamesrv' &
sleep 1
pgm -b ${NS} 'ps -ef|grep java'
sleep 1
pgm -b ${NS} "netstat -an|grep ${NS_PORT}"
}
startup_broker(){
echo "############################# startup broker #################################"
pgm -b ${BROKER} 'killall -9 java'
sleep 1
pgm -b ${BROKER} 'rm -rf rocketmqlogs'
tmp=`echo ${NS} | sed "s/ /:${NS_PORT};/g"`":${NS_PORT}"
echo "nameserver:${tmp}"
pgm -b ${BROKER} "./devenv/bin/mqbroker -n '${tmp}'" &
sleep 1
pgm -b ${BROKER} 'ps -ef|grep java'
sleep 1
pgm -b ${BROKER} "netstat -an|grep '${NS_PORT}'"
}
start(){
startup_ns
startup_broker
}
stop(){
pgm -b ${NS} ${BROKER} 'killall -9 java'
}
cleanlog(){
echo "############################# startup log #################################"
pgm -b ${NS} ${BROKER} 'rm -rf rocketmqlogs'
}
cleanstore(){
echo "############################# clean store #################################"
pgm -b ${NS} ${BROKER} 'rm -rf store'
}
show(){
pgm -b ${NS} ${BROKER} 'ps -ef|grep java'
pgm -b ${NS} ${BROKER} "netstat -an|grep '${NS_PORT}'"
}
case "$1" in
package)
package
;;
dispatch)
dispatch
;;
start)
start
;;
stop)
stop
;;
ns)
startup_ns
;;
broker)
startup_broker
;;
cleanlog)
cleanlog
;;
cleanstore)
cleanstore
;;
clean)
cleanlog
cleanstore
;;
show)
show
;;
*)
usage
;;
esac