Class QuorumPeerConfig
- java.lang.Object
-
- org.apache.zookeeper.server.quorum.QuorumPeerConfig
-
@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 java.lang.String
configFileStr
protected java.io.File
dataDir
protected java.io.File
dataLogDir
protected java.lang.String
dynamicConfigFileStr
protected int
electionAlg
protected int
electionPort
protected int
initLimit
protected QuorumVerifier
lastSeenQuorumVerifier
protected boolean
localSessionsEnabled
protected boolean
localSessionsUpgradingEnabled
protected int
maxClientCnxns
protected int
maxSessionTimeout
defaults to -1 if not set explicitlyprotected int
minSessionTimeout
defaults to -1 if not set explicitlystatic java.lang.String
nextDynamicConfigFileSuffix
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
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()
java.lang.String
getConfigFilename()
java.io.File
getDataDir()
java.io.File
getDataLogDir()
int
getElectionAlg()
int
getElectionPort()
int
getInitLimit()
QuorumVerifier
getLastSeenQuorumVerifier()
int
getMaxClientCnxns()
int
getMaxSessionTimeout()
int
getMinSessionTimeout()
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
isLocalSessionsUpgradingEnabled()
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)
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
-
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
-
localSessionsEnabled
protected boolean localSessionsEnabled
-
localSessionsUpgradingEnabled
protected boolean localSessionsUpgradingEnabled
-
initLimit
protected int initLimit
-
syncLimit
protected int syncLimit
-
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
-
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
-
-
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
-
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) 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()
-
getDataDir
public java.io.File getDataDir()
-
getDataLogDir
public java.io.File getDataLogDir()
-
getTickTime
public int getTickTime()
-
getMaxClientCnxns
public int getMaxClientCnxns()
-
getMinSessionTimeout
public int getMinSessionTimeout()
-
getMaxSessionTimeout
public int getMaxSessionTimeout()
-
areLocalSessionsEnabled
public boolean areLocalSessionsEnabled()
-
isLocalSessionsUpgradingEnabled
public boolean isLocalSessionsUpgradingEnabled()
-
isSslQuorum
public boolean isSslQuorum()
-
shouldUsePortUnification
public boolean shouldUsePortUnification()
-
getInitLimit
public int getInitLimit()
-
getSyncLimit
public int getSyncLimit()
-
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()
-
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()
-
isStandaloneEnabled
public static boolean isStandaloneEnabled()
-
setStandaloneEnabled
public static void setStandaloneEnabled(boolean enabled)
-
isReconfigEnabled
public static boolean isReconfigEnabled()
-
setReconfigEnabled
public static void setReconfigEnabled(boolean enabled)
-
-