Dubbo 环境安装和配置

Dubbo-Admin 搭建

需要环境

  • CentOS 6
  • JDK 1.8(必须是 1.8)
  • Tomcat 7 或 8(我测试都可以)
  • Dubbo 版本:2.5.4-SNAPSHOT(当前这个版本是最新的。2.5.3 我测试是不行的)
  • Dubbo-Admin 需要修改部分代码,让它支持 JDK 8,具体看文章:https://github.com/alibaba/dubbo/issues/50
  • 最终我的 Dubbo-admin 的 pom.xml 为这样的:
  1. <!--
  2. - Copyright 1999-2011 Alibaba Group.
  3. -
  4. - Licensed under the Apache License, Version 2.0 (the "License");
  5. - you may not use this file except in compliance with the License.
  6. - You may obtain a copy of the License at
  7. -
  8. - http://www.apache.org/licenses/LICENSE-2.0
  9. -
  10. - Unless required by applicable law or agreed to in writing, software
  11. - distributed under the License is distributed on an "AS IS" BASIS,
  12. - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. - See the License for the specific language governing permissions and
  14. - limitations under the License.
  15. -->
  16. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  17. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  18. <modelVersion>4.0.0</modelVersion>
  19. <parent>
  20. <groupId>com.alibaba</groupId>
  21. <artifactId>dubbo-parent</artifactId>
  22. <version>2.5.4-SNAPSHOT</version>
  23. </parent>
  24. <artifactId>dubbo-admin</artifactId>
  25. <packaging>war</packaging>
  26. <name>${project.artifactId}</name>
  27. <description>The admin module of dubbo project</description>
  28. <properties>
  29. <wtpversion>1.5</wtpversion>
  30. <wtpContextName>/</wtpContextName>
  31. <eclipse.useProjectReferences>false</eclipse.useProjectReferences>
  32. <skip_maven_deploy>false</skip_maven_deploy>
  33. </properties>
  34. <dependencies>
  35. <dependency>
  36. <groupId>com.alibaba</groupId>
  37. <artifactId>dubbo</artifactId>
  38. <version>${project.parent.version}</version>
  39. <exclusions>
  40. <exclusion>
  41. <groupId>org.springframework</groupId>
  42. <artifactId>spring</artifactId>
  43. </exclusion>
  44. </exclusions>
  45. </dependency>
  46. <dependency>
  47. <groupId>com.alibaba.citrus</groupId>
  48. <artifactId>citrus-webx-all</artifactId>
  49. <version>3.1.6</version>
  50. </dependency>
  51. <dependency>
  52. <groupId>org.apache.velocity</groupId>
  53. <artifactId>velocity</artifactId>
  54. <version>1.7</version>
  55. </dependency>
  56. <dependency>
  57. <groupId>org.javassist</groupId>
  58. <artifactId>javassist</artifactId>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.jboss.netty</groupId>
  62. <artifactId>netty</artifactId>
  63. </dependency>
  64. <dependency>
  65. <groupId>org.apache.mina</groupId>
  66. <artifactId>mina-core</artifactId>
  67. </dependency>
  68. <dependency>
  69. <groupId>org.glassfish.grizzly</groupId>
  70. <artifactId>grizzly-core</artifactId>
  71. </dependency>
  72. <dependency>
  73. <groupId>org.apache.httpcomponents</groupId>
  74. <artifactId>httpclient</artifactId>
  75. </dependency>
  76. <dependency>
  77. <groupId>com.alibaba</groupId>
  78. <artifactId>fastjson</artifactId>
  79. </dependency>
  80. <dependency>
  81. <groupId>com.thoughtworks.xstream</groupId>
  82. <artifactId>xstream</artifactId>
  83. </dependency>
  84. <dependency>
  85. <groupId>org.apache.bsf</groupId>
  86. <artifactId>bsf-api</artifactId>
  87. </dependency>
  88. <dependency>
  89. <groupId>org.apache.zookeeper</groupId>
  90. <artifactId>zookeeper</artifactId>
  91. </dependency>
  92. <dependency>
  93. <groupId>com.github.sgroschupf</groupId>
  94. <artifactId>zkclient</artifactId>
  95. </dependency>
  96. <dependency>
  97. <groupId>com.netflix.curator</groupId>
  98. <artifactId>curator-framework</artifactId>
  99. </dependency>
  100. <dependency>
  101. <groupId>com.googlecode.xmemcached</groupId>
  102. <artifactId>xmemcached</artifactId>
  103. </dependency>
  104. <dependency>
  105. <groupId>org.apache.thrift</groupId>
  106. <artifactId>libthrift</artifactId>
  107. </dependency>
  108. <dependency>
  109. <groupId>com.caucho</groupId>
  110. <artifactId>hessian</artifactId>
  111. </dependency>
  112. <dependency>
  113. <groupId>javax.servlet</groupId>
  114. <artifactId>servlet-api</artifactId>
  115. <scope>provided</scope>
  116. </dependency>
  117. <dependency>
  118. <groupId>log4j</groupId>
  119. <artifactId>log4j</artifactId>
  120. </dependency>
  121. <dependency>
  122. <groupId>org.slf4j</groupId>
  123. <artifactId>slf4j-api</artifactId>
  124. </dependency>
  125. <dependency>
  126. <groupId>org.slf4j</groupId>
  127. <artifactId>slf4j-log4j12</artifactId>
  128. </dependency>
  129. <dependency>
  130. <groupId>redis.clients</groupId>
  131. <artifactId>jedis</artifactId>
  132. </dependency>
  133. <dependency>
  134. <groupId>javax.validation</groupId>
  135. <artifactId>validation-api</artifactId>
  136. </dependency>
  137. <dependency>
  138. <groupId>org.hibernate</groupId>
  139. <artifactId>hibernate-validator</artifactId>
  140. </dependency>
  141. <dependency>
  142. <groupId>javax.cache</groupId>
  143. <artifactId>cache-api</artifactId>
  144. </dependency>
  145. </dependencies>
  146. <build>
  147. <plugins>
  148. <plugin>
  149. <groupId>org.mortbay.jetty</groupId>
  150. <artifactId>maven-jetty-plugin</artifactId>
  151. <version>${jetty_version}</version>
  152. <configuration>
  153. <contextPath>/</contextPath>
  154. <scanIntervalSeconds>10</scanIntervalSeconds>
  155. <connectors>
  156. <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
  157. <port>8080</port>
  158. <maxIdleTime>60000</maxIdleTime>
  159. </connector>
  160. </connectors>
  161. </configuration>
  162. </plugin>
  163. </plugins>
  164. </build>
  165. </project>
  • 部署在 Tomcat 之后,如果需要修改 zookeeper 的地址,以及默认用户的登录密码,可以在这里改:vim /usr/program/tomcat8/webapps/ROOT/WEB-INF/dubbo.properties
  • 里面内容:
  1. dubbo.registry.address=zookeeper://127.0.0.1:2181
  2. dubbo.admin.root.password=root
  3. dubbo.admin.guest.password=guest
  • 如果有多个节点构成的集群也可以这样写:
  1. dubbo.registry.address=zookeeper://192.168.1.121:2181?backup=192.168.1.111:2181,192.168.1.112:2181
  2. dubbo.admin.root.password=root
  3. dubbo.admin.guest.password=guest

Dubbox-Admin 搭建

需要环境

  • CentOS 6
  • JDK 1.8(只测试过 1.8)
  • Tomcat 7 或 8(只测试过 8)
  • Dubbox 版本:dubbo-admin-2.8.4.war(fork 官网最新版本,自己编译的版本)
  • 不需要修改任何 pom.xml 文件,直接就可以运行。