Starting from Dubbo3, the Redis registry adaptation is no longer embedded in Dubbo and needs to be separately introduced as an independent module.
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-registry-redis</artifactId>
<version>3.3.0</version>
</dependency>
<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" />
, default is dubbo
.<dubbo:registry cluster="replicate" />
, default is failover
:failover
: Only write and read from any one, retry another on failure, data synchronization needs to be configured on the server side.replicate
: Write to all servers simultaneously from the client, read from one, no synchronization needed on the server side, the registration center cluster increases and so does performance pressure.The registry is implemented based on Redis [^1].
Redis expired data is detected for dirty data through heartbeat; server time must be synchronized and there is certain pressure on the server, otherwise the expiration detection may be inaccurate.
Using Redis’s Key/Map structure to store data:
Using Redis’s Publish/Subscribe event to notify data changes:
register
, unregister
, subscribe
, unsubscribe
.register
, unregister
events for that service./dubbo/*
through psubscribe
, receiving all change events for all services.Call 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
.Key:/dubbo/com.foo.BarService/providers
after receiving register
and unregister
events.register
, unregister
, subscribe
, and unsubscribe
events from Channel:/dubbo/*
.Key:/dubbo/com.foo.BarService/providers
after receiving register
and unregister
events.Key:/dubbo/com.foo.BarService/consumers
after receiving subscribe
and unsubscribe
events.