标签:dubbo
安装tomcat
root@kickseed:~# cd /root/work/soft_dir/ root@kickseed:~/work/soft_dir# wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.20/bin/apache-tomcat-8.5.20.tar.gz root@kickseed:~/work/soft_dir# ls apache-maven-3.5.0-bin.tar.gz apache-tomcat-8.5.20.tar.gz jdk-8u77-linux-x64.tar.gz root@kickseed:~/work/soft_dir# mkdir -p /root/work/app_dir/tomcat root@kickseed:~/work/soft_dir# tar xf apache-tomcat-8.5.20.tar.gz -C /root/work/app_dir/tomcat root@kickseed:~/work/soft_dir# ln -sv /root/work/app_dir/tomcat/apache-tomcat-8.5.20/ /root/work/app_dir/tomcat/current ‘/root/work/app_dir/tomcat/current’ -> ‘/root/work/app_dir/tomcat/apache-tomcat-8.5.20/’ root@kickseed:~/work/soft_dir# ll /root/work/app_dir/tomcat/ total 12 drwxr-xr-x 3 root root 4096 Sep 5 20:31 ./ drwxr-xr-x 5 root root 4096 Sep 5 20:29 ../ drwxr-xr-x 9 root root 4096 Sep 5 20:28 apache-tomcat-8.5.20/ lrwxrwxrwx 1 root root 47 Sep 5 20:31 current -> /root/work/app_dir/tomcat/apache-tomcat-8.5.20// root@kickseed:~/work/soft_dir# cd /root/work/app_dir/tomcat/current root@kickseed:~/work/app_dir/tomcat/current# pwd /root/work/app_dir/tomcat/current root@kickseed:~/work/app_dir/tomcat/current# vim /etc/profile.d/tomcat.sh root@kickseed:~/work/app_dir/tomcat/current# cat /etc/profile.d/tomcat.sh export CATALINA_HOME=/root/work/app_dir/tomcat/current export PATH=$CATALINA_HOME/bin:$PATH root@kickseed:~/work/app_dir/tomcat/current# . /etc/profile.d/tomcat.sh root@kickseed:~/work/app_dir/tomcat/current# catalina.sh version Using CATALINA_BASE: /root/work/app_dir/tomcat/current Using CATALINA_HOME: /root/work/app_dir/tomcat/current Using CATALINA_TMPDIR: /root/work/app_dir/tomcat/current/temp Using JRE_HOME: /root/work/app_dir/jdk/current Using CLASSPATH: /root/work/app_dir/tomcat/current/bin/bootstrap.jar:/root/work/app_dir/tomcat/current/bin/tomcat-juli.jar Server version: Apache Tomcat/8.5.20 Server built: Aug 2 2017 21:35:49 UTC Server number: 8.5.20.0 OS Name: Linux OS Version: 4.4.0-31-generic Architecture: amd64 JVM Version: 1.8.0_77-b03 JVM Vendor: Oracle Corporation root@kickseed:~/work/app_dir/tomcat/current#
建立应用目录
root@kickseed:~/work/app_dir/tomcat/current# cd /root/work/ root@kickseed:~/work# cd app_dir/ root@kickseed:~/work/app_dir# ls jdk maven tomcat root@kickseed:~/work/app_dir# mkdir deploy_tomcat root@kickseed:~/work/app_dir# mkdir learn_app root@kickseed:~/work/app_dir# ls deploy_tomcat jdk learn_app maven tomcat root@kickseed:~/work/app_dir# cd learn_app/
dubbo-interfac目录结构
root@kickseed:~/work/app_dir/learn_app/dubbo-interface# tree . ├── pom.xml └── src └── main ├── java │ └── com │ └── kingdz │ └── dubbo │ └── HelloWorld.java └── resources 7 directories, 2 files
root@kickseed:~/work/app_dir/learn_app/dubbo-interface# mvn clean install root@kickseed:~/work/app_dir/learn_app/dubbo-interface# cd ../ root@kickseed:~/work/app_dir/learn_app# ls dubbo-consumer dubbo-interface dubbo-provider root@kickseed:~/work/app_dir/learn_app# cd dubbo-provider/ root@kickseed:~/work/app_dir/learn_app/dubbo-provider# tree . ├── pom.xml └── src └── main ├── java │ ├── com │ │ └── kingdz │ │ └── dubbo │ │ └── impl │ │ └── HelloWorldImpl.java │ └── com.kingdz.dubbo.impl ├── resources │ ├── applicationContext.xml │ └── log4j.properties └── webapp ├── index.jsp └── WEB-INF └── web.xml 11 directories, 6 files root@kickseed:~/work/app_dir/learn_app/dubbo-consumer# mvn clean install root@kickseed:~/work/app_dir/learn_app/dubbo-provider# cd ../dubbo-consumer/ root@kickseed:~/work/app_dir/learn_app/dubbo-consumer# tree . ├── pom.xml └── src └── main ├── java │ └── com │ └── kingdz │ └── dubbo │ └── controller │ └── HelloWorldController.java ├── resources │ ├── applicationContext.xml │ ├── log4j.properties │ └── spring-mvc.xml └── webapp ├── index.jsp └── WEB-INF └── web.xml 10 directories, 7 files root@kickseed:~/work/app_dir/learn_app/dubbo-consumer# mvn clean install
http://www.apache.org/dyn/closer.cgi/zookeeper/ 下载地址zookeeper http://mirror.bit.edu.cn/apache/zookeeper/ http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
root@kickseed:~# cd /root/work/soft_dir/ root@kickseed:~/work/soft_dir# wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz root@kickseed:~/work/soft_dir# ls apache-maven-3.5.0-bin.tar.gz apache-tomcat-8.5.20.tar.gz jdk-8u77-linux-x64.tar.gz zookeeper-3.4.6.tar.gz root@kickseed:~/work/soft_dir# mkdir -p /root/work/app_dir/zookeeper root@kickseed:~/work/soft_dir# tar xf zookeeper-3.4.6.tar.gz -C /root/work/app_dir/zookeeper/ root@kickseed:~/work/soft_dir# ls /root/work/app_dir/zookeeper/ zookeeper-3.4.6 root@kickseed:~/work/soft_dir# cd /root/work/app_dir/zookeeper/ root@kickseed:~/work/app_dir/zookeeper# ln -sv /root/work/app_dir/zookeeper/zookeeper-3.4.6/ /root/work/app_dir/zookeeper/current ‘/root/work/app_dir/zookeeper/current’ -> ‘/root/work/app_dir/zookeeper/zookeeper-3.4.6/’ root@kickseed:~/work/app_dir/zookeeper# ls current zookeeper-3.4.6 root@kickseed:~/work/app_dir/zookeeper# cd current root@kickseed:~/work/app_dir/zookeeper/current# cp conf/zoo_sample.cfg conf/zoo.cfg root@kickseed:~/work/app_dir/zookeeper/current# vim conf/zoo.cfg 修改添加下面两行 dataDir=/root/work/app_dir/zookeeper/data dataLogDir=/root/work/app_dir/zookeeper/datalog root@kickseed:~/work/app_dir/zookeeper/current# mkdir -pv /root/work/app_dir/zookeeper/{data,datalog} mkdir: created directory ‘/root/work/app_dir/zookeeper/data’ mkdir: created directory ‘/root/work/app_dir/zookeeper/datalog’ root@kickseed:~/work/app_dir/zookeeper/current# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 50 *:3306 *:* LISTEN 0 128 :::22 :::* root@kickseed:~/work/app_dir/zookeeper/current# bin/zkServer.sh start JMX enabled by default Using config: /root/work/app_dir/zookeeper/current/bin/../conf/zoo.cfg Starting zookeeper ... STARTED root@kickseed:~/work/app_dir/zookeeper/current# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 50 *:3306 *:* LISTEN 0 128 :::22 :::* LISTEN 0 50 :::44378 :::* LISTEN 0 50 :::2181
root@kickseed:~/work/app_dir/learn_app# ls dubbo-consumer dubbo-interface dubbo-provider root@kickseed:~/work/app_dir/learn_app# git clone https://github.com/alibaba/dubbo.git root@kickseed:~/work/app_dir/learn_app# ls dubbo dubbo-consumer dubbo-interface dubbo-provider root@kickseed:~/work/app_dir/learn_app# cd dubbo root@kickseed:~/work/app_dir/learn_app/dubbo# ls codestyle dubbo-cluster dubbo-container dubbo-maven dubbo-remoting dubbo-test NOTICE dubbo dubbo-common dubbo-demo dubbo-monitor dubbo-rpc hessian-lite pom.xml dubbo-admin dubbo-config dubbo-filter dubbo-registry dubbo-simple LICENSE README.md root@kickseed:~/work/app_dir/learn_app/dubbo# mvn clean install -Dmaven.test.skip=true root@kickseed:~/work/app_dir/learn_app/dubbo# cd dubbo-admin/ root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls target/ classes dubbo-admin-2.5.4-SNAPSHOT dubbo-admin-2.5.4-SNAPSHOT.war generated-sources maven-archiver maven-status root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/ deploy_tomcat/ jdk/ learn_app/ maven/ tomcat/ root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/ root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cp -rf /root/work/app_dir/tomcat/apache-tomcat-8.5.20/ /root/work/app_dir/deploy_tomcat/app_name root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/app_name/ bin conf lib LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -rf /root/work/app_dir/deploy_tomcat/app_name/bin/* root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -rf /root/work/app_dir/deploy_tomcat/app_name/lib root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/app_name/ conf LICENSE logs NOTICE RELEASE-NOTES RUNNING.txt temp webapps work root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/LICENSE root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/NOTICE root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/RELEASE-NOTES root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# rm -f /root/work/app_dir/deploy_tomcat/app_name/RUNNING.txt root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# ls /root/work/app_dir/deploy_tomcat/app_name/ bin conf logs temp webapps work root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cat /root/work/app_dir/deploy_tomcat/app_name/bin/appctl.sh #!/bin/bash export CATALINA_BASE=$(cd $(dirname $0);cd ../;pwd) echo $CATALINA_BASE case $1 in start) catalina.sh start ;; stop) catalina.sh stop ;; restart) catalina.sh stop catalina.sh start ;; *) exit 1 ;; esac root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cat target/dubbo-admin-2.5.4-SNAPSHOT/WEB-INF/dubbo.properties dubbo.registry.address=zookeeper://127.0.0.1:2181 dubbo.admin.root.password=root dubbo.admin.guest.password=guest root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cp -rf /root/work/app_dir/deploy_tomcat/app_name/ /root/work/app_dir/deploy_tomcat/dubbo-admin root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cp target/dubbo-admin-2.5.4-SNAPSHOT.war /root/work/app_dir/deploy_tomcat/dubbo-admin/webapps/ root@kickseed:~/work/app_dir/learn_app/dubbo/dubbo-admin# cd /root/work/app_dir/deploy_tomcat/dubbo-admin root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-admin# bin/appctl.sh start /root/work/app_dir/deploy_tomcat/dubbo-admin Using CATALINA_BASE: /root/work/app_dir/deploy_tomcat/dubbo-admin Using CATALINA_HOME: /root/work/app_dir/tomcat/current Using CATALINA_TMPDIR: /root/work/app_dir/deploy_tomcat/dubbo-admin/temp Using JRE_HOME: /root/work/app_dir/jdk/current Using CLASSPATH: /root/work/app_dir/tomcat/current/bin/bootstrap.jar:/root/work/app_dir/tomcat/current/bin/tomcat-juli.jar Tomcat started. root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-admin# ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 *:22 *:* LISTEN 0 50 *:3306 *:* LISTEN 0 128 :::22 :::* LISTEN 0 50 :::44378 :::* LISTEN 0 50 :::2181 :::* LISTEN 0 100 :::8009 :::* LISTEN 0 100 :::8080 :::* root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -n ‘s#\(<Connector.*\)8009\(.*protocol.*$\)#\19009\2#gp‘ conf/server.xml <Connector port="9009" protocol="AJP/1.3" redirectPort="8443" /> root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -n ‘s#\(<Server.*\)8005\(.*SHUTDOWN.*$\)#\19005\2#gp‘ conf/server.xml <Server port="9005" shutdown="SHUTDOWN"> root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -n ‘s#\(<Connector.*\)8080\(.*protocol.*$\)#\19080\2#gp‘ conf/server.xml <Connector port="9080" protocol="HTTP/1.1" root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -i ‘s#\(<Connector.*\)8009\(.*protocol.*$\)#\19009\2#g‘ conf/server.xml root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -i ‘s#\(<Server.*\)8005\(.*SHUTDOWN.*$\)#\19005\2#g‘ conf/server.xml root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# sed -i ‘s#\(<Connector.*\)8080\(.*protocol.*$\)#\19080\2#g‘ conf/server.xml root@kickseed:~/work/app_dir/deploy_tomcat/dubbo-provider# grep -E ‘9005|9009|9080‘ conf/server.xml <Server port="9005" shutdown="SHUTDOWN"> <Connector port="9080" protocol="HTTP/1.1" <Connector port="9009" protocol="AJP/1.3" redirectPort="8443" />
http://www.itdadao.com/articles/c15a1410127p0.html
https://my.oschina.net/wangt10/blog/522799
http://www.cnblogs.com/yxl10/p/4143884.html
本文出自 “甘木” 博客,请务必保留此出处http://ganmu.blog.51cto.com/9305511/1963214
标签:dubbo
原文地址:http://ganmu.blog.51cto.com/9305511/1963214