### Run ZooKeeper Queue Producer Example Source: https://zookeeper.apache.org/doc/current/zookeeperTutorial.html Command to start a producer client that creates 100 elements in the queue. ```bash java SyncPrimitive qTest localhost 100 p ``` -------------------------------- ### Run ZooKeeper Queue Consumer Example Source: https://zookeeper.apache.org/doc/current/zookeeperTutorial.html Command to start a consumer client that consumes 100 elements from the queue. ```bash java SyncPrimitive qTest localhost 100 c ``` -------------------------------- ### ServerBean and ServerMXBean Methods Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Methods to get the start time of the server. ```APIDOC ## getStartTime() ### Description Returns the time when the server started. ### Method GET ### Endpoint N/A (Method in ServerBean and ServerMXBean) ### Parameters None ### Response N/A (Returns a long value representing time) ``` -------------------------------- ### Start Server Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/NIOServerCnxnFactory.html Starts the server connection factory. ```APIDOC ## start ### Description Starts the server connection factory. ### Method ```java public void start() ``` ``` -------------------------------- ### startup Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/NIOServerCnxnFactory.html Starts the NIOServerCnxnFactory, initializing it with a ZooKeeperServer and optionally starting the server. ```APIDOC ## startup(ZooKeeperServer zks, boolean startServer) ### Description Starts the NIOServerCnxnFactory, initializing it with the provided ZooKeeperServer instance and a flag indicating whether to start the server. ### Method `public void startup(ZooKeeperServer zks, boolean startServer)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ``` -------------------------------- ### start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/LearnerSessionTracker.html Starts the LearnerSessionTracker. ```APIDOC ## start ### Description Starts the LearnerSessionTracker. This method overrides the start method from the UpgradeableSessionTracker class. ### Method `void start()` ``` -------------------------------- ### start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/command/AbstractFourLetterCommand.html Starts the execution of the four-letter command. ```java public void start() ``` -------------------------------- ### Run ZooKeeper Barrier Example Source: https://zookeeper.apache.org/doc/current/zookeeperTutorial.html Command to start a barrier test with a specified number of participants. ```bash java SyncPrimitive bTest localhost 2 ``` -------------------------------- ### startup Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ZooKeeperServer.html Starts up the ZooKeeper server. ```APIDOC ## startup ### Description Starts up the ZooKeeper server. ### Method Signature `void startup()` ``` -------------------------------- ### Example Command for Snapshot Comparison Source: https://zookeeper.apache.org/doc/current/zookeeperTools.html An example command demonstrating how to use the snapshot comparer tool with specific left and right snapshot files, and thresholds for byte and node differences. ```bash ./bin/zkSnapshotComparer.sh -l /zookeeper-data/backup/snapshot.d.snappy -r /zookeeper-data/backup/snapshot.44 -b 2 -n 1 ``` -------------------------------- ### start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/UpgradeableSessionTracker.html Starts the session tracker. This method should be called after initialization. ```java public void start() ``` -------------------------------- ### start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/impl/DefaultMetricsProvider.html Starts the metrics provider, potentially initializing network endpoints or other resources. ```APIDOC ## start ### Description Start the provider. For instance such method will start a network endpoint. ### Method `void start()` ### Throws * `MetricsProviderLifeCycleException` - in case of failure ``` -------------------------------- ### Start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumPeer.html Starts the quorum peer's operations. ```APIDOC ## start ### Description Starts the quorum peer, including its participation in the quorum and leader election processes. ### Method POST ### Endpoint /quorum/start ### Overrides `start` in class `Thread` ``` -------------------------------- ### DummyAdminServer start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/DummyAdminServer.html The start method for DummyAdminServer. It is specified by the AdminServer interface but performs no action. It can throw an AdminServerException. ```java public void start() throws AdminServer.AdminServerException ``` -------------------------------- ### start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/NettyServerCnxnFactory.html Starts the connection factory. This method is specified by the ServerCnxnFactory interface. ```APIDOC ## start ### Description Starts the connection factory. ### Method `public void start()` ``` -------------------------------- ### ZooKeeper C Client Authentication and Node Creation Example Source: https://zookeeper.apache.org/doc/current/zookeeperProgrammers.html This example demonstrates authenticating with ZooKeeper using a custom scheme and creating an ephemeral node with specific permissions. It includes setup for the ZooKeeper handle, authentication, and node creation, followed by an attempt to retrieve the node which is expected to fail due to insufficient permissions. ```c #include #include #include "zookeeper.h" static zhandle_t *zh; /** * In this example this method gets the cert for your * environment -- you must provide */ char *foo_get_cert_once(char* id) { return 0; } /** Watcher function -- empty for this example, not something you should * do in real code */ void watcher(zhandle_t *zzh, int type, int state, const char *path, void *watcherCtx) {} int main(int argc, char argv) { char buffer[512]; char p[2048]; char *cert=0; char appId[64]; strcpy(appId, "example.foo_test"); cert = foo_get_cert_once(appId); if(cert!=0) { fprintf(stderr, "Certificate for appid [%s] is [%s]\n",appId,cert); strncpy(p,cert, sizeof(p)-1); free(cert); } else { fprintf(stderr, "Certificate for appid [%s] not found\n",appId); strcpy(p, "dummy"); } zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG); zh = zookeeper_init("localhost:3181", watcher, 10000, 0, 0, 0); if (!zh) { return errno; } if(zoo_add_auth(zh,"foo",p,strlen(p),0,0)!=ZOK) return 2; struct ACL CREATE_ONLY_ACL[] = {{ZOO_PERM_CREATE, ZOO_AUTH_IDS}}; struct ACL_vector CREATE_ONLY = {1, CREATE_ONLY_ACL}; int rc = zoo_create(zh,"/xyz","value", 5, &CREATE_ONLY, ZOO_EPHEMERAL, buffer, sizeof(buffer)-1); /** this operation will fail with a ZNOAUTH error */ int buflen= sizeof(buffer); struct Stat stat; rc = zoo_get(zh, "/xyz", 0, buffer, &buflen, &stat); if (rc) { fprintf(stderr, "Error %d for %s\n", rc, __LINE__); } zookeeper_close(zh); return 0; } ``` -------------------------------- ### AdminServer start() Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/AdminServer.html Starts the embedded administrative server. This method can throw an AdminServerException if the server fails to start. ```java void start() throws AdminServer.AdminServerException ``` -------------------------------- ### Incremental Reconfiguration - Java API Examples Source: https://zookeeper.apache.org/doc/current/zookeeperReconfig.html Examples demonstrating how to use the Java API for incremental reconfiguration, allowing servers to be added or removed from the current configuration without a full restart. ```APIDOC ## Incremental Reconfiguration - Java API ### Description Demonstrates adding and removing servers from a ZooKeeper ensemble using the Java API. ### Method `zk.reconfig(joiningServers, leavingServers, null, configVersion, stat)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example 1: Removing Servers ```java List leavingServers = new ArrayList(); leavingServers.add("1"); leavingServers.add("2"); byte[] config = zk.reconfig(null, leavingServers, null, -1, new Stat()); ``` ### Request Example 2: Adding and Removing Servers ```java List leavingServers = new ArrayList(); List joiningServers = new ArrayList(); leavingServers.add("1"); joiningServers.add("server.4=localhost:1234:1235;1236"); byte[] config = zk.reconfig(joiningServers, leavingServers, null, -1, new Stat()); String configStr = new String(config); System.out.println(configStr); ``` ### Response #### Success Response (200) - `byte[]`: The new configuration as a byte array. #### Response Example ``` newconfig ``` ``` -------------------------------- ### Audit Log Entry for System Operations (Server Starter User) Source: https://zookeeper.apache.org/doc/current/zookeeperAuditLogs.html This example demonstrates an audit log entry for system operations when no specific server principal is associated, defaulting to the user who started the ZooKeeper server. ```text user=root operation=serverStart result=success ``` -------------------------------- ### LeaderZooKeeperServer startup() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts up the leader ZooKeeper server. ```APIDOC ## startup() ### Description Starts up the leader ZooKeeper server. ### Method Method signature ### Endpoint N/A (Java method) ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### Start Client Connection Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/ClientCnxn.html Starts the client connection, including establishing the network connection and initializing necessary threads. This method must be called after construction. ```java public void start() ``` -------------------------------- ### start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/ObserverMaster.html Starts the ObserverMaster service. ```APIDOC ## start ### Description Starts the ObserverMaster service, initializing its components and beginning its operation. ### Method `start` ### Throws - `IOException` - If an I/O error occurs during startup. ``` -------------------------------- ### start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/LeaderSessionTracker.html Starts the LeaderSessionTracker. Overrides the start method from UpgradeableSessionTracker. ```APIDOC ## start ### Description Starts the LeaderSessionTracker. This method overrides the start method inherited from UpgradeableSessionTracker. ### Method `void start()` ``` -------------------------------- ### startForwarding Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/ObserverMaster.html Starts forwarding requests to a learner. ```APIDOC ## startForwarding ### Description Initiates the forwarding of requests to a learner, starting from a specified last seen transaction ID. ### Method `startForwarding` ### Parameters - **learnerHandler** (LearnerHandler) - The handler for the learner to which requests will be forwarded. - **lastSeenZxid** (long) - The last transaction ID seen by the learner. ### Response - **long**: The new last seen transaction ID after forwarding. ``` -------------------------------- ### ZooKeeperServerEmbedded start() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts the embedded ZooKeeper server. ```APIDOC ## start() ### Description Starts the embedded ZooKeeper server. ### Method Method signature ### Endpoint N/A (Java method) ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### Startup Server Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/NIOServerCnxnFactory.html Starts up the ZooKeeper server with the given ZooKeeperServer instance and a flag indicating whether to start the server. ```APIDOC ## startup ### Description Starts up the ZooKeeper server with the given ZooKeeperServer instance and a flag indicating whether to start the server. ### Method ```java public void startup(ZooKeeperServer zks, boolean startServer) throws IOException, InterruptedException ``` ### Parameters * **zks** (ZooKeeperServer) - The ZooKeeperServer instance to start. * **startServer** (boolean) - A flag indicating whether to start the server. ### Throws * **IOException** - If an I/O error occurs. * **InterruptedException** - If the thread is interrupted. ``` -------------------------------- ### Starting ZooKeeper Ensemble Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumPeerMain.html The main method is used to start the replicated ZooKeeper server. It requires a path to a configuration file as a command-line argument. ```APIDOC ## main ### Description To start the replicated server specify the configuration file name on the command line. ### Method `public static void main(String[] args)` ### Parameters #### Path Parameters - **args** (String[]) - Required - Path to the config file. ``` -------------------------------- ### Start MetricsProvider Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/MetricsProvider.html Starts the metrics provider, potentially initiating network endpoints or other necessary services. This method can throw an exception if the startup fails. ```java void start() throws MetricsProviderLifeCycleException ``` -------------------------------- ### NullMetricsProvider start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/impl/NullMetricsProvider.html Starts the NullMetricsProvider. This method is part of the MetricsProvider interface but is a no-operation in this implementation. ```java public void start() throws MetricsProviderLifeCycleException ``` -------------------------------- ### start() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/WorkerService.html Starts the worker service and its associated thread pool. ```APIDOC ## start() ### Description Starts the worker service. ``` -------------------------------- ### start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/FastLeaderElection.html This method starts the sender and receiver threads. ```APIDOC ## start Method ### Description This method starts the sender and receiver threads. ### Method POST ### Endpoint /zookeeper/server/quorum/FastLeaderElection/start ``` -------------------------------- ### Start ZooKeeper Server Source: https://zookeeper.apache.org/doc/current/zookeeperAdmin.html Command to start a ZooKeeper server instance using the QuorumPeerMain class. Ensure all necessary JARs and configuration files are in the classpath. ```bash $ java -cp zookeeper.jar:lib/*:conf org.apache.zookeeper.server.quorum.QuorumPeerMain zoo.conf ``` -------------------------------- ### Start ZooKeeper Server Source: https://zookeeper.apache.org/doc/current/zookeeperStarted.html Command to start the ZooKeeper server in standalone mode. This script is typically found in the ZooKeeper installation's bin directory. ```bash bin/zkServer.sh start ``` -------------------------------- ### ControllerService start(ControllerServerConfig) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts a new thread to run the controller, useful for in-process hosting like unit testing. ```APIDOC ## start(ControllerServerConfig config) ### Description Starts a new thread to run the controller (useful when this service is hosted in process - such as during unit testing). ### Method Method signature ### Endpoint N/A (Java method) ### Parameters - **config** (ControllerServerConfig) - Configuration for the controller service ### Request Example N/A ### Response N/A ``` -------------------------------- ### DummyAdminServer.start() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/DummyAdminServer.html Starts the DummyAdminServer. This method is a no-operation as the server is disabled. ```APIDOC ## start() ### Description Starts the AdminServer. This is a no-operation for DummyAdminServer. ### Method `void start()` ### Throws `AdminServer.AdminServerException` ``` -------------------------------- ### Command Execution via GET Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/class-use/CommandResponse.html Demonstrates how to execute commands using an HTTP GET request, which returns a CommandResponse. ```APIDOC ## GET /commands/{cmdName} ### Description Executes a registered command via an HTTP GET request. ### Method GET ### Endpoint /commands/{cmdName} ### Parameters #### Path Parameters - **cmdName** (String) - Required - The name of the command to execute. #### Query Parameters - **kwargs** (Map) - Optional - Additional parameters for the command. ### Response #### Success Response (200) - **CommandResponse** (CommandResponse) - The response from the executed command. ### Response Example ```json { "response_field_1": "value1", "response_field_2": "value2" } ``` ``` -------------------------------- ### ConnectionBean and ConnectionMXBean Methods Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Methods to get the start time of a connection. ```APIDOC ## getStartedTime() ### Description Returns the time when the connection was started. ### Method GET ### Endpoint N/A (Method in ConnectionBean and ConnectionMXBean) ### Parameters None ### Response N/A (Returns a long value representing time) ``` -------------------------------- ### Start MetricsProvider Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/impl/DefaultMetricsProvider.html Starts the metrics provider, potentially initializing network endpoints or other resources. This method must be called before metrics can be collected or reported. ```java public void start() throws MetricsProviderLifeCycleException ``` -------------------------------- ### ZooKeeperServerBean and ZooKeeperServerMXBean Methods Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Methods to get the start time of the ZooKeeper server. ```APIDOC ## getStartTime() ### Description Returns the time when the ZooKeeper server started. ### Method GET ### Endpoint N/A (Method in ZooKeeperServerBean and ZooKeeperServerMXBean) ### Parameters None ### Response N/A (Returns a long value representing time) ``` -------------------------------- ### LeaderElectionBean and LeaderElectionMXBean Methods Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Methods to get the start time of the leader election. ```APIDOC ## getStartTime() ### Description Returns the time when the leader election started. ### Method GET ### Endpoint N/A (Method in LeaderElectionBean and LeaderElectionMXBean) ### Parameters None ### Response N/A (Returns a long value representing time) ``` -------------------------------- ### QuorumPeerMain.main Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html To start the replicated server specify the configuration file name on the command line. ```APIDOC ## main(String[]) - Static method in class org.apache.zookeeper.server.quorum.QuorumPeerMain ### Description To start the replicated server specify the configuration file name on the command line. ### Method static main ### Parameters #### Path Parameters - **args** (String[]) - Required - Command line arguments, including the configuration file name. ``` -------------------------------- ### ControllerService.main Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts the ControllerService as a stand alone app. ```APIDOC ## main(String[]) - Static method in class org.apache.zookeeper.server.controller.ControllerService ### Description Starts the ControllerService as a stand alone app. ### Method static main ### Parameters #### Path Parameters - **args** (String[]) - Required - Command line arguments. ``` -------------------------------- ### FileTxnSnapLog.readTxnLog(long zxid) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/persistence/class-use/TxnLog.TxnIterator.html Gets a TxnIterator for iterating through the transaction log starting at a given zxid. ```APIDOC ## FileTxnSnapLog.readTxnLog(long zxid) ### Description Gets a TxnIterator for iterating through the transaction log starting at a given zxid. ### Method `readTxnLog` ### Parameters #### Path Parameters - **zxid** (long) - Required - The starting transaction ID. ### Return Value - **TxnLog.TxnIterator** - An iterator for the transaction logs. ``` -------------------------------- ### Start Dockerized Jepsen Environment Source: https://zookeeper.apache.org/doc/current/zookeeperTools.html Shell script to initialize and start the Docker containers for the Jepsen environment. This may take a significant amount of time on the first run. ```bash ./up.sh ``` -------------------------------- ### Get Started and Start Times for ZooKeeper Connections and Leaders Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all Methods for retrieving the time when a connection or leader election process started. These are available through `ConnectionBean`, `ConnectionMXBean`, `LeaderElectionBean`, `LeaderElectionMXBean`, `ServerBean`, `ServerMXBean`, `ZooKeeperServerBean`, and `ZooKeeperServerMXBean`. ```java getStartedTime() getStartTime() ``` -------------------------------- ### Non-incremental Reconfiguration - Java API Example Source: https://zookeeper.apache.org/doc/current/zookeeperReconfig.html Example showing how to use the Java API for non-incremental reconfiguration, where a complete specification of the new dynamic system configuration is provided. ```APIDOC ## Non-incremental Reconfiguration - Java API ### Description Demonstrates replacing the entire ZooKeeper ensemble configuration with a new set of members using the Java API. ### Method `zk.reconfig(null, null, newMembers, configVersion, stat)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example: ```java List newMembers = new ArrayList(); newMembers.add("server.1=1111:1234:1235;1236"); newMembers.add("server.2=1112:1237:1238;1239"); newMembers.add("server.3=1114:1240:1241:observer;1242"); byte[] config = zk.reconfig(null, null, newMembers, -1, new Stat()); String configStr = new String(config); System.out.println(configStr); ``` ### Response #### Success Response (200) - `byte[]`: The new configuration as a byte array. #### Response Example ``` newconfig ``` ``` -------------------------------- ### Get Initial Configuration String Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumPeerConfig.html Retrieves the initial configuration as a String. ```java public String getInitialConfig() ``` -------------------------------- ### Get Connection Start Time Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ConnectionBean.html Retrieves the time when the connection was established. Implements the getStartedTime method from the ConnectionMXBean interface. ```java public String getStartedTime() ``` -------------------------------- ### setupRequestProcessors Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ZooKeeperServer.html Sets up the request processors. ```APIDOC ## setupRequestProcessors ### Description Sets up the request processors. ### Method Signature `protected void setupRequestProcessors()` ``` -------------------------------- ### FileTxnSnapLog.readTxnLog(long zxid, boolean fastForward) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/persistence/class-use/TxnLog.TxnIterator.html Gets a TxnIterator for iterating through the transaction log starting at a given zxid, with an option for fast-forwarding. ```APIDOC ## FileTxnSnapLog.readTxnLog(long zxid, boolean fastForward) ### Description Gets a TxnIterator for iterating through the transaction log starting at a given zxid. The `fastForward` parameter can be used to optimize the reading process. ### Method `readTxnLog` ### Parameters #### Path Parameters - **zxid** (long) - Required - The starting transaction ID. - **fastForward** (boolean) - Required - If true, enables fast-forwarding. ### Return Value - **TxnLog.TxnIterator** - An iterator for the transaction logs. ``` -------------------------------- ### startdata Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ZooKeeperServer.html Starts the data processing for the server. ```APIDOC ## startdata ### Description Starts the data processing for the server. ### Method Signature `void startdata()` ``` -------------------------------- ### Get ZooKeeper Server User Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/audit/ZKAuditProvider.html Retrieves the username of the user who started the ZooKeeper server. If no user is logged in, it defaults to the system user. ```java public static String getZKUser() ``` -------------------------------- ### Get Snapshot Logs Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/persistence/FileTxnSnapLog.html Retrieves snapshot log files that may contain transactions newer than the specified zxid. This includes logs with a starting zxid greater than the given zxid, and the newest transaction log with a starting zxid less than the given zxid. ```java public File[] getSnapshotLogs(long zxid) ``` -------------------------------- ### Start Prometheus Server with ZooKeeper Configuration Source: https://zookeeper.apache.org/doc/current/zookeeperMonitor.html This command starts the Prometheus server, pointing it to the configuration file for scraping ZooKeeper metrics. It also specifies the web listen address and the path for time-series data storage. ```bash nohup /tmp/prometheus \ --config.file /tmp/test-zk.yaml \ --web.listen-address ":9090" \ --storage.tsdb.path "/tmp/test-zk.data" >> /tmp/test-zk.log 2>&1 & ``` -------------------------------- ### initial_configuration Source: https://zookeeper.apache.org/doc/current/zookeeperAdmin.html Retrieves the text of the configuration file used to start the peer. ```APIDOC ## initial_configuration ### Description Print the text of the configuration file used to start the peer. ### Method GET ### Endpoint /commands/icfg ### Response #### Success Response (200) Returns "initial_configuration". ``` -------------------------------- ### Get Leader Election Start Time Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/LeaderElectionMXBean.html Retrieves the timestamp indicating when the leader election process began. This method is part of the LeaderElectionMXBean interface. ```java String getStartTime() ``` -------------------------------- ### main Method - SnapshotRecursiveSummary Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/SnapshotRecursiveSummary.html Entry point for the SnapshotRecursiveSummary tool. It takes snapshot file, starting node, and max depth as arguments. Ensure arguments are provided in the correct order. ```java public static void main(String[] args) throws Exception ``` -------------------------------- ### setupRequestProcessors Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.html Sets up the request processing pipeline for the leader. ```APIDOC ## setupRequestProcessors ### Description Configures the chain of processors responsible for handling incoming requests on the leader. ### Method protected void setupRequestProcessors() ### Overrides `setupRequestProcessors` in class `ZooKeeperServer` ``` -------------------------------- ### Get Content Type - Java Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all Specifies the MIME type of the output produced by a command outputter. Examples include 'application/json'. This is used in the admin interface for formatting responses. ```Java getContentType() - Method in interface org.apache.zookeeper.server.admin.CommandOutputter The MIME type of this output (e.g., "application/json") getContentType() - Method in class org.apache.zookeeper.server.admin.JsonOutputter getContentType() - Method in class org.apache.zookeeper.server.admin.StreamOutputter ``` -------------------------------- ### MetricsProvider configure() and start() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/class-use/MetricsProviderLifeCycleException.html Methods in the MetricsProvider interface that can throw MetricsProviderLifeCycleException during configuration or startup. ```APIDOC ## MetricsProvider configure(Properties configuration) ### Description Configure the provider. ### Method void ### Parameters - configuration (Properties) - The configuration properties for the metrics provider. ### Throws MetricsProviderLifeCycleException - If an error occurs during configuration. ``` ```APIDOC ## MetricsProvider start() ### Description Start the provider. ### Method void ### Throws MetricsProviderLifeCycleException - If an error occurs during startup. ``` -------------------------------- ### start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/CommitProcessor.html Starts the CommitProcessor. Overrides the start method from the Thread class. ```java public’void’ start() ``` -------------------------------- ### ClientX509Util Constructor Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/common/ClientX509Util.html Initializes a new instance of the ClientX509Util class. ```APIDOC ## ClientX509Util() ### Description Initializes a new instance of the ClientX509Util class. ### Constructor `public ClientX509Util()` ``` -------------------------------- ### zkTxnLogToolkit.sh Usage Help Source: https://zookeeper.apache.org/doc/current/zookeeperTools.html Running `zkTxnLogToolkit.sh` without parameters or with `-h` displays its help message, outlining available options for transaction log manipulation. ```bash $ bin/zkTxnLogToolkit.sh usage: TxnLogToolkit [-dhrv] txn_log_file_name -d,--dump Dump mode. Dump all entries of the log file. (this is the default) -h,--help Print help message -r,--recover Recovery mode. Re-calculate CRC for broken entries. -v,--verbose Be verbose in recovery mode: print all entries, not just fixed ones. -y,--yes Non-interactive mode: repair all CRC errors without asking ``` -------------------------------- ### Commands.SystemPropertiesCommand Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/allclasses-index.html Lists all defined system properties. ```APIDOC ## Commands.SystemPropertiesCommand ### Description All defined system properties. ### Class Commands.SystemPropertiesCommand ``` -------------------------------- ### ReadOnlyZooKeeperServer startup() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts up the read-only ZooKeeper server. ```APIDOC ## startup() ### Description Starts up the read-only ZooKeeper server. ### Method Method signature ### Endpoint N/A (Java method) ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### main Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ZooKeeperServerMain.html The entry point for the ZooKeeper server application. It starts the server with the provided command-line arguments. ```APIDOC ## main(String[] args) ### Description Starts and runs a standalone ZooKeeper server. This is the main entry point for the application. ### Method `public static void main(String[] args)` ### Parameters * **args** (String[]) - Command-line arguments for configuring and starting the server. ``` -------------------------------- ### Start Metrics Provider Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/impl/MetricsProviderBootstrap.html Starts a metrics provider based on the provided class name and configuration properties. This method can throw a MetricsProviderLifeCycleException if the provider fails to start. ```java public static MetricsProvider startMetricsProvider(String metricsProviderClassName, Properties configuration) throws MetricsProviderLifeCycleException ``` -------------------------------- ### Op.create with CreateOptions Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/class-use/CreateOptions.html Demonstrates how to construct a create operation using CreateOptions. This method allows for specifying custom options when creating a znode. ```APIDOC ## Op.create(String path, byte[] data, CreateOptions options) ### Description Constructs a create operation which uses `ZooDefs.OpCode.create2` if no one is inferred from create mode. ### Method `static Op` ### Parameters - **path** (String) - The path of the znode to create. - **data** (byte[]) - The data to be stored in the znode. - **options** (CreateOptions) - The options for the create operation. ``` -------------------------------- ### main Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/SnapshotFormatter.html The main method serves as the entry point for the SnapshotFormatter utility. It accepts a snapshot file path as an argument and can be invoked directly or through the zkSnapShotToolkit.sh script. ```APIDOC ## main ### Description Entry point for the SnapshotFormatter utility. Dumps a snapshot file to stdout. ### Method `public static void main(String[] args) throws Exception` ### Parameters * `args` (String[]) - Command line arguments. Expected format: `snapshot_file`. ### Throws * `Exception` - If an error occurs during execution. ``` -------------------------------- ### Server Start Time Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ZooKeeperServerMXBean.html Retrieves the timestamp when the ZooKeeper server was started. ```APIDOC ## getStartTime ### Description Returns the time the server was started. ### Method GET ### Endpoint /jmx/metrics/startTime ### Response #### Success Response (200) - **startTime** (string) - The time the server was started. ``` -------------------------------- ### ZooKeeper Snapshot Comparer Help Page Source: https://zookeeper.apache.org/doc/current/zookeeperTools.html Displays the usage instructions and available arguments for the snapshot comparer tool when run without valid arguments. ```bash usage: java -cp org.apache.zookeeper.server.SnapshotComparer -b,--bytes (Required) The node data delta size threshold, in bytes, for printing the node. -d,--debug Use debug output. -i,--interactive Enter interactive mode. -l,--left (Required) The left snapshot file. -n,--nodes (Required) The descendant node delta size threshold, in nodes, for printing the node. -r,--right (Required) The snapshot file. ``` -------------------------------- ### Commands.InitialConfigurationCommand Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/allclasses-index.html Represents a command to retrieve the initial configuration. ```APIDOC ## Commands.InitialConfigurationCommand ### Description ### Class Commands.InitialConfigurationCommand ``` -------------------------------- ### setupRequestProcessors (FollowerZooKeeperServer) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Sets up the request processors for a Follower ZooKeeper server. ```APIDOC ## setupRequestProcessors ### Description Sets up the request processors for a Follower ZooKeeper server. ### Method Instance method ### Class org.apache.zookeeper.server.quorum.FollowerZooKeeperServer ``` -------------------------------- ### setupRequestProcessors Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/ObserverZooKeeperServer.html Sets up the request processors for an Observer: firstProcessor->commitProcessor->finalProcessor. ```APIDOC ## setupRequestProcessors ### Description Set up the request processors for an Observer: firstProcesor->commitProcessor->finalProcessor. Overrides: `setupRequestProcessors` in class `ZooKeeperServer` ### Method protected void setupRequestProcessors() ``` -------------------------------- ### ZooKeeperServerEmbedded start(long) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts the embedded ZooKeeper server with a specified timeout. ```APIDOC ## start(long timeout) ### Description Starts the embedded ZooKeeper server with a specified timeout. ### Method Method signature ### Endpoint N/A (Java method) ### Parameters - **timeout** (long) - Description of the timeout parameter ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get Op Kind Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/Op.html Gets the kind of an Op, returning an OpKind value. ```java public Op.OpKind getKind() ``` -------------------------------- ### Get Initial Configuration Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumPeerConfig.html Retrieves the initial configuration string. ```APIDOC ## getInitialConfig() ### Description Retrieves the initial configuration string. ### Method ```java public String getInitialConfig() ``` ### Returns - `String` - The initial configuration. ``` -------------------------------- ### Initialize ZooKeeper Data Directory and myid File Source: https://zookeeper.apache.org/doc/current/zookeeperAdmin.html The zkServer-initialize.sh script is provided to create necessary data and transaction log directories. It can also optionally set up the myid file. This script requires a configuration file to be present. ```bash ./zkServer-initialize.sh ``` -------------------------------- ### ZooKeeper CLI Get Command Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Represents the 'get' command for the ZooKeeper command-line interface. ```APIDOC ## GetCommand (Class) ### Description Represents the 'get' command for the ZooKeeper command-line interface. ### Constructors - **GetCommand()** - **GetCommand(List)** ``` -------------------------------- ### ServerCnxnFactory startup(ZooKeeperServer) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts up the connection factory with the given ZooKeeper server instance. ```APIDOC ## startup(ZooKeeperServer zks) ### Description Starts up the connection factory with the given ZooKeeper server instance. ### Method Method signature ### Endpoint N/A (Java method) ### Parameters - **zks** (ZooKeeperServer) - The ZooKeeper server instance. ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get Op Type Code Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/Op.html Gets the integer type code for an Op, which should correspond to ZooDefs.OpCode. ```java public int getType() ``` -------------------------------- ### Start Embedded ZooKeeper Server with Timeout Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/embedded/ZooKeeperServerEmbedded.html Starts the embedded ZooKeeper server with a specified startup timeout. ```APIDOC ## start ### Description Start the embedded ZooKeeper server with a specified timeout. ### Method ```java void start(long startupTimeout) throws Exception ``` ### Parameters #### Path Parameters - **startupTimeout** (long) - time to wait in millis for the server to start ### Throws * `Exception` - If the server fails to start within the given timeout. ``` -------------------------------- ### start Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/MetricsProvider.html Starts the MetricsProvider. This method is called when the ZooKeeper system is ready to begin collecting and publishing metrics. ```APIDOC ## Method: start ### Description Start the provider. For instance, such method will start a network endpoint. ### Signature ```java void start() throws MetricsProviderLifeCycleException ``` ### Throws * `MetricsProviderLifeCycleException` - In case of failure during startup. ``` -------------------------------- ### setupRequestProcessors (LeaderZooKeeperServer) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Sets up the request processors for a Leader ZooKeeper server. ```APIDOC ## setupRequestProcessors ### Description Sets up the request processors for a Leader ZooKeeper server. ### Method Instance method ### Class org.apache.zookeeper.server.quorum.LeaderZooKeeperServer ``` -------------------------------- ### InitialConfigurationCommand runGet Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/Commands.InitialConfigurationCommand.html Executes the InitialConfigurationCommand for an HTTP GET request. This command retrieves the initial configuration of the ZooKeeper server. ```APIDOC ## GET InitialConfigurationCommand ### Description Retrieves the initial configuration of the ZooKeeper server. ### Method GET ### Endpoint /commands/initial-configuration ### Parameters #### Query Parameters - **zkServer** (ZooKeeperServer) - Required - The ZooKeeper server instance. - **kwargs** (Map) - Optional - Keyword arguments for the command. ### Request Example ```json { "zkServer": "", "kwargs": {} } ``` ### Response #### Success Response (200) - **command** (string) - The primary name of the command. - **error** (string) - An error message if the command failed, otherwise null. - **configuration** (string) - The initial configuration of the ZooKeeper server. #### Response Example ```json { "command": "initial-configuration", "error": null, "configuration": "server.1=host1:2888:3888\nserver.2=host2:2888:3888" } ``` ``` -------------------------------- ### Start Thread If Needed Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/Login.html Starts the internal login management thread if it's not already running. ```java public void startThreadIfNeeded() ``` -------------------------------- ### Start Embedded ZooKeeper Server Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/embedded/ZooKeeperServerEmbedded.html Starts the embedded ZooKeeper server. The server will run within the same Java process. ```APIDOC ## start ### Description Start the embedded ZooKeeper server. ### Method ```java void start() throws Exception ``` ### Throws * `Exception` - If the server fails to start. ``` -------------------------------- ### waitForStartup Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/Leader.html Waits for the leader to complete its startup process. ```APIDOC ## waitForStartup ```java public void waitForStartup() ``` ### Description Blocks until the leader has completed its initialization and startup procedures, ensuring it is ready to serve requests. ``` -------------------------------- ### ControllerService Start Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/controller/ControllerService.html Starts the controller in a new thread. This is useful when the service is hosted in-process, such as during unit testing. ```java public Thread start(ControllerServerConfig controllerConfig) ``` -------------------------------- ### DummyAdminServer Constructor Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/DummyAdminServer.html Initializes a new instance of the DummyAdminServer class. ```APIDOC ## DummyAdminServer() ### Description Constructs a new DummyAdminServer. ### Constructor `DummyAdminServer()` ``` -------------------------------- ### Initialize Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumPeer.html Initializes the quorum peer. ```APIDOC ## initialize ### Description Initializes the quorum peer, performing necessary setup operations. ### Method POST ### Endpoint /quorum/initialize ### Throws - `SaslException` ``` -------------------------------- ### ZooKeeper Server Admin Get Command Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Represents an HTTP GET request within the ZooKeeper server administration interface. ```APIDOC ## GetCommand (Class) ### Description Command that represents HTTP GET request. ### Constructors - **GetCommand(List)** - **GetCommand(List, boolean)** - **GetCommand(List, boolean, AuthRequest)** ``` -------------------------------- ### setupRequestProcessors (ObserverZooKeeperServer) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Sets up the request processors for an Observer ZooKeeper server. ```APIDOC ## setupRequestProcessors ### Description Sets up the request processors for an Observer: firstProcesor->commitProcessor->finalProcessor. ### Method Instance method ### Class org.apache.zookeeper.server.quorum.ObserverZooKeeperServer ``` -------------------------------- ### Start ContainerManager Timer Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ContainerManager.html Starts or restarts the timer that manages the periodic checking of containers. This method can be safely called multiple times. ```java public void start() ``` -------------------------------- ### setupRequestProcessors Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ZooKeeperServer.html Configures and sets up the request processing pipeline. This is a protected method. ```APIDOC ## setupRequestProcessors ### Description Sets up the request processing pipeline. ### Method protected void setupRequestProcessors() ``` -------------------------------- ### DirsCommand GET Request Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/Commands.DirsCommand.html This command can be invoked via an HTTP GET request to retrieve information about ZooKeeper data and snapshot directories. ```APIDOC ## GET /commands/dirs ### Description Retrieves information on ZK datadir and snapdir size in bytes. ### Method GET ### Endpoint /commands/dirs ### Parameters #### Query Parameters - **zkServer** (ZooKeeperServer) - Required - The ZooKeeper server instance. - **kwargs** (Map) - Optional - Keyword arguments for the command. ### Response #### Success Response (200) - **CommandResponse** - An object containing the command's primary name and the response data. - **command** (string) - The primary name of the command. - **error** (string) - An error message if the command failed, otherwise null. - **datadirSize** (long) - The size of the data directory in bytes. - **snapdirSize** (long) - The size of the snapshot directory in bytes. ### Request Example ```json { "zkServer": "", "kwargs": {} } ``` ### Response Example ```json { "command": "dirs", "error": null, "datadirSize": 1024000, "snapdirSize": 512000 } ``` ``` -------------------------------- ### IsroCommand GET Request Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/Commands.IsroCommand.html This snippet details how to run the IsroCommand for an HTTP GET request to check the server's read-only status. ```APIDOC ## IsroCommand GET Request ### Description Checks if the ZooKeeper server is in read-only mode. The returned map contains a boolean value for the key "is_read_only". ### Method GET ### Endpoint /commands/isro (Assumed based on typical command patterns, not explicitly stated in source) ### Parameters #### Query Parameters None explicitly documented for this command. #### Request Body None ### Request Example (No specific request body example provided for GET) ### Response #### Success Response (200) - **is_read_only** (Boolean) - True if the server is in read-only mode, false otherwise. #### Response Example ```json { "is_read_only": false } ``` ``` -------------------------------- ### main Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/SnapshotRecursiveSummary.html The entry point for the SnapshotRecursiveSummary tool, allowing it to be run from the command line. ```APIDOC ## Method: main ### Description Executes the SnapshotRecursiveSummary tool from the command line. ### Signature `public static void main(String[] args) throws Exception` ### Usage `SnapshotRecursiveSummary snapshot_file starting_node max_depth` ### Throws * `Exception` ``` -------------------------------- ### main Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/ServerAdminClient.html The main entry point for the ServerAdminClient application. ```APIDOC ## main ### Description The main entry point for the ServerAdminClient application. This method can be used to run administrative commands from the command line. ### Method `static void main(String[] args)` ### Parameters * **args** (String[]) - An array of strings representing command-line arguments. ``` -------------------------------- ### LearnerZooKeeperServer Constructor Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/LearnerZooKeeperServer.html Initializes a new instance of LearnerZooKeeperServer with the specified parameters. ```APIDOC ## LearnerZooKeeperServer Constructor ### Description Initializes a new instance of LearnerZooKeeperServer. ### Parameters - **logFactory** (FileTxnSnapLog) - The transaction and snapshot log factory. - **tickTime** (int) - The time interval in milliseconds that defines a tick. - **minSessionTimeout** (int) - The minimum session timeout in milliseconds. - **maxSessionTimeout** (int) - The maximum session timeout in milliseconds. - **listenBacklog** (int) - The backlog for the listening socket. - **zkDb** (ZKDatabase) - The ZooKeeper database. - **self** (QuorumPeer) - The QuorumPeer instance representing this server. ``` -------------------------------- ### Get Sync Limit Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/QuorumBean.html Retrieves the sync limit, which is the number of ticks that can pass between sending a request and getting an acknowledgment. Implemented from QuorumMXBean interface. ```java public int getSyncLimit() ``` -------------------------------- ### initialize Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/ProposalRequestProcessor.html Initializes the ProposalRequestProcessor. ```APIDOC ## initialize Method ### Description Initializes this processor. This method should be called after the processor has been constructed. ### Signature ```java public void initialize() ``` ``` -------------------------------- ### Get Maximum Connections Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/ServerCnxnHelper.html Gets the maximum number of connections allowed in ZooKeeper. This method is static and takes two ServerCnxnFactory objects as arguments. ```java public static int getMaxCnxns​(ServerCnxnFactory secureServerCnxnFactory, ServerCnxnFactory serverCnxnFactory) ``` -------------------------------- ### Get all DigestOpCode constants Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/PrepRequestProcessor.DigestOpCode.html Use the values() method to get an array of all enum constants in the order they are declared. This is useful for iterating through all possible operations. ```java public static PrepRequestProcessor.DigestOpCode[] values() ``` ```java for (PrepRequestProcessor.DigestOpCode c : PrepRequestProcessor.DigestOpCode.values()) System.out.println(c); ``` -------------------------------- ### MetricsProviderBootstrap startMetricsProvider(String, Properties) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Starts the metrics provider with the given name and properties. ```APIDOC ## startMetricsProvider(String name, Properties properties) ### Description Starts the metrics provider with the given name and properties. ### Method Static method ### Endpoint N/A (Java method) ### Parameters - **name** (String) - The name of the metrics provider. - **properties** (Properties) - The properties for the metrics provider. ### Request Example N/A ### Response N/A ``` -------------------------------- ### getStartTime Method Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/quorum/ServerBean.html Retrieves the start time of the ZooKeeper server. ```APIDOC ## getStartTime Method ### Description Retrieves the start time of the ZooKeeper server. ### Method `String getStartTime()` ### Returns the start time the server ``` -------------------------------- ### MetricsProviderBootstrap startMetricsProvider() Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/metrics/class-use/MetricsProviderLifeCycleException.html Static method to start a metrics provider by its class name, which may throw MetricsProviderLifeCycleException. ```APIDOC ## MetricsProviderBootstrap startMetricsProvider(String metricsProviderClassName, Properties configuration) ### Description Starts a metrics provider using the specified class name and configuration. ### Method static MetricsProvider ### Parameters - metricsProviderClassName (String) - The fully qualified class name of the metrics provider to start. - configuration (Properties) - The configuration properties for the metrics provider. ### Throws MetricsProviderLifeCycleException - If an error occurs during the startup of the metrics provider. ``` -------------------------------- ### setupRequestProcessors (ZooKeeperServer) Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/index-all.html Sets up the request processors for the ZooKeeper server. ```APIDOC ## setupRequestProcessors ### Description Sets up the request processors for the ZooKeeper server. ### Method Instance method ### Class org.apache.zookeeper.server.ZooKeeperServer ``` -------------------------------- ### Example zoo.cfg with Oracle Path Source: https://zookeeper.apache.org/doc/current/zookeeperOracleQuorums.html A complete zoo.cfg example demonstrating the correct way to specify the oraclePath along with other static ZooKeeper parameters for a two-instance ensemble. ```properties dataDir=/data dataLogDir=/datalog tickTime=2000 initLimit=5 syncLimit=2 autopurge.snapRetainCount=3 autopurge.purgeInterval=0 maxClientCnxns=60 standaloneEnabled=true admin.enableServer=true oraclePath=/chassis/mastership server.1=0.0.0.0:2888:3888;2181 server.2=hw1:2888:3888;2181 ``` -------------------------------- ### ZKClientConfig Constructors Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/client/ZKClientConfig.html Provides details on how to instantiate ZKClientConfig, including deprecated methods and the recommended constructor. ```APIDOC ## ZKClientConfig Constructors ### `ZKClientConfig()` Default constructor for ZKClientConfig. ### `ZKClientConfig(File configFile)` **Deprecated.** Use `ZKClientConfig(Path configPath)` instead. Throws: `QuorumPeerConfig.ConfigException` ### `ZKClientConfig(String configPath)` **Deprecated.** Use `ZKClientConfig(Path configPath)` instead. Throws: `QuorumPeerConfig.ConfigException` ### `ZKClientConfig(Path configPath)` Constructor that takes a Path object for the configuration file. Throws: `ConfigException` ``` -------------------------------- ### Log ZooKeeper Server Start and Stop Events Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/audit/ZKAuditProvider.html Adds an audit log entry for the successful start of the ZooKeeper server and registers a log for server stop events. ```java public static void addZKStartStopAuditLog() ``` -------------------------------- ### zkSnapShotToolkit.sh Help Source: https://zookeeper.apache.org/doc/current/zookeeperTools.html Running `zkSnapShotToolkit.sh` without arguments displays its usage instructions, indicating options for dumping node data or JSON output. ```bash # help ./zkSnapShotToolkit.sh /usr/bin/java USAGE: SnapshotFormatter [-d|-json] snapshot_file -d dump the data for each znode -json dump znode info in json format ``` -------------------------------- ### Run ZooKeeper GET Command Source: https://zookeeper.apache.org/doc/current/apidocs/zookeeper-server/org/apache/zookeeper/server/admin/Commands.html Executes a registered command using a GET request. This method is suitable for commands that do not require a request body and primarily use parameters. ```java public static CommandResponse runGetCommand(String cmdName, ZooKeeperServer zkServer, Map kwargs, String authInfo, javax.servlet.http.HttpServletRequest request) ```