<dubbo:registry address="redis://10.20.153.10:6379" />
or
<dubbo:registry address="redis://10.20.153.10:6379?backup=10.20.153.11:6379,10.20.153.12:6379" />
or
<dubbo:registry protocol="redis" address="10.20.153.10:6379" />
or
<dubbo:registry protocol="redis" address="10.20.153.10:6379,10.20.153.11:6379,10.20.153.12:6379" />
<dubbo:registry group="dubbo" />
, the default is dubbo
.<dubbo:registry cluster="replicate" />
, the default is failover
:failover
: Only write and read any one, and retry another one when it fails, the server needs to configure data synchronization by itselfreplicate
: Write to all servers at the same time on the client side, only read a single server, the server side does not need to be synchronized, the registration center cluster increases, and the performance pressure will also be greaterA registry implemented based on Redis [^1].
Redis expired data detects dirty data through heartbeat, the server time must be synchronized, and there is a certain pressure on the server, otherwise the expiration detection will be inaccurate
Use Redis’s Key/Map structure to store data structures:
Use Redis’s Publish/Subscribe events to notify data changes:
register
, unregister
, subscribe
, unsubscribe
register
, unregister
events of the specified service/dubbo/*
through the psubscribe
function, and will receive all change events of all servicesCall process:
Key:/dubbo/com.foo.BarService/providers
register
event to Channel:/dubbo/com.foo.BarService/providers
register
and unregister
events from Channel:/dubbo/com.foo.BarService/providers
Key:/dubbo/com.foo.BarService/consumers
register
and unregister
events, the service consumer obtains the provider address list from Key:/dubbo/com.foo.BarService/providers
register
and unregister
, and subscribe
and unsubscribe
events from Channel:/dubbo/*
register
and unregister
events, the service monitoring center obtains the provider address list from Key:/dubbo/com.foo.BarService/providers
subscribe
and unsubscribe
events, the service monitoring center obtains the consumer address list from Key:/dubbo/com.foo.BarService/consumers