Class QuorumPeerConfig
- java.lang.Object
-
- org.apache.zookeeper.server.quorum.QuorumPeerConfig
-
- Direct Known Subclasses:
ControllerServerConfig
@Public public class QuorumPeerConfig extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
QuorumPeerConfig.ConfigException
-
Field Summary
Fields Modifier and Type Field Description protected java.net.InetSocketAddress
clientPortAddress
protected int
clientPortListenBacklog
defaults to -1 if not set explicitlyprotected java.lang.String
configFileStr
protected int
connectToLearnerMasterLimit
protected java.io.File
dataDir
protected java.io.File
dataLogDir
protected java.lang.String
dynamicConfigFileStr
protected int
electionAlg
protected int
electionPort
protected java.lang.String
initialConfig
protected int
initLimit
protected long
jvmPauseInfoThresholdMs
JVM Pause Monitor info threshold in msprotected boolean
jvmPauseMonitorToRun
JVM Pause Monitor feature switchprotected long
jvmPauseSleepTimeMs
JVM Pause Monitor sleep time in msprotected long
jvmPauseWarnThresholdMs
JVM Pause Monitor warn threshold in msprotected QuorumVerifier
lastSeenQuorumVerifier
protected boolean
localSessionsEnabled
protected boolean
localSessionsUpgradingEnabled
protected int
maxClientCnxns
protected int
maxSessionTimeout
defaults to -1 if not set explicitlyprotected java.lang.String
metricsProviderClassName
protected java.util.Properties
metricsProviderConfiguration
protected int
minSessionTimeout
defaults to -1 if not set explicitlystatic java.lang.String
nextDynamicConfigFileSuffix
protected int
observerMasterPort
protected java.lang.String
oraclePath
protected QuorumPeer.LearnerType
peerType
protected int
purgeInterval
protected int
quorumCnxnThreadsSize
protected boolean
quorumEnableSasl
protected java.lang.String
quorumLearnerLoginContext
protected boolean
quorumLearnerRequireSasl
protected boolean
quorumListenOnAllIPs
protected java.lang.String
quorumServerLoginContext
protected boolean
quorumServerRequireSasl
Configurations for the quorumpeer-to-quorumpeer sasl authenticationprotected java.lang.String
quorumServicePrincipal
protected QuorumVerifier
quorumVerifier
protected java.net.InetSocketAddress
secureClientPortAddress
protected long
serverId
protected boolean
shouldUsePortUnification
protected int
snapRetainCount
protected boolean
sslQuorum
protected boolean
sslQuorumReloadCertFiles
protected boolean
syncEnabled
protected int
syncLimit
protected int
tickTime
-
Constructor Summary
Constructors Constructor Description QuorumPeerConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areLocalSessionsEnabled()
void
checkValidity()
static void
configureSSLAuth()
Configure SSL authentication only if it is not configured.static void
deleteFile(java.lang.String filename)
static void
editStaticConfig(java.lang.String configFileStr, java.lang.String dynamicFileStr, boolean eraseClientPortAddress)
Edit static config file.java.net.InetSocketAddress
getClientPortAddress()
int
getClientPortListenBacklog()
java.lang.String
getConfigFilename()
int
getConnectToLearnerMasterLimit()
java.io.File
getDataDir()
java.io.File
getDataLogDir()
int
getElectionAlg()
int
getElectionPort()
java.lang.String
getInitialConfig()
int
getInitLimit()
long
getJvmPauseInfoThresholdMs()
long
getJvmPauseSleepTimeMs()
long
getJvmPauseWarnThresholdMs()
QuorumVerifier
getLastSeenQuorumVerifier()
int
getMaxClientCnxns()
int
getMaxSessionTimeout()
java.lang.String
getMetricsProviderClassName()
java.util.Properties
getMetricsProviderConfiguration()
int
getMinSessionTimeout()
int
getMultiAddressReachabilityCheckTimeoutMs()
int
getObserverMasterPort()
QuorumPeer.LearnerType
getPeerType()
int
getPurgeInterval()
java.lang.Boolean
getQuorumListenOnAllIPs()
QuorumVerifier
getQuorumVerifier()
java.net.InetSocketAddress
getSecureClientPortAddress()
long
getServerId()
java.util.Map<java.lang.Long,QuorumPeer.QuorumServer>
getServers()
int
getSnapRetainCount()
boolean
getSyncEnabled()
int
getSyncLimit()
int
getTickTime()
static java.lang.String
getVersionFromFilename(java.lang.String filename)
boolean
isDistributed()
boolean
isJvmPauseMonitorToRun()
boolean
isLocalSessionsUpgradingEnabled()
boolean
isMultiAddressEnabled()
boolean
isMultiAddressReachabilityCheckEnabled()
static boolean
isReconfigEnabled()
boolean
isSslQuorum()
static boolean
isStandaloneEnabled()
void
parse(java.lang.String path)
Parse a ZooKeeper configuration filestatic QuorumVerifier
parseDynamicConfig(java.util.Properties dynamicConfigProp, int eAlg, boolean warnings, boolean configBackwardCompatibilityMode, java.lang.String oraclePath)
Parse dynamic configuration file and return quorumVerifier for new configuration.void
parseProperties(java.util.Properties zkProp)
Parse config from a Properties.static void
setReconfigEnabled(boolean enabled)
static void
setStandaloneEnabled(boolean enabled)
boolean
shouldUsePortUnification()
static void
writeDynamicConfig(java.lang.String dynamicConfigFilename, QuorumVerifier qv, boolean needKeepVersion)
Writes dynamic configuration file
-
-
-
Field Detail
-
nextDynamicConfigFileSuffix
public static final java.lang.String nextDynamicConfigFileSuffix
- See Also:
- Constant Field Values
-
clientPortAddress
protected java.net.InetSocketAddress clientPortAddress
-
secureClientPortAddress
protected java.net.InetSocketAddress secureClientPortAddress
-
sslQuorum
protected boolean sslQuorum
-
shouldUsePortUnification
protected boolean shouldUsePortUnification
-
observerMasterPort
protected int observerMasterPort
-
sslQuorumReloadCertFiles
protected boolean sslQuorumReloadCertFiles
-
dataDir
protected java.io.File dataDir
-
dataLogDir
protected java.io.File dataLogDir
-
dynamicConfigFileStr
protected java.lang.String dynamicConfigFileStr
-
configFileStr
protected java.lang.String configFileStr
-
tickTime
protected int tickTime
-
maxClientCnxns
protected int maxClientCnxns
-
minSessionTimeout
protected int minSessionTimeout
defaults to -1 if not set explicitly
-
maxSessionTimeout
protected int maxSessionTimeout
defaults to -1 if not set explicitly
-
metricsProviderClassName
protected java.lang.String metricsProviderClassName
-
metricsProviderConfiguration
protected java.util.Properties metricsProviderConfiguration
-
localSessionsEnabled
protected boolean localSessionsEnabled
-
localSessionsUpgradingEnabled
protected boolean localSessionsUpgradingEnabled
-
clientPortListenBacklog
protected int clientPortListenBacklog
defaults to -1 if not set explicitly
-
initLimit
protected int initLimit
-
syncLimit
protected int syncLimit
-
connectToLearnerMasterLimit
protected int connectToLearnerMasterLimit
-
electionAlg
protected int electionAlg
-
electionPort
protected int electionPort
-
quorumListenOnAllIPs
protected boolean quorumListenOnAllIPs
-
serverId
protected long serverId
-
quorumVerifier
protected QuorumVerifier quorumVerifier
-
lastSeenQuorumVerifier
protected QuorumVerifier lastSeenQuorumVerifier
-
snapRetainCount
protected int snapRetainCount
-
purgeInterval
protected int purgeInterval
-
syncEnabled
protected boolean syncEnabled
-
initialConfig
protected java.lang.String initialConfig
-
peerType
protected QuorumPeer.LearnerType peerType
-
quorumServerRequireSasl
protected boolean quorumServerRequireSasl
Configurations for the quorumpeer-to-quorumpeer sasl authentication
-
quorumLearnerRequireSasl
protected boolean quorumLearnerRequireSasl
-
quorumEnableSasl
protected boolean quorumEnableSasl
-
quorumServicePrincipal
protected java.lang.String quorumServicePrincipal
-
quorumLearnerLoginContext
protected java.lang.String quorumLearnerLoginContext
-
quorumServerLoginContext
protected java.lang.String quorumServerLoginContext
-
quorumCnxnThreadsSize
protected int quorumCnxnThreadsSize
-
oraclePath
protected java.lang.String oraclePath
-
jvmPauseMonitorToRun
protected boolean jvmPauseMonitorToRun
JVM Pause Monitor feature switch
-
jvmPauseWarnThresholdMs
protected long jvmPauseWarnThresholdMs
JVM Pause Monitor warn threshold in ms
-
jvmPauseInfoThresholdMs
protected long jvmPauseInfoThresholdMs
JVM Pause Monitor info threshold in ms
-
jvmPauseSleepTimeMs
protected long jvmPauseSleepTimeMs
JVM Pause Monitor sleep time in ms
-
-
Method Detail
-
parse
public void parse(java.lang.String path) throws QuorumPeerConfig.ConfigException
Parse a ZooKeeper configuration file- Parameters:
path
- the patch of the configuration file- Throws:
QuorumPeerConfig.ConfigException
- error processing configuration
-
getVersionFromFilename
public static java.lang.String getVersionFromFilename(java.lang.String filename)
-
parseProperties
public void parseProperties(java.util.Properties zkProp) throws java.io.IOException, QuorumPeerConfig.ConfigException
Parse config from a Properties.- Parameters:
zkProp
- Properties to parse from.- Throws:
java.io.IOException
QuorumPeerConfig.ConfigException
-
configureSSLAuth
public static void configureSSLAuth() throws QuorumPeerConfig.ConfigException
Configure SSL authentication only if it is not configured.- Throws:
QuorumPeerConfig.ConfigException
- If authentication scheme is configured but authentication provider is not configured.
-
writeDynamicConfig
public static void writeDynamicConfig(java.lang.String dynamicConfigFilename, QuorumVerifier qv, boolean needKeepVersion) throws java.io.IOException
Writes dynamic configuration file- Throws:
java.io.IOException
-
editStaticConfig
public static void editStaticConfig(java.lang.String configFileStr, java.lang.String dynamicFileStr, boolean eraseClientPortAddress) throws java.io.IOException
Edit static config file. If there are quorum information in static file, e.g. "server.X", "group", it will remove them. If it needs to erase client port information left by the old config, "eraseClientPortAddress" should be set true. It should also updates dynamic file pointer on reconfig.- Throws:
java.io.IOException
-
deleteFile
public static void deleteFile(java.lang.String filename)
-
parseDynamicConfig
public static QuorumVerifier parseDynamicConfig(java.util.Properties dynamicConfigProp, int eAlg, boolean warnings, boolean configBackwardCompatibilityMode, java.lang.String oraclePath) throws java.io.IOException, QuorumPeerConfig.ConfigException
Parse dynamic configuration file and return quorumVerifier for new configuration.- Parameters:
dynamicConfigProp
- Properties to parse from.- Throws:
java.io.IOException
QuorumPeerConfig.ConfigException
-
checkValidity
public void checkValidity() throws java.io.IOException, QuorumPeerConfig.ConfigException
- Throws:
java.io.IOException
QuorumPeerConfig.ConfigException
-
getClientPortAddress
public java.net.InetSocketAddress getClientPortAddress()
-
getSecureClientPortAddress
public java.net.InetSocketAddress getSecureClientPortAddress()
-
getObserverMasterPort
public int getObserverMasterPort()
-
getDataDir
public java.io.File getDataDir()
-
getDataLogDir
public java.io.File getDataLogDir()
-
getInitialConfig
public java.lang.String getInitialConfig()
-
getTickTime
public int getTickTime()
-
getMaxClientCnxns
public int getMaxClientCnxns()
-
getMinSessionTimeout
public int getMinSessionTimeout()
-
getMaxSessionTimeout
public int getMaxSessionTimeout()
-
getMetricsProviderClassName
public java.lang.String getMetricsProviderClassName()
-
getMetricsProviderConfiguration
public java.util.Properties getMetricsProviderConfiguration()
-
areLocalSessionsEnabled
public boolean areLocalSessionsEnabled()
-
isLocalSessionsUpgradingEnabled
public boolean isLocalSessionsUpgradingEnabled()
-
isSslQuorum
public boolean isSslQuorum()
-
shouldUsePortUnification
public boolean shouldUsePortUnification()
-
getClientPortListenBacklog
public int getClientPortListenBacklog()
-
getInitLimit
public int getInitLimit()
-
getSyncLimit
public int getSyncLimit()
-
getConnectToLearnerMasterLimit
public int getConnectToLearnerMasterLimit()
-
getElectionAlg
public int getElectionAlg()
-
getElectionPort
public int getElectionPort()
-
getSnapRetainCount
public int getSnapRetainCount()
-
getPurgeInterval
public int getPurgeInterval()
-
getSyncEnabled
public boolean getSyncEnabled()
-
getQuorumVerifier
public QuorumVerifier getQuorumVerifier()
-
getLastSeenQuorumVerifier
public QuorumVerifier getLastSeenQuorumVerifier()
-
getServers
public java.util.Map<java.lang.Long,QuorumPeer.QuorumServer> getServers()
-
getJvmPauseInfoThresholdMs
public long getJvmPauseInfoThresholdMs()
-
getJvmPauseWarnThresholdMs
public long getJvmPauseWarnThresholdMs()
-
getJvmPauseSleepTimeMs
public long getJvmPauseSleepTimeMs()
-
isJvmPauseMonitorToRun
public boolean isJvmPauseMonitorToRun()
-
getServerId
public long getServerId()
-
isDistributed
public boolean isDistributed()
-
getPeerType
public QuorumPeer.LearnerType getPeerType()
-
getConfigFilename
public java.lang.String getConfigFilename()
-
getQuorumListenOnAllIPs
public java.lang.Boolean getQuorumListenOnAllIPs()
-
isMultiAddressEnabled
public boolean isMultiAddressEnabled()
-
isMultiAddressReachabilityCheckEnabled
public boolean isMultiAddressReachabilityCheckEnabled()
-
getMultiAddressReachabilityCheckTimeoutMs
public int getMultiAddressReachabilityCheckTimeoutMs()
-
isStandaloneEnabled
public static boolean isStandaloneEnabled()
-
setStandaloneEnabled
public static void setStandaloneEnabled(boolean enabled)
-
isReconfigEnabled
public static boolean isReconfigEnabled()
-
setReconfigEnabled
public static void setReconfigEnabled(boolean enabled)
-
-