Class Commands
java.lang.Object
org.apache.zookeeper.server.admin.Commands
Class containing static methods for registering and running Commands, as well
as default Command definitions.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Reset all connection statistics.static class
Server configuration parameters.static class
Information on client connections to server.static class
Digest histories for every specific number of txns.static class
Information on ZK datadir and snapdir size in bytesstatic class
Information on session expirations and ephemerals.static class
All defined environment variables.static class
The current trace mask.static class
static class
Is this server in read-only mode.static class
Command returns information of the last snapshot that zookeeper server has finished saving to disk.static class
Returns the leader status of this instance and the leader host string.static class
Some useful info for monitoring.static class
Reset all observer connection statistics.static class
Restore from snapshot on the current server.static class
No-op command, check if the server is runningstatic class
Sets the trace mask.static class
Take a snapshot of current server and stream out the data.static class
Server information.static class
Same as SrvrCommand but has extra "connections" entry.static class
Resets server statistics.static class
Information on observer connections to server.static class
All defined system properties.static class
Returns the current ensemble configuration information.static class
Watch information aggregated by session.static class
Watch information aggregated by path.static class
Summarized watch information.static class
Returns the current phase of Zab protocol that peer is running. -
Method Summary
Modifier and TypeMethodDescriptionstatic Command
getCommand
(String cmdName) Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.Returns the primary names of all registered commands.static void
registerCommand
(Command command) Registers the given command.static CommandResponse
runGetCommand
(String cmdName, ZooKeeperServer zkServer, Map<String, String> kwargs, String authInfo, javax.servlet.http.HttpServletRequest request) Run the registered command with name cmdName.static CommandResponse
runPostCommand
(String cmdName, ZooKeeperServer zkServer, InputStream inputStream, String authInfo, javax.servlet.http.HttpServletRequest request) Run the registered command with name cmdName.
-
Method Details
-
registerCommand
Registers the given command. Registered commands can be run by passing any of their names to runCommand. -
runGetCommand
public static CommandResponse runGetCommand(String cmdName, ZooKeeperServer zkServer, Map<String, String> kwargs, String authInfo, javax.servlet.http.HttpServletRequest request) Run the registered command with name cmdName. Commands should not produce any exceptions; any (anticipated) errors should be reported in the "error" entry of the returned map. Likewise, if no command with the given name is registered, this will be noted in the "error" entry.- Parameters:
cmdName
-zkServer
-kwargs
- String-valued keyword arguments to the command from HTTP GET request (may be null if command requires no additional arguments)authInfo
- auth info for auth check (null if command requires no auth check)request
- HTTP request- Returns:
- Map representing response to command containing at minimum: - "command" key containing the command's primary name - "error" key containing a String error message or null if no error
-
runPostCommand
public static CommandResponse runPostCommand(String cmdName, ZooKeeperServer zkServer, InputStream inputStream, String authInfo, javax.servlet.http.HttpServletRequest request) Run the registered command with name cmdName. Commands should not produce any exceptions; any (anticipated) errors should be reported in the "error" entry of the returned map. Likewise, if no command with the given name is registered, this will be noted in the "error" entry.- Parameters:
cmdName
-zkServer
-inputStream
- InputStream from HTTP POST request- Returns:
- Map representing response to command containing at minimum: - "command" key containing the command's primary name - "error" key containing a String error message or null if no error
-
getPrimaryNames
Returns the primary names of all registered commands. -
getCommand
Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.
-