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. 如何用Vim提高开发效率

    即可 ●输入m获取到文章目录 推荐↓↓↓ C/C++编程 更多推荐<18个技术类公众微信> 涵盖:程序人生.算法与数据结构.黑客技术与网络安全.大数据技术.前端开发.Java.Python ...

  2. 数据库连接池dataesoruce pool深入理解

    8.数据库连接池的connection都是长连接的,以方便多次调用,多人连续使用.dataSourcePool9.数据库连接池中的连接,是在你用完之后,返回给数据库连接池的,并不是close()掉,而 ...

  3. UVa11183 - Teen Girl Squad(最小树形图-裸)

    Problem I Teen Girl Squad  Input: Standard Input Output: Standard Output -- 3 spring rolls please. - ...

  4. MySQL 5.7.10最新版本号源码安装具体过程

    ,重置密码 利用mysqladmin重置密码 [root@wgq_idc_mon_1_12 mysql5710]#./bin/mysqladmin -h localhost -uroot passwo ...

  5. hdu 5335 Walk Out (2015 Multi-University Training Contest 4)

    Walk Out                                                                         Time Limit: 2000/10 ...

  6. 稀疏编码(Sparse Coding)的前世今生(二)

    为了更进一步的清晰理解大脑皮层对信号编码的工作机制(策略),须要把他们转成数学语言,由于数学语言作为一种严谨的语言,能够利用它推导出期望和要寻找的程式.本节就使用概率推理(bayes views)的方 ...

  7. poj 2528 Mayor&#39;s posters 【线段树 + 离散化】

    Mayor's posters Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 50643   Accepted: 14675 ...

  8. 0x05 排序

    说是排序结果就是各种奇技淫巧 中位数被坑多了久病成医,例题一题搞笑一题糖果传递(昨晚精神那么好效率还那么差) #include<cstdio> #include<iostream&g ...

  9. CodeForces--609C --Load Balancing(水题)

    Load Balancing Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Subm ...

  10. EOJ 3124 单词表

    题目描述 提取英文文本中的单词,重复出现的单词只取一个,把它们按照字典顺序排序,建立为一个单词表. 例如:英文文本如下: “ask not what your country can do for y ...