1、dubbo 有一个 dubbo.properties 作为默认配置

默认配置可以在不添加新的配置的前提下使用dubbo

dubbo.properties 的内容(来自 https://github.com/alibaba/dubbo)

2、dubbo 学习参考链接

·dubbo-admin管理控制台的安装和使用:http://www.cnblogs.com/aqsunkai/p/6690607.html

·dubbo官网,下载和配置说明:http://dubbo.io/

·dubbo结合Spring:http://blog.csdn.net/congcong68/article/details/41113239

·dubbo 配置 :http://www.cnblogs.com/linjiqin/p/5859153.html

·zookeeper 基本含义: http://blog.csdn.net/gyflyx/article/details/18652913

3、本地环境搭建-zookeeper(windows 环境)

http://blog.csdn.net/bestcxx/article/details/73440892

4、从github下载 dubbo 测试所需的几个工程

https://github.com/alibaba/dubbo

先全部下载,然后取其中的 dubbo-admin和dubbo-demo

dubbo-admin是dubbo监控平台,可以打包为war或者直接jetty运行(maven 配置 jetty 插件),启动后访问 http://localhost:9999/dubbo-admin 端口9999看你怎么定义了

需要输入用户名和密码:root/root

之后点击 返回首页

然后进入预期的界面了

dubbo-demo聚合了demo-api\demo-consumer\demo-provider

demo-api是接口,demo-proveider 实现了demo-api

demo-provider是提供者

demo-consumer是消费者

demo-provider和demo-consumer 都是在test中提供main方法启动,demo-consumer 一直调用,可以看到两个平台的交互

5、实验得出的结论

dubbo.properties 会起到默认配置的作用

但是 dubbo-demo-provider.xml 中的配置可以对dubbo.properties 的配置进行覆盖和扩展(这意味着某些配置不是必须的)

dubbo-demo-provider.xml 的内容(DemoTwoServiceImpl.java 和 DemoTwoService.java 是新增的两个类,分别加在dubbo-provider 和 dubbo-api中,参照先例即可)

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. - Copyright 1999-2011 Alibaba Group.
  4. -
  5. - Licensed under the Apache License, Version 2.0 (the "License");
  6. - you may not use this file except in compliance with the License.
  7. - You may obtain a copy of the License at
  8. -
  9. -      http://www.apache.org/licenses/LICENSE-2.0
  10. -
  11. - Unless required by applicable law or agreed to in writing, software
  12. - distributed under the License is distributed on an "AS IS" BASIS,
  13. - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. - See the License for the specific language governing permissions and
  15. - limitations under the License.
  16. -->
  17. <beans xmlns="http://www.springframework.org/schema/beans"
  18. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  19. xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
  20. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
  21. http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
  22. <!-- bean的声明和Spring无差异 -->
  23. <bean id="demoService" class="com.alibaba.dubbo.demo.provider.DemoServiceImpl" />
  24. <bean id="demoTwoService" class="com.alibaba.dubbo.demo.provider.DemoTwoServiceImpl" />
  25. <!-- 由于dubbo.propertirs 的存在,可以直接配置 <dubbo:service>对外暴露服务,即存在默认的配置, -->
  26. <dubbo:service interface="com.alibaba.dubbo.demo.DemoTwoService" ref="demoTwoService" group="dubbodemoregister2"/>
  27. <!-- 如果需要使用个性化配置,则需要单独配置,比如服务提供者协议配置、注册中心配置 、服务提供者缺省值配置-->
  28. <!-- 服务提供者协议配置-dubbo会覆盖dubbo.properties: -->
  29. <!-- <dubbo:protocol id="dubbodemo" name="dubbo" port="20882"/> -->
  30. <!-- 注册中心配置-会覆盖 dubbo.proerties,这个本质就是 dubbo:service的group: -->
  31. <dubbo:registry id="dubbodemoregister" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/>
  32. <dubbo:registry id="dubbodemoregister2" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/>
  33. <!-- 服务提供者缺省值配置-所有服务提供者自动拥有此配置-这意味着,这个配置一个就够了: -->
  34. <!-- <dubbo:provider id="dubbodemoprovider" group="dubbodemoregister" timeout="30000" retries="0"/> -->
  35. <!-- 服务提供者暴露服务配置: -->
  36. <dubbo:service interface="com.alibaba.dubbo.demo.DemoService" ref="demoService" group="dubbodemoregister"/>
  37. </beans>
<?xml version="1.0" encoding="UTF-8"?>
<!--
- 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
&lt;!-- bean的声明和Spring无差异 --&gt;
&lt;bean id="demoService" class="com.alibaba.dubbo.demo.provider.DemoServiceImpl" /&gt;
&lt;bean id="demoTwoService" class="com.alibaba.dubbo.demo.provider.DemoTwoServiceImpl" /&gt; &lt;!-- 由于dubbo.propertirs 的存在,可以直接配置 &lt;dubbo:service&gt;对外暴露服务,即存在默认的配置, --&gt;
&lt;dubbo:service interface="com.alibaba.dubbo.demo.DemoTwoService" ref="demoTwoService" group="dubbodemoregister2"/&gt; &lt;!-- 如果需要使用个性化配置,则需要单独配置,比如服务提供者协议配置、注册中心配置 、服务提供者缺省值配置--&gt;
&lt;!-- 服务提供者协议配置-dubbo会覆盖dubbo.properties: --&gt;
&lt;!-- &lt;dubbo:protocol id="dubbodemo" name="dubbo" port="20882"/&gt; --&gt; &lt;!-- 注册中心配置-会覆盖 dubbo.proerties,这个本质就是 dubbo:service的group: --&gt;
&lt;dubbo:registry id="dubbodemoregister" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/&gt;
&lt;dubbo:registry id="dubbodemoregister2" address="zookeeper://127.0.0.1:2181" protocol="dubbo"/&gt; &lt;!-- 服务提供者缺省值配置-所有服务提供者自动拥有此配置-这意味着,这个配置一个就够了: --&gt;
&lt;!-- &lt;dubbo:provider id="dubbodemoprovider" group="dubbodemoregister" timeout="30000" retries="0"/&gt; --&gt; &lt;!-- 服务提供者暴露服务配置: --&gt;
&lt;dubbo:service interface="com.alibaba.dubbo.demo.DemoService" ref="demoService" group="dubbodemoregister"/&gt;

</beans>

dubbo 部分 配置的关系-dubbo github 官方案例的更多相关文章

  1. Dubbo的配置及使用

    1. Dubbo是什么? Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需 ...

  2. 【基础配置】Dubbo的配置及使用

    1. Dubbo是什么? Dubbo是一个分布式服务框架,致力于提供高性能和透明化的RPC远程服务调用方案,以及SOA服务治理方案.简单的说,dubbo就是个服务框架,如果没有分布式的需求,其实是不需 ...

  3. dubbo和zookeeper的关系

    转载前言:网络上很多教程没有描述zookeeper和dubbo到底是什么关系.分别扮演了什么角色等信息,都是说一些似是而非的话,这里终于找到一篇文章,比较生动地描述了注册中心和微服务框架之间的关系,以 ...

  4. dubbo基础(初学习dubbo)

    1. 扩展   Soap是webService协议.是http+xml. Rest ful是http+json.相对于soap来说rest ful就是轻量的,因为==.   Rpc与soa区别? Rp ...

  5. Dubbo系列(一)dubbo的产生背景与原理概述

    一.Dubbo框架的产生背景        大规模服务化之前,应用只是通过RMI或Hessian等工具,简单的暴露和引用远程服务,通过配置服务的URL地址进行调用,通过F5等硬件进行负载均衡. (1) ...

  6. dubbo高级配置学习

    启动时检查 可以通过check="false"关闭检查,比如,测试时,有些服务不关心,或者出现了循环依赖,必须有一方先启动. 关闭某个服务的启动时检查:(没有提供者时报错) < ...

  7. dubbo高级配置学习(上)

    启动时检查 Dubbo缺省会在启动时检查依赖的服务是否可用,不可用时会抛出异常,阻止Spring初始化完成,以便上线时,能及早发现问题,默认check=true. 如果你的Spring容器是懒加载的, ...

  8. dubbo简单配置与使用

    dubbo简介 随着互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,亟需一个治理系统确保架构有条不紊的演进. 单一应用架构 当网站流量很小时 ...

  9. spring 5.x 系列第16篇 —— 整合dubbo (代码配置方式)

    文章目录 一. 项目结构说明 二.项目依赖 三.公共模块(dubbo-ano-common) 四. 服务提供者(dubbo-ano-provider) 4.1 提供方配置 4.2 使用注解@Servi ...

随机推荐

  1. 全球级的分布式数据库 Google Spanner原理

    开发四年只会写业务代码,分布式高并发都不会还做程序员?->>>    Google Spanner简介 Spanner 是Google的全球级的分布式数据库 (Globally-Di ...

  2. ubuntu--dpkg 被中断

    主要原因应该是/var/lib/dpkg/updates 文件夹里面的资料有错误,使得更新软件的程序出现错误,所以得把它们完全删除,通过sudo apt-get update这个指令会重新建立这些资料 ...

  3. iOS绘图系统UIKit与Core Graphics

    概述 iOS主要的绘图系统有UIKit,Core Graphics,Core Animation,Core Image,Open GL等,本片博文主要介绍UIKit与Core Graphics的绘图系 ...

  4. BP网络中的反向传播

    本文的主要参考:How the backpropagation algorithm works 下面是BP网络的参数结构示意图 首先定义第l层网络第j个神经元的输出(activation) 为了表示简 ...

  5. Routh-Hurwitz Criterion 劳斯稳定判据

    Routh-Hurwitz Criterion 为什么仅仅要有一个极点在右半平面,那么系统就不会稳定? 比如H(s) =( 1/(s+1) ) *  ( 1/(s+3) ) * ( 1/(s-2) ) ...

  6. 基于Solr的HBase实时查询方案

    实时查询方案 HBase+Solr+HBase-Indexer 1.HBase提供海量数据存储 2.solr提供索引构建与查询 3.HBase indexer提供自己主动化索引构建(从HBase到So ...

  7. html5的postmessage实现js前端跨域訪问及调用解决方式

    关于跨域訪问.使用JSONP的方法.我前面已经demo过了.详细见http://supercharles888.blog.51cto.com/609344/856886,HTML5提供了一个很强大的A ...

  8. Apache + Tomcat 负载均衡 session复制

    转自:http://blog.csdn.net/cssmhyl/article/details/8455400 http://snowolf.iteye.com/blog/743611 Apache  ...

  9. n个整数全排列的递归实现(C++)

    全排列是很经常使用的一个小算法,以下是n个整数全排列的递归实现,使用的是C++ #include <iostream> using namespace std; int n = 0; vo ...

  10. 0x13 链表与邻接表

    这东西我还是有点会玩的啊.. 邻值查找这东西不就是维护个前驱后继嘛.. #include<cstdio> #include<iostream> #include<cstr ...