Class ElasticsearchNodeCommand
java.lang.Object
org.elasticsearch.cli.Command
org.elasticsearch.cli.EnvironmentAwareCommand
org.elasticsearch.cluster.coordination.ElasticsearchNodeCommand
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
DetachClusterCommand,NodeRepurposeCommand,OverrideNodeVersionCommand,RemoveCorruptedShardDataCommand,RemoveCustomsCommand,RemoveSettingsCommand,UnsafeBootstrapMasterCommand
public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringABORTED_BY_USER_MSGprotected static java.lang.StringCS_MISSING_MSGprotected static java.lang.StringDELIMITERprotected static java.lang.StringFAILED_TO_OBTAIN_NODE_LOCK_MSGprotected static NamedXContentRegistrynamedXContentRegistry -
Constructor Summary
Constructors Constructor Description ElasticsearchNodeCommand(java.lang.String description) -
Method Summary
Modifier and Type Method Description static ClusterStateclusterState(Environment environment, PersistedClusterStateService.OnDiskState onDiskState)protected voidconfirm(Terminal terminal, java.lang.String msg)static PersistedClusterStateServicecreatePersistedClusterStateService(Settings settings, java.nio.file.Path[] dataPaths)voidexecute(Terminal terminal, joptsimple.OptionSet options, Environment env)Execute the command with the initializedEnvironment.static Tuple<java.lang.Long,ClusterState>loadTermAndClusterState(PersistedClusterStateService psf, Environment env)protected abstract voidprocessNodePaths(Terminal terminal, java.nio.file.Path[] dataPaths, int nodeLockId, joptsimple.OptionSet options, Environment env)Process the paths.protected voidprocessNodePaths(Terminal terminal, joptsimple.OptionSet options, Environment env)protected NodeEnvironment.NodePath[]toNodePaths(java.nio.file.Path[] dataPaths)protected booleanvalidateBeforeLock(Terminal terminal, Environment env)Validate that the command can run before taking any locks.Methods inherited from class org.elasticsearch.cli.EnvironmentAwareCommand
createEnv, createEnv, executeMethods inherited from class org.elasticsearch.cli.Command
addShutdownHook, close, exit, main, printAdditionalHelp
-
Field Details
-
DELIMITER
protected static final java.lang.String DELIMITER- See Also:
- Constant Field Values
-
FAILED_TO_OBTAIN_NODE_LOCK_MSG
protected static final java.lang.String FAILED_TO_OBTAIN_NODE_LOCK_MSG- See Also:
- Constant Field Values
-
ABORTED_BY_USER_MSG
protected static final java.lang.String ABORTED_BY_USER_MSG- See Also:
- Constant Field Values
-
CS_MISSING_MSG
protected static final java.lang.String CS_MISSING_MSG- See Also:
- Constant Field Values
-
namedXContentRegistry
-
-
Constructor Details
-
ElasticsearchNodeCommand
public ElasticsearchNodeCommand(java.lang.String description)
-
-
Method Details
-
createPersistedClusterStateService
public static PersistedClusterStateService createPersistedClusterStateService(Settings settings, java.nio.file.Path[] dataPaths) throws java.io.IOException- Throws:
java.io.IOException
-
clusterState
public static ClusterState clusterState(Environment environment, PersistedClusterStateService.OnDiskState onDiskState) -
loadTermAndClusterState
public static Tuple<java.lang.Long,ClusterState> loadTermAndClusterState(PersistedClusterStateService psf, Environment env) throws java.io.IOException- Throws:
java.io.IOException
-
processNodePaths
protected void processNodePaths(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.io.IOException, UserException- Throws:
java.io.IOExceptionUserException
-
confirm
-
execute
public final void execute(Terminal terminal, joptsimple.OptionSet options, Environment env) throws java.lang.ExceptionDescription copied from class:EnvironmentAwareCommandExecute the command with the initializedEnvironment.- Specified by:
executein classEnvironmentAwareCommand- Throws:
java.lang.Exception
-
validateBeforeLock
Validate that the command can run before taking any locks.- Parameters:
terminal- the terminal to print toenv- the env to validate.- Returns:
- true to continue, false to stop (must print message in validate).
-
processNodePaths
protected abstract void processNodePaths(Terminal terminal, java.nio.file.Path[] dataPaths, int nodeLockId, joptsimple.OptionSet options, Environment env) throws java.io.IOException, UserExceptionProcess the paths. Locks for the paths is held during this method invocation.- Parameters:
terminal- the terminal to use for messagesdataPaths- the paths of the node to processoptions- the command line optionsenv- the env of the node to process- Throws:
java.io.IOExceptionUserException
-
toNodePaths
-