Class Commands
- java.lang.Object
-
- org.apache.zookeeper.server.admin.Commands
-
public class Commands extends Object
Class containing static methods for registering and running Commands, as well as default Command definitions.- See Also:
Command,JettyAdminServer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommands.CnxnStatResetCommandReset all connection statistics.static classCommands.ConfCommandServer configuration parameters.static classCommands.ConsCommandInformation on client connections to server.static classCommands.DigestCommandDigest histories for every specific number of txns.static classCommands.DirsCommandInformation on ZK datadir and snapdir size in bytesstatic classCommands.DumpCommandInformation on session expirations and ephemerals.static classCommands.EnvCommandAll defined environment variables.static classCommands.GetTraceMaskCommandThe current trace mask.static classCommands.InitialConfigurationCommandstatic classCommands.IsroCommandIs this server in read-only mode.static classCommands.LastSnapshotCommandCommand returns information of the last snapshot that zookeeper server has finished saving to disk.static classCommands.LeaderCommandReturns the leader status of this instance and the leader host string.static classCommands.MonitorCommandSome useful info for monitoring.static classCommands.ObserverCnxnStatResetCommandReset all observer connection statistics.static classCommands.RestoreCommandRestore from snapshot on the current server.static classCommands.RuokCommandNo-op command, check if the server is runningstatic classCommands.SetTraceMaskCommandSets the trace mask.static classCommands.SnapshotCommandTake a snapshot of current server and stream out the data.static classCommands.SrvrCommandServer information.static classCommands.StatCommandSame as SrvrCommand but has extra "connections" entry.static classCommands.StatResetCommandResets server statistics.static classCommands.SyncedObserverConsCommandInformation on observer connections to server.static classCommands.SystemPropertiesCommandAll defined system properties.static classCommands.VotingViewCommandReturns the current ensemble configuration information.static classCommands.WatchCommandWatch information aggregated by session.static classCommands.WatchesByPathCommandWatch information aggregated by path.static classCommands.WatchSummaryCommandSummarized watch information.static classCommands.ZabStateCommandReturns the current phase of Zab protocol that peer is running.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CommandgetCommand(String cmdName)Returns the commands registered under cmdName with registerCommand, or null if no command is registered with that name.static Set<String>getPrimaryNames()Returns the primary names of all registered commands.static voidregisterCommand(Command command)Registers the given command.static CommandResponserunGetCommand(String cmdName, ZooKeeperServer zkServer, Map<String,String> kwargs, String authInfo, javax.servlet.http.HttpServletRequest request)Run the registered command with name cmdName.static CommandResponserunPostCommand(String cmdName, ZooKeeperServer zkServer, InputStream inputStream, String authInfo, javax.servlet.http.HttpServletRequest request)Run the registered command with name cmdName.
-
-
-
Method Detail
-
registerCommand
public static void registerCommand(Command command)
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
public static Set<String> getPrimaryNames()
Returns the primary names of all registered commands.
-
-