Class QuorumPeerConfig


  • @Public
    public class QuorumPeerConfig
    extends java.lang.Object
    • 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
      • lastSeenQuorumVerifier

        protected QuorumVerifier lastSeenQuorumVerifier
      • snapRetainCount

        protected int snapRetainCount
      • purgeInterval

        protected int purgeInterval
      • syncEnabled

        protected boolean syncEnabled
      • quorumServerRequireSasl

        protected boolean quorumServerRequireSasl
        Configurations for the quorumpeer-to-quorumpeer sasl authentication
      • quorumLearnerRequireSasl

        protected boolean quorumLearnerRequireSasl
      • quorumEnableSasl

        protected static boolean quorumEnableSasl
      • sessionRequireClientSASLAuth

        protected static boolean sessionRequireClientSASLAuth
      • quorumServicePrincipal

        protected java.lang.String quorumServicePrincipal
      • quorumLearnerLoginContext

        protected java.lang.String quorumLearnerLoginContext
      • quorumServerLoginContext

        protected java.lang.String quorumServerLoginContext
      • quorumCnxnThreadsSize

        protected int quorumCnxnThreadsSize
    • Constructor Detail

      • QuorumPeerConfig

        public QuorumPeerConfig()
    • Method Detail

      • getVersionFromFilename

        public static java.lang.String getVersionFromFilename​(java.lang.String filename)
      • 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
      • 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()
      • getLastSeenQuorumVerifier

        public QuorumVerifier getLastSeenQuorumVerifier()
      • getServerId

        public long getServerId()
      • isDistributed

        public boolean isDistributed()
      • 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)
      • isQuorumEnableSasl

        public static boolean isQuorumEnableSasl()
      • isSessionRequireClientSASLAuth

        public static boolean isSessionRequireClientSASLAuth()