dubbo中的group与version

groupspa

当一个接口有多种实现时,能够用group区分.net

<!-- dubbo group 使用示例 -->
<bean id="demoA" class="com.xxx.IndexServiceImpl1" />
<dubbo:service group="feedback" interface="com.xxx.IndexService" ref="demoA" />

<bean id="demoB" class="com.xxx.IndexServiceImpl2" />
<dubbo:service group="member" interface="com.xxx.IndexService" ref="demoB" />

此外,dubbo消费者也能够设置为:消费任意一个group的服务。code

<dubbo:reference id="barService" interface="com.foo.BarService" group="*" />

version

当一个接口的实现,出现不兼容升级时,能够用版本号过渡,版本号不一样的服务相互间不引用blog

<!-- 机器A提供1.0.0版本服务 -->
<dubbo:service interface="com.foo.BarService" version="1.0.0" />
<!-- 机器B提供2.0.0版本服务 -->
<dubbo:service interface="com.foo.BarService" version="2.0.0" />
<!-- 机器C消费1.0.0版本服务 -->
<dubbo:reference id="barService" interface="com.foo.BarService" version="1.0.0" />
<!-- 机器D消费2.0.0版本服务 -->
<dubbo:reference id="barService" interface="com.foo.BarService" version="2.0.0" />

此外,消费者消费服任意版本的服务时:接口

<dubbo:reference id="barService" interface="com.foo.BarService" version="*" />

另外 
接口升级时,要注意方法: 
* 在低压力时间段,先升级一半的提供者为新版本; 
* 再将全部的消费者升级为新版本; 
* 而后将剩下的一半提供者升级为新版本;io

 

 

https://blog.csdn.net/silencecarrot/article/details/66981333class

相关文章
相关标签/搜索