W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
參考samples dubbo-go-samples/registry
Registry 注冊(cè)中心配置
dubbo: application: # 應(yīng)用信息,服務(wù)啟動(dòng)后會(huì)將相關(guān)信息注冊(cè)到注冊(cè)中心,可被客戶端從 url 中識(shí)別 name: myApp # application=myApp; name=myApp module: opensource # module=opensource organization: dubbo # organization=dubbo owner: laurence # owner=laurence version: myversion # app.version=myversion environment: pro # environment=pro registries: nacosWithCustomGroup: protocol: nacos # 注冊(cè)中心選擇 nacos address: 127.0.0.1:8848 # nacos ip group: myGroup # nacos group, 默認(rèn) DEFAULT_GROUP namespace: 9fb00abb-278d-42fc-96bf-e0151601e4a1 # nacos namespaceID, should be created before. 默認(rèn)public username: abc password: abc protocols: dubbo: name: dubbo port: 20000 provider: services: UserProviderWithCustomGroupAndVersion: # 接口三元組:接口名、版本號(hào)、分組。client 和 server 需要保持一致。 interface: org.apache.dubbo.UserProvider.Test # 接口名必填 version: myInterfaceVersion # 默認(rèn)為空 group: myInterfaceGroup # 默認(rèn)為空
Dubbo-go 的注冊(cè)中心配置的 group、namespace、username、password,均與 nacos 相關(guān)概念對(duì)應(yīng)。
dubbo: # application: 與nacos 一致,不再贅述 registries: demoZK: protocol: zookeeper # 注冊(cè)中心選擇 nacos address: 127.0.0.1:2181 # zookeeper ip group: myGroup # nacos group, 默認(rèn) dubbo protocols: triple: name: tri port: 20000 provider: services: UserProviderWithCustomGroupAndVersion: # 接口三元組:接口名、版本號(hào)、分組。client 和 server 需要保持一致。 interface: com.apache.dubbo.sample.basic.IGreeter # 接口名必填 version: myInterfaceVersion # 默認(rèn)為空 group: myInterfaceGroup # 默認(rèn)為空
zookeeper 注冊(cè)時(shí),provider 端將接口信息注冊(cè)在 /$(group)/$(interface)/providers 節(jié)點(diǎn),以上面配置為例,注冊(cè)的 zk path 為 /myGroup/com.apache.dubbo.sample.basic.IGreeter/providers/
consumer 端注冊(cè)在 /$(group)/$(interface)/consumers 作統(tǒng)計(jì)用。
dubbo: registries: etcd: protocol: etcdv3 timeout: 3s address: 127.0.0.1:2379 protocols: dubbo: name: dubbo port: 20000 provider: services: UserProvider: interface: org.apache.dubbo.UserProvider
dubbo: registries: demoZK: protocol: zookeeper # nacos/zookeeper address: 127.0.0.1:2181 registry-type: service # 使用應(yīng)用級(jí)服務(wù)發(fā)現(xiàn) metadata-report: # 配置元數(shù)據(jù)中心 protocol: zookeeper address: 127.0.0.1:2181 protocols: triple: name: tri port: 20000 provider: services: GreeterProvider: interface: com.apache.dubbo.sample.basic.IGreeter
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: