Skip to content

Commit 8f9e786

Browse files
author
liwang
committed
ZOOKEEPER-4956: Provide a HostProvider that uses DNS SRV record for dynamic server discovery
Author: Li Wang <[email protected]>
1 parent d8e5217 commit 8f9e786

File tree

9 files changed

+1203
-1
lines changed

9 files changed

+1203
-1
lines changed

zookeeper-docs/src/main/resources/markdown/zookeeperAdmin.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,14 @@ of servers -- that is, when deploying clusters of servers.
13151315
leader election. If you want to test multiple servers on a single machine, then
13161316
different ports can be used for each server.
13171317

1318+
* *hostProvider.dnsSrvRefreshIntervalMs* :
1319+
(Java system property: **zookeeper.hostProvider.dnsSrvRefreshIntervalMs**)
1320+
**New in 3.10.0:**
1321+
The refresh interval in milliseconds for DNS SRV record lookups when using DnsSrvHostProvider.
1322+
This property controls how frequently the DNS SRV records are queried to update the server list.
1323+
A value of 0 disables periodic refresh.
1324+
1325+
The default value is 60000 (60 seconds).
13181326

13191327
<a name="id_multi_address"></a>
13201328
Since ZooKeeper 3.6.0 it is possible to specify **multiple addresses** for each

zookeeper-server/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,11 @@
190190
<artifactId>commons-io</artifactId>
191191
<scope>compile</scope>
192192
</dependency>
193+
<dependency>
194+
<groupId>dnsjava</groupId>
195+
<artifactId>dnsjava</artifactId>
196+
<version>3.5.1</version>
197+
</dependency>
193198
</dependencies>
194199

195200
<build>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.zookeeper.client;
20+
21+
import org.apache.yetus.audience.InterfaceAudience;
22+
23+
/**
24+
* Represents the type of connection resolution used by ZooKeeper clients.
25+
* This is an internal enum used for connection string and provider validation.
26+
*/
27+
@InterfaceAudience.Private
28+
public enum ConnectionType {
29+
/**
30+
* DNS SRV record-based service discovery.
31+
*/
32+
DNS_SRV("DNS SRV"),
33+
34+
/**
35+
* Traditional host:port static server list.
36+
*/
37+
HOST_PORT("Host:Port");
38+
39+
private final String name;
40+
41+
ConnectionType(String name) {
42+
this.name = name;
43+
}
44+
45+
/**
46+
* Returns the name for this connection type.
47+
* @return the name
48+
*/
49+
public String getName() {
50+
return name;
51+
}
52+
}

0 commit comments

Comments
 (0)