The Multicast registration center does not need to start any central nodes, as long as the broadcast address is the same, they can discover each other.
1 Instructions for use
<dubbo:registry address="multicast://188.8.131.52:1234" />
<dubbo:registry protocol="multicast" address="184.108.40.206:1234" />
In order to reduce the amount of broadcasting, Dubbo uses unicast to send provider address information to consumers by default.
If multiple consumer processes are started on a machine at the same time, the consumer must declare
unicast=false, otherwise only one consumer can receive the message; when the server and the consumer run on the same machine, the consumer It is also necessary to declare
unicast=false, otherwise the consumer cannot receive the message, resulting in No provider available for the service exception:
<dubbo:application name="demo-consumer"> <dubbo:parameter key="unicast" value="false" /> </dubbo:application>
<dubbo:consumer> <dubbo:parameter key="unicast" value="false" /> </dubbo:consumer>
2 How it works
2.1 Basic process
- The provider broadcasts its own address when it starts
- Broadcast subscription request when consumer starts
- When the provider receives the subscription request, it will unicast its own address to the subscribers. If
unicast=falseis set, it will broadcast to the subscribers
- When the consumer receives the provider’s address, it connects to the address to make an RPC call.
2.2 Restrictions on Use
Multicast is limited by the network structure and is only suitable for small-scale applications or development stages. Multicast address segment: 220.127.116.11 - 18.104.22.168