rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

[Feature] Client support updateNameServerAddressListByDnsLookup

Open shirenchuang opened this issue 1 year ago • 1 comments

Is Your Feature Request Related to a Problem?

At present, when the client configures NameSrv, the following methods can be used

  1. Write the IP directly, for example: IP:PORT; IP:PORT
  2. The form of the domain name, for example: http://szzdzhp.com:9876/
  3. Self-built NameSrv address service service, set through TopAddressing SPI

When configuring in the form of a domain name, there is only one address for each request; Although multiple NameSrv IPs can be mounted through DNS in the form of a domain name; But there can only be one address per request;

There is an operation to write data in the client. for example RequestCode.PUT_KV_CONFIG, RequestCode.DELETE_KV_CONFIG;

When writing operations, it is necessary to traverse all NameSrv addresses to write; if only one domain name is configured, then less data will be written to other NameSrvs during write operations

Influence point:

  1. There is no impact point at present, because the producer and consumer do not have to write during the operation process, and the write operation is in Admin and Dashboard; so Admin and Dashboard cannot be configured in the form of a domain name;

However, we can make Dashboard and Admin also support the form of domain name; The solution is as follows:

目前客户端配置NameSrv的时候, 可以有如下方式

  1. 直接写死IP,例如:IP:PORT; IP:PORT
  2. 域名的形式,例如: http://szzdzhp.com:9876/
  3. 自建NameSrv地址服务的服务,通过TopAddressing SPI设置

通过域名形式配置的时候, 每次请求都是只有这一个地址;
虽然通过域名的形式可以通过DNS挂载多个NameSrv IP; 但是每次请求只能有一个地址;

客户端中有存在写数据的操作。比如 RequestCode.PUT_KV_CONFIG、RequestCode.DELETE_KV_CONFIG ;

写操作的时候都是需要遍历所有的NameSrv地址来写的;如果只配置了一个域名,那么在写操作的时候就会少对其他NameSrv写数据了

影响点

  1. 目前没有影响点,因为生产者和消费者 运行过程并没有去写的操作,写的操作是在Admin和Dashboard中;所以Admin和Dashboard是不能配置域名的形式的;

不过我们可以让Dashboard和Admin也支持域名的形式; 解决方案如下:

Describe the Solution You'd Like

解决方案:

Broker中通过`` 可以支持从域名寻址获取IP的形式更新NameSrv列表;

https://github.com/apache/rocketmq/issues/5180

我想客户端也可以使用这种方式来更友好的支持

新增一个配置

## 开启按域dns查找NameSrv地址;默认是false
fetchNameSrvAddrByDnsLookup=true

Describe Alternatives You've Considered

NO

Additional Context

No response

shirenchuang avatar Aug 25 '23 06:08 shirenchuang