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="*" />
當一個接口的實現,出現不兼容升級時,能夠用版本號過渡,版本號不一樣的服務相互間不引用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