dubbo搭建:linux下dubbo-admin安装部署
---------------------------------------------------------------------------------------------------------
1. 安装环境
1) dubbo部署服务器:
服务器:uatdubbo01
IP:10.168.11.170
部署容器:apache-tomcat-7.0.63
端口:8080
2) 服务器配置:
2Core/4GMem/80GHDD
3) 软件版本:
linux:CentOS6.6
tomcat: apache-tomcat-7.0.63.tar.gz
jdk: jdk1.7.0_80
2. 安装tomcat及dubbo控制台部署
2.1. tomcat安装与配置
1) 解压tomcat安装包
$ sudo tar -zxvf apache-tomcat-7.0.69.tar.gz
2) 将tomcat重命名为dubbo-admin-tomcat
$ sudo mv apache-tomcat-7.0.69 dubbo-admin-tomcat
3) 编辑server.xml 将服务端口改为8080
$ sudo vi server.xml
4) 非root用户下,若需要用root权限启动,配置
/bin/ catalina.sh
export JAVA_HOME=/usr/local/nlp/jdk1.7.0_80
export JRE_HOME=/usr/local/nlp/jdk1.7.0_80/jre
否则会提示:没有那个文件目录
5) 移除dubbo-admin-tomcat目录webapps下所有内容
$ sudo rm -rf *
6) 上传dubbo管理控制台程序dubbo-admin-2.5.4-SNAPSHOT.war到dubbo-admin-tomcat/webapps目录下
7) 解压并把目录重命名为ROOT
$ sudo unzip dubbo-admin-2.5.4-SNAPSHOT.war -d ROOT
8) 修改dubbo.properties
$ sudo vi /ROOT/WEB-INF/dubbo.properties
dubbo.registry.address=zookeeper://10.168.11.171:2181?backup=10.168.11.172:2181, 10.168.11.173:2181 #zookeeper地址,需提前部署好zookeeper地址
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
9) 设置tomcat开机自动启动
进入/etc/init.d,新建tomcat文件,文件内容如下:
RETVAL=0
export JRE_HOME=/usr/local/nlp/jdk1.7.0_80
export CATALINA_HOME=/usr/local/nlp/dubbo-admin-tomcat
export CATALINA_BASE=/usr/local/nlp/dubbo-admin-tomcat
start()
{
if [ -f $CATALINA_HOME/bin/startup.sh ];
then
echo $"Starting Tomcat"
$CATALINA_HOME/bin/startup.sh
RETVAL=$?
echo "OK"
return $RETVAL
fi
}
stop()
{
if [ -f $CATALINA_HOME/bin/shutdown.sh ];
then
echo $"Stopping Tomcat"
$CATALINA_HOME/bin/shutdown.sh
RETVAL=$?
sleep 1
ps -fwwu tomcat | grepapache-tomcat|grep -v grep | grep -v PID | awk'{print $2}'|xargs kill -9
echo "OK"
# [ $RETVAL -eq0 ] &&rm -f /var/lock/...
return $RETVAL
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
echo $"Restaring Tomcat"
$0 stop
sleep 1
$0 start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit1
;;
esac
exit $RETVAL
添加可执行权限
$ sudo chmod +x /etc/init.d/tomcat
设置连接
$ ln -s /etc/init.d/tomcat /etc/rc2.d/S16Tomcat
设置随系统启动
$ chkconfig --add tomcat
10) 测试是否安装成功
启动tomcat ,到tomcat的bin目录下,执行:./startup.sh,查看日志是否启动成功。
访问dobbo控制台,在浏览器上输入:
http://10.168.11.170:8080/
出现如下页面,说明部署成功:
------------------------------------------------------------------------------------------------------------------------------