天天看點

2.5 RegistryConfig 注冊中心配置代碼示例:

代碼示例:

RegistryConfig registry = new RegistryConfig();
// <host:port> 注冊中心伺服器位址
registry.setAddress("redis://*.*.*.*:6380");
// 注冊中心位址協定,支援dubbo, http, local三種協定,分别表示:dubbo位址、http位址、本地注冊中心
registry.setProtocol("dubbo");
// 注冊中心請求逾時時間(毫秒)
registry.setTimeout(5000);
// 服務注冊分組,跨組的服務不會互相影響,也無法互相調用,适用于環境隔離。
registry.setGroup("1.0");
           

繼續閱讀