QuorumPeerConfig (Apache ZooKeeper - Server 3.7.0 API)
Date: 2021-03-17

org.apache.zookeeper.server.quorum

## Class QuorumPeerConfig

- java.lang.Object
- - org.apache.zookeeper.server.quorum.QuorumPeerConfig

- Direct Known Subclasses:
    ControllerServerConfig

      @InterfaceAudience.Public
      public class QuorumPeerConfig
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `QuorumPeerConfig.ConfigException`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected InetSocketAddress` | `clientPortAddress`
    `protected int` | `clientPortListenBacklog` defaults to -1 if not set explicitly
    `protected String` | `configFileStr`
    `protected int` | `connectToLearnerMasterLimit`
    `protected File` | `dataDir`
    `protected File` | `dataLogDir`
    `protected String` | `dynamicConfigFileStr`
    `protected int` | `electionAlg`
    `protected int` | `electionPort`
    `protected String` | `initialConfig`
    `protected int` | `initLimit`
    `protected long` | `jvmPauseInfoThresholdMs` JVM Pause Monitor info threshold in ms
    `protected boolean` | `jvmPauseMonitorToRun` JVM Pause Monitor feature switch
    `protected long` | `jvmPauseSleepTimeMs` JVM Pause Monitor sleep time in ms
    `protected long` | `jvmPauseWarnThresholdMs` JVM Pause Monitor warn threshold in ms
    `protected QuorumVerifier` | `lastSeenQuorumVerifier`
    `protected boolean` | `localSessionsEnabled`
    `protected boolean` | `localSessionsUpgradingEnabled`
    `protected int` | `maxClientCnxns`
    `protected int` | `maxSessionTimeout` defaults to -1 if not set explicitly
    `protected String` | `metricsProviderClassName`
    `protected Properties` | `metricsProviderConfiguration`
    `protected int` | `minSessionTimeout` defaults to -1 if not set explicitly
    `static String` | `nextDynamicConfigFileSuffix`
    `protected int` | `observerMasterPort`
    `protected QuorumPeer.LearnerType` | `peerType`
    `protected int` | `purgeInterval`
    `protected int` | `quorumCnxnThreadsSize`
    `protected boolean` | `quorumEnableSasl`
    `protected String` | `quorumLearnerLoginContext`
    `protected boolean` | `quorumLearnerRequireSasl`
    `protected boolean` | `quorumListenOnAllIPs`
    `protected String` | `quorumServerLoginContext`
    `protected boolean` | `quorumServerRequireSasl` Configurations for the quorumpeer-to-quorumpeer sasl authentication
    `protected String` | `quorumServicePrincipal`
    `protected QuorumVerifier` | `quorumVerifier`
    `protected 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 and Description
    `QuorumPeerConfig()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `areLocalSessionsEnabled()`
    `void` | `checkValidity()`
    `static void` | `configureSSLAuth()` Configure SSL authentication only if it is not configured.
    `static void` | `deleteFile(String filename)`
    `static void` | `editStaticConfig(String configFileStr, String dynamicFileStr, boolean eraseClientPortAddress)` Edit static config file.
    `InetSocketAddress` | `getClientPortAddress()`
    `int` | `getClientPortListenBacklog()`
    `String` | `getConfigFilename()`
    `int` | `getConnectToLearnerMasterLimit()`
    `File` | `getDataDir()`
    `File` | `getDataLogDir()`
    `int` | `getElectionAlg()`
    `int` | `getElectionPort()`
    `String` | `getInitialConfig()`
    `int` | `getInitLimit()`
    `long` | `getJvmPauseInfoThresholdMs()`
    `long` | `getJvmPauseSleepTimeMs()`
    `long` | `getJvmPauseWarnThresholdMs()`
    `QuorumVerifier` | `getLastSeenQuorumVerifier()`
    `int` | `getMaxClientCnxns()`
    `int` | `getMaxSessionTimeout()`
    `String` | `getMetricsProviderClassName()`
    `Properties` | `getMetricsProviderConfiguration()`
    `int` | `getMinSessionTimeout()`
    `int` | `getMultiAddressReachabilityCheckTimeoutMs()`
    `int` | `getObserverMasterPort()`
    `QuorumPeer.LearnerType` | `getPeerType()`
    `int` | `getPurgeInterval()`
    `Boolean` | `getQuorumListenOnAllIPs()`
    `QuorumVerifier` | `getQuorumVerifier()`
    `InetSocketAddress` | `getSecureClientPortAddress()`
    `long` | `getServerId()`
    `Map<Long,QuorumPeer.QuorumServer>` | `getServers()`
    `int` | `getSnapRetainCount()`
    `boolean` | `getSyncEnabled()`
    `int` | `getSyncLimit()`
    `int` | `getTickTime()`
    `static String` | `getVersionFromFilename(String filename)`
    `boolean` | `isDistributed()`
    `boolean` | `isJvmPauseMonitorToRun()`
    `boolean` | `isLocalSessionsUpgradingEnabled()`
    `boolean` | `isMultiAddressEnabled()`
    `boolean` | `isMultiAddressReachabilityCheckEnabled()`
    `static boolean` | `isReconfigEnabled()`
    `boolean` | `isSslQuorum()`
    `static boolean` | `isStandaloneEnabled()`
    `void` | `parse(String path)` Parse a ZooKeeper configuration file
    `static QuorumVerifier` | `parseDynamicConfig(Properties dynamicConfigProp, int eAlg, boolean warnings, boolean configBackwardCompatibilityMode)` Parse dynamic configuration file and return quorumVerifier for new configuration.
    `void` | `parseProperties(Properties zkProp)` Parse config from a Properties.
    `static void` | `setReconfigEnabled(boolean enabled)`
    `static void` | `setStandaloneEnabled(boolean enabled)`
    `boolean` | `shouldUsePortUnification()`
    `static void` | `writeDynamicConfig(String dynamicConfigFilename, QuorumVerifier qv, boolean needKeepVersion)` Writes dynamic configuration file

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### nextDynamicConfigFileSuffix

          public static final String nextDynamicConfigFileSuffix

      See Also:
        Constant Field Values

    - #### clientPortAddress

          protected InetSocketAddress clientPortAddress

    - #### secureClientPortAddress

          protected InetSocketAddress secureClientPortAddress

    - #### sslQuorum

          protected boolean sslQuorum

    - #### shouldUsePortUnification

          protected boolean shouldUsePortUnification

    - #### observerMasterPort

          protected int observerMasterPort

    - #### sslQuorumReloadCertFiles

          protected boolean sslQuorumReloadCertFiles

    - #### dataDir

          protected File dataDir

    - #### dataLogDir

          protected File dataLogDir

    - #### dynamicConfigFileStr

          protected String dynamicConfigFileStr

    - #### configFileStr

          protected 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 String metricsProviderClassName

    - #### metricsProviderConfiguration

          protected 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 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 String quorumServicePrincipal

    - #### quorumLearnerLoginContext

          protected String quorumLearnerLoginContext

    - #### quorumServerLoginContext

          protected String quorumServerLoginContext

    - #### quorumCnxnThreadsSize

          protected int quorumCnxnThreadsSize

    - #### 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

  - ### Constructor Detail

    - #### QuorumPeerConfig

          public QuorumPeerConfig()

  - ### Method Detail

    - #### parse

          public void parse(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 String getVersionFromFilename(String filename)

    - #### parseProperties

          public void parseProperties(Properties zkProp)
                               throws IOException,
                                      QuorumPeerConfig.ConfigException

      Parse config from a Properties.
      Parameters:
        `zkProp` - Properties to parse from.
      Throws:
        `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(String dynamicConfigFilename,
                                                QuorumVerifier qv,
                                                boolean needKeepVersion)
                                         throws IOException

      Writes dynamic configuration file
      Throws:
        `IOException`

    - #### editStaticConfig

          public static void editStaticConfig(String configFileStr,
                                              String dynamicFileStr,
                                              boolean eraseClientPortAddress)
                                       throws 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:
        `IOException`

    - #### deleteFile

          public static void deleteFile(String filename)

    - #### parseDynamicConfig

          public static QuorumVerifier parseDynamicConfig(Properties dynamicConfigProp,
                                                          int eAlg,
                                                          boolean warnings,
                                                          boolean configBackwardCompatibilityMode)
                                                   throws IOException,
                                                          QuorumPeerConfig.ConfigException

      Parse dynamic configuration file and return quorumVerifier for new configuration.
      Parameters:
        `dynamicConfigProp` - Properties to parse from.
      Throws:
        `IOException`
        `QuorumPeerConfig.ConfigException`

    - #### checkValidity

          public void checkValidity()
                             throws IOException,
                                    QuorumPeerConfig.ConfigException

      Throws:
        `IOException`
        `QuorumPeerConfig.ConfigException`

    - #### getClientPortAddress

          public InetSocketAddress getClientPortAddress()

    - #### getSecureClientPortAddress

          public InetSocketAddress getSecureClientPortAddress()

    - #### getObserverMasterPort

          public int getObserverMasterPort()

    - #### getDataDir

          public File getDataDir()

    - #### getDataLogDir

          public File getDataLogDir()

    - #### getInitialConfig

          public String getInitialConfig()

    - #### getTickTime

          public int getTickTime()

    - #### getMaxClientCnxns

          public int getMaxClientCnxns()

    - #### getMinSessionTimeout

          public int getMinSessionTimeout()

    - #### getMaxSessionTimeout

          public int getMaxSessionTimeout()

    - #### getMetricsProviderClassName

          public String getMetricsProviderClassName()

    - #### getMetricsProviderConfiguration

          public 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 Map<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 String getConfigFilename()

    - #### getQuorumListenOnAllIPs

          public 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)

Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.