单元测试OK,封装为Dubbo服务。
 

添加依赖

pom.xml
  <properties>
      <dubbo.version>2.5.3</dubbo.version>
      <zookeeper.version>3.3.3</zookeeper.version>
    <zookeeper.client.version>0.1</zookeeper.client.version>

</properties>  
   ....

        <!--dubbo框架包 -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>dubbo</artifactId>
            <version>${dubbo.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>spring</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>${zookeeper.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>jmxtools</artifactId>
                    <groupId>com.sun.jdmk</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jline</artifactId>
                    <groupId>jline</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jmxri</artifactId>
                    <groupId>com.sun.jmx</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jms</artifactId>
                    <groupId>javax.jms</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>activation</artifactId>
                    <groupId>javax.activation</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>mail</artifactId>
                    <groupId>javax.mail</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.sgroschupf</groupId>
            <artifactId>zkclient</artifactId>
            <version>${zookeeper.client.version}</version>

</dependency>

配置maven-assembly-plugin

pom.xml
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptor>src/main/assembly/assembly.xml</descriptor>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>risk_blacklist_company</finalName>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>

</plugin>  

 
assembly.xml
<!--
 - 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.
-->
<assembly>
    <id>assembly</id>
    <formats>
        <format>tar.gz</format>
    </formats>
    <includeBaseDirectory>true</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>/src/main/bin</directory>
            <outputDirectory>bin</outputDirectory>
            <fileMode>0755</fileMode>
        </fileSet>
        <fileSet>
            <directory>src/main/resources</directory>
            <outputDirectory>conf</outputDirectory>
            <fileMode>0644</fileMode>
        </fileSet>
        <fileSet>
            <directory>src/main/resources/conf_${conf.env}</directory>
            <outputDirectory>conf</outputDirectory>
            <fileMode>0644</fileMode>
        </fileSet>
    </fileSets>
    <dependencySets>
        <dependencySet>
            <outputDirectory>lib</outputDirectory>
        </dependencySet>
    </dependencySets>

</assembly>  

 

打包上传

生成tar.gz包:mvn clean package
上传至Linux服务器
解压缩:tar zxvf XXX.tar.gz
如果存在相同目录,则删除目录:rm -r dir
 

配置运行

关注conf/dubbo.properties中参数:“dubbo.registry.address”、“dubbo.registry.port”、”dubbo.log4j.file“
 
执行bin/start.sh
 
查看日志logs/stdout.log等
 

分布式系列 - dubbo服务发布的更多相关文章

  1. 分布式系列 - dubbo服务telnet命令【转】

    dubbo服务发布之后,我们可以利用telnet命令进行调试.管理.Dubbo2.0.5以上版本服务提供端口支持telnet命令,下面我以通过实例抛砖引玉一下: 1.连接服务 测试对应IP和端口下的d ...

  2. 分布式系列 - dubbo服务telnet命令

    dubbo服务发布之后,我们可以利用telnet命令进行调试.管理.Dubbo2.0.5以上版本服务提供端口支持telnet命令,下面我以通过实例抛砖引玉一下: 1.连接服务 测试对应IP和端口下的d ...

  3. dubbo源码之四——dubbo服务发布

    dubbo版本:2.5.4 服务发布是服务提供方向注册中心注册服务过程,以便服务消费者从注册中心查阅并调用服务. 服务发布方在spring的配置文件中配置如下: <bean id="d ...

  4. Dubbo服务发布、引用

    DUBBO原理.应用与面经总结 Dubbo原理和源码解析之服务暴露 Dubbo原理和源码解析之服务引用 服务发布 服务的发布总共做了以下几件事,这个也可以从日志log上看出来: 暴露本地服务 暴露远程 ...

  5. 搞懂Dubbo服务发布与服务注册

    一.前言 本文讲服务发布与服务注册,服务提供者本地发布服务,然后向注册中心注册服务,将服务实现类以服务接口的形式提供出去,以便服务消费者从注册中心查阅并调用服务. 本文源码分析基于org.apache ...

  6. Dubbo——服务发布原理

    引言 在使用Dubbo的时候你一定会好奇它是怎么实现RPC的,而要了解它的调用过程,必然需要先了解其服务发布/订阅的过程,本篇将详细讨论Dubbo的发布过程. 源码分析 发布服务 新学Dubbo大都会 ...

  7. Dubbo源码学习--服务发布(ProxyFactory、Invoker)

    上文分析了Dubbo服务发布的整体流程,但服务代理生成的具体细节介绍得还不是很详细.下面将会接着上文继续分析.上文介绍了服务代理生成的切入点,如下: Invoker<?> invoker ...

  8. Dubbo源码学习--服务发布(DubboProtocol、Exporter)

    在Dubbo服务发布的整体流程一文中,只是分析了服务发布的整体流程,具体的细节还没有进一步分析.本节将继续分析服务暴露的过程.在ServiceConfig中通过一句话即可暴露服务,如下: Export ...

  9. 分布式架构--Dubbo项目实战学习文档

    安装Dubbo注册中心(Zookeeper-3.4.6) 安装Dubbo管理控制台 Tomcat中部署web应用 ---- Dubbo服务消费者Web应用war包的部署 Dubbo监控中心的介绍与简易 ...

随机推荐

  1. centos7常用命令集合

    版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[+]   CentOS7 常用命令集合 这两天一直在对CentOS 7.2进行初体验,各种学习命令肿么用,不过其实大多和DOS是一 ...

  2. [iOS微博项目 - 4.3] - 设置每条微博边框样式

    github: https://github.com/hellovoidworld/HVWWeibo A.设置每条微博边框样式 1.需求 不需要分割线 每个微博之间留有一定的间隙   2.思路 直接设 ...

  3. Chrome cookies folder

    w本地存储数据2种形式. http://superuser.com/questions/292952/chrome-cookies-folder-in-windows-7 chrome://setti ...

  4. windows accounts

    Some built-in groups are used for management purposes. You control which > users belong to these ...

  5. Storm-源码分析-Topology Submit-Supervisor

    mk-supervisor (defserverfn mk-supervisor [conf shared-context ^ISupervisor isupervisor] (log-message ...

  6. Mysql 多主一从数据备份

    Mysql 多主一从数据备份 概述 对任何一个数据库的操作都自动应用到另外一个数据库,始终保持两个数据库中的数据一致. 这样做有如下几点好处: 可以做灾备,其中一个坏了可以切换到另一个. 可以做负载均 ...

  7. c++主程这种事情,就是这样,看人先看人品,没人品,他的能力与你何关?

    这就是人品的重要性........ 接手别人的代码,说困难,也困难,说容易也容易 想把别人代码都读通,理顺,在改原代码BUG,在完美的加功能,那项目越大,越难 想把别人代码里面,加点坑,随便找个模块, ...

  8. error: Error: No resource found for attribute ‘layout_scrollFlags’ in package‘包名’

    遇到error: Error: No resource found for attribute 'layout_scrollFlags' in package'包名' 这个问题时候刚開始自己也是感觉到 ...

  9. shell_03

    函数: fanction print_welcome(){ echo welcome now time is `date` } print_welcome 函数调用 print _welcome 00 ...

  10. Spring-BeanFactory容器

    Spring的BeanFactory容器 这是Spring中最简单地容器,它主要的功能是为依赖注入(DI)提供支持.这个容器接口在org.springframework.beans.factory.B ...