dubbo入门(一):ubuntu14.04 jdk8下 dubbo-admin编译安装

来源:互联网 发布:centos和redhat的区别 编辑:程序博客网 时间:2024/06/07 00:54

本文环境:ubuntu14.04 jdk1.8.0_91 intellij idea

第一步编译dubbo-admin

我刚试了http://dubbo.io/的安装方法 发现一些源已经无法访问了 所以就用编译安装的方法
这是阿里dubbo的github https://github.com/alibaba/dubbo
把源码下载下来后 用mvn编译会有各种问题 所以用intellij打开后在mavenproject里将dubbo-admin的pom.xml导入
这里写图片描述
去掉test的勾选
y由于我用的是jdk8 原先下载下来的pom.xml会有点问题 需要进一步修改
参考链接
http://www.cnblogs.com/varlxj/p/4885489.html
http://blog.csdn.net/zsmissyou/article/details/62445899
最后我的项目依赖如下

<!-- - Copyright 1999-2011 Alibaba Group. -   - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at -   -      http://www.apache.org/licenses/LICENSE-2.0 -   - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License.--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">    <modelVersion>4.0.0</modelVersion>    <parent>        <groupId>com.alibaba</groupId>        <artifactId>dubbo-parent</artifactId>        <version>2.5.4-SNAPSHOT</version>    </parent>    <artifactId>dubbo-admin</artifactId>    <packaging>war</packaging>    <name>${project.artifactId}</name>    <description>The admin module of dubbo project</description>    <properties>        <wtpversion>1.5</wtpversion>        <wtpContextName>/</wtpContextName>        <eclipse.useProjectReferences>false</eclipse.useProjectReferences>        <skip_maven_deploy>false</skip_maven_deploy>        <maven.compiler.source>1.8</maven.compiler.source>        <maven.compiler.target>1.8</maven.compiler.target>    </properties>    <dependencies>        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>dubbo</artifactId>            <version>2.5.3</version>            <exclusions>                <exclusion>                    <groupId>org.springframework</groupId>                    <artifactId>spring</artifactId>                </exclusion>            </exclusions>        </dependency>        <dependency>            <groupId>com.alibaba.citrus</groupId>            <artifactId>citrus-webx-all</artifactId>            <version>3.1.6</version>        </dependency>        <dependency>            <groupId>org.apache.velocity</groupId>            <artifactId>velocity</artifactId>            <version>1.7</version>        </dependency>        <dependency>            <groupId>org.javassist</groupId>            <artifactId>javassist</artifactId>        </dependency>        <dependency>            <groupId>org.jboss.netty</groupId>            <artifactId>netty</artifactId>        </dependency>        <dependency>            <groupId>org.apache.mina</groupId>            <artifactId>mina-core</artifactId>        </dependency>        <dependency>            <groupId>org.glassfish.grizzly</groupId>            <artifactId>grizzly-core</artifactId>        </dependency>        <dependency>            <groupId>org.apache.httpcomponents</groupId>            <artifactId>httpclient</artifactId>        </dependency>        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>fastjson</artifactId>        </dependency>        <dependency>            <groupId>com.thoughtworks.xstream</groupId>            <artifactId>xstream</artifactId>        </dependency>        <dependency>            <groupId>org.apache.bsf</groupId>            <artifactId>bsf-api</artifactId>        </dependency>        <dependency>            <groupId>org.apache.zookeeper</groupId>            <artifactId>zookeeper</artifactId>        </dependency>        <dependency>            <groupId>com.github.sgroschupf</groupId>            <artifactId>zkclient</artifactId>        </dependency>        <dependency>            <groupId>com.netflix.curator</groupId>            <artifactId>curator-framework</artifactId>        </dependency>        <dependency>            <groupId>com.googlecode.xmemcached</groupId>            <artifactId>xmemcached</artifactId>        </dependency>        <dependency>            <groupId>org.apache.thrift</groupId>            <artifactId>libthrift</artifactId>        </dependency>        <dependency>            <groupId>com.caucho</groupId>            <artifactId>hessian</artifactId>        </dependency>        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>servlet-api</artifactId>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>log4j</groupId>            <artifactId>log4j</artifactId>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-api</artifactId>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-log4j12</artifactId>        </dependency>        <dependency>            <groupId>redis.clients</groupId>            <artifactId>jedis</artifactId>        </dependency>        <dependency>            <groupId>javax.validation</groupId>            <artifactId>validation-api</artifactId>        </dependency>        <dependency>            <groupId>org.hibernate</groupId>            <artifactId>hibernate-validator</artifactId>        </dependency>        <dependency>            <groupId>javax.cache</groupId>            <artifactId>cache-api</artifactId>        </dependency>    </dependencies>    <build>        <plugins>            <plugin>                <groupId>org.mortbay.jetty</groupId>                <artifactId>maven-jetty-plugin</artifactId>                <version>${jetty_version}</version>                <configuration>                    <contextPath>/</contextPath>                    <scanIntervalSeconds>10</scanIntervalSeconds>                    <connectors>                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">                            <port>8080</port>                            <maxIdleTime>60000</maxIdleTime>                        </connector>                    </connectors>                </configuration>            </plugin>        </plugins>    </build></project>

改完之后 点击package打包一个dubbo-admin的war出来

第二步是安装zookeeper

dubbo本身应该是一个rpc也就是远程调度框架 如果我们分布式服务单纯只是做成一些各个服务的接口 供另一些服务器curl 获得json等等
那么当服务接口越来越多,甚至需要对每个服务的服务器进行负载均衡时,我们这些服务的接口将变得非常难以维护
所以我们需要zookeeper来作为服务注册中心 帮我们管理各个服务的服务器集群 我们只需要跟zookeeper拿服务接口即可~

http://apache.fayea.com/zookeeper/
下载完后写一个zoo.cfg 然后用bin/zkServer.sh start启动即可

第三步是部署刚才的war到tomcat中

这个简单啦
在war解压后的文件目录的WEB-INF里可以看到一个dubbo.properties
里面有dubbo-admin的管理员账号密码
登陆后看到如下 搞定
这里写图片描述

原创粉丝点击