W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
在 Dubbo 中配置應(yīng)用級(jí)治理規(guī)則和服務(wù)級(jí)治理規(guī)則
提示
本文描述的是新版本規(guī)則配置,而不是老版本配置規(guī)則
覆蓋規(guī)則是 Dubbo 設(shè)計(jì)的在無需重啟應(yīng)用的情況下,動(dòng)態(tài)調(diào)整 RPC 調(diào)用行為的一種能力。2.7.0 版本開始,支持從服務(wù)和應(yīng)用兩個(gè)粒度來調(diào)整動(dòng)態(tài)配置。
請(qǐng)?jiān)诜?wù)治理控制臺(tái)查看或修改覆蓋規(guī)則。
應(yīng)用粒度
# 將應(yīng)用demo(key:demo)在20880端口上提供(side:provider)的所有服務(wù)(scope:application)的權(quán)重修改為1000(weight:1000)。 --- configVersion: v2.7 scope: application key: demo enabled: true configs: - addresses: ["0.0.0.0:20880"] side: provider parameters: weight: 1000 ...
服務(wù)粒度
# 所有消費(fèi)(side:consumer)DemoService服務(wù)(key:org.apache.dubbo.samples.governance.api.DemoService)的應(yīng)用實(shí)例(addresses:[0.0.0.0]),超時(shí)時(shí)間修改為6000ms --- configVersion: v2.7 scope: service key: org.apache.dubbo.samples.governance.api.DemoService enabled: true configs: - addresses: [0.0.0.0] side: consumer parameters: timeout: 6000 ...
--- configVersion: v2.7 scope: application/service key: app-name/group+service+version enabled: true configs: - addresses: ["0.0.0.0"] providerAddresses: ["1.1.1.1:20880", "2.2.2.2:20881"] side: consumer applications/services: [] parameters: timeout: 1000 cluster: failfase loadbalance: random - addresses: ["0.0.0.0:20880"] side: provider applications/services: [] parameters: threadpool: fixed threads: 200 iothreads: 4 dispatcher: all weight: 200 ...
其中:
對(duì)于絕大多數(shù)配置場(chǎng)景,只需要理清楚以下問題基本就知道配置該怎么寫了:
---
configVersion: v2.7
scope: application
key: demo-provider
enabled: true
configs:
- addresses: ["10.20.153.10:20880"]
side: provider
parameters:
disabled: true
...
---
configVersion: v2.7
scope: application
key: demo-provider
enabled: true
configs:
- addresses: ["10.20.153.10:20880"]
side: provider
parameters:
weight: 200
...
---
configVersion: v2.7
scope: application
key: demo-consumer
enabled: true
configs:
- side: consumer
parameters:
loadbalance: random
...
---
configVersion: v2.7
scope: service
key: org.apache.dubbo.samples.governance.api.DemoService
enabled: true
configs:
- side:
consumer
parameters:
force: return null
...
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)系方式:
更多建議: