1. 程式人生 > >centos7下Dubbo-admin管理平臺的安裝

centos7下Dubbo-admin管理平臺的安裝

1.到地址 https://github.com/alibaba/dubbo 下載dubbo原始碼 

 

 

2.解壓縮zip檔案到 “ D:\技術資料\zookeeper\dubbo-master\dubbo-master” 目錄下

 

手動打包,這裡只需要打包dubbo-admin的war包,所以進入dubbo-admin目錄下使用maven打包mvn package -Dmaven.skip.test=true 然後就可以在target目錄下看到打包好的war包了 
3.檢視war包下的WEB-INF目錄下的dubbo.propeties檔案

dubbo.registry.address=zookeeper://192.168.2.2:2181
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest

預設配置的就是本機的zookeeper的2181埠,記住使用者名稱密碼root/root和guest/guest

此時本來直接啟動tomcat就可以了,但是由於zk預設使用的是8080埠,為了防止衝突,修改conf/server.xml配置埠為8082,再執行bin/startup.cmd.(如果本機配置了多個Tomcat的話,如果環境變數中的CATALINA_HOME和當前tomcat目錄不一致的話,可以在startup.cmd開頭配置set CATALINA_HOME =當前tomcat目錄

tomcat的server.xml配置調整如下

 <Connector port="8082" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />


 <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
         <!--dubbo-admin控制檯 -->
         <Context docBase="/usr/local/java/dubbo-admin" path="/" reloadable="true" />

      </Host>

訪問地址:http://192.168.2.2:8080/

輸入root,root

4.dubbo-admin配置自啟動

vim /etc/init.d/dubboAdmin

新增指令碼內容:

#!/bin/bash
# description: Tomcat7 Start Stop Restart
# processname: tomcat7
# chkconfig: 234 20 80
export JAVA_HOME=/usr/local/java/jdk1.8.0_181
export JRE_HOME=${JAVA_HOME}/jre
export PATH=$PATH:${JAVA_HOME}/bin:${JRE_HOME}/bin

DUBBOADMIN_HOME=/usr/local/java/tomcat/tomcat-8082-dubbo-admin

case $1 in
        start)
                sh ${DUBBOADMIN_HOME}/bin/startup.sh
                ;;
        stop)
                sh ${DUBBOADMIN_HOME}/bin/shutdown.sh
                ;;
        restart)
                sh ${DUBBOADMIN_HOME}/bin/shutdown.sh
                sh ${DUBBOADMIN_HOME}/bin/startup.sh
                ;;
        *)
                echo 'please use : tomcat {start | stop | restart}'
        ;;
esac
exit 0

:wq 儲存指令碼。

執行指令碼,啟動、停止 和 重啟服務。

啟動:service tomcat start

停止:service tomcat stop

重啟:service tomcat restart

加入到服務列表中

chkconfig --add dubboAdmin
chkconfig dubboAdmin on

chkconfig --list | grep dubboAdmin

防火牆開放8082埠

firewall-cmd --permanent --zone=public --add-port=8082/tcp  //永久的新增該埠
firewall-cmd --reload //載入配置,使得修改有效