Class ElasticsearchNodeCommand
java.lang.Object
org.elasticsearch.cli.Command
org.elasticsearch.cli.EnvironmentAwareCommand
org.elasticsearch.cluster.coordination.ElasticsearchNodeCommand
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
DetachClusterCommand
,NodeRepurposeCommand
,OverrideNodeVersionCommand
,RemoveCorruptedShardDataCommand
,RemoveCustomsCommand
,RemoveSettingsCommand
,UnsafeBootstrapMasterCommand
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected static String
protected static String
protected static String
protected static String
static org.elasticsearch.common.xcontent.NamedXContentRegistry
Fields inherited from class org.elasticsearch.cli.Command
description, parser
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClusterState
clusterState(Environment environment, PersistedClusterStateService.OnDiskState onDiskState)
protected void
static PersistedClusterStateService
createPersistedClusterStateService(Settings settings, Path[] dataPaths)
void
execute(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, Environment env)
Execute the command with the initializedEnvironment
.static org.elasticsearch.core.Tuple<Long,ClusterState>
protected abstract void
processNodePaths(org.elasticsearch.cli.Terminal terminal, Path[] dataPaths, int nodeLockId, joptsimple.OptionSet options, Environment env)
Process the paths.protected void
processNodePaths(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, Environment env)
protected NodeEnvironment.NodePath[]
toNodePaths(Path[] dataPaths)
protected boolean
validateBeforeLock(org.elasticsearch.cli.Terminal terminal, Environment env)
Validate that the command can run before taking any locks.Methods inherited from class org.elasticsearch.cli.EnvironmentAwareCommand
createEnv, createEnv, execute
Methods inherited from class org.elasticsearch.cli.Command
addShutdownHook, close, exit, main, printAdditionalHelp
-
Field Details
-
DELIMITER
- See Also:
- Constant Field Values
-
FAILED_TO_OBTAIN_NODE_LOCK_MSG
- See Also:
- Constant Field Values
-
ABORTED_BY_USER_MSG
- See Also:
- Constant Field Values
-
CS_MISSING_MSG
- See Also:
- Constant Field Values
-
namedXContentRegistry
public static final org.elasticsearch.common.xcontent.NamedXContentRegistry namedXContentRegistry
-
-
Constructor Details
-
ElasticsearchNodeCommand
-
-
Method Details
-
createPersistedClusterStateService
public static PersistedClusterStateService createPersistedClusterStateService(Settings settings, Path[] dataPaths) throws IOException- Throws:
IOException
-
clusterState
public static ClusterState clusterState(Environment environment, PersistedClusterStateService.OnDiskState onDiskState) -
loadTermAndClusterState
public static org.elasticsearch.core.Tuple<Long,ClusterState> loadTermAndClusterState(PersistedClusterStateService psf, Environment env) throws IOException- Throws:
IOException
-
processNodePaths
protected void processNodePaths(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, Environment env) throws IOException, org.elasticsearch.cli.UserException- Throws:
IOException
org.elasticsearch.cli.UserException
-
confirm
-
execute
public final void execute(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, Environment env) throws ExceptionDescription copied from class:EnvironmentAwareCommand
Execute the command with the initializedEnvironment
.- Specified by:
execute
in classEnvironmentAwareCommand
- Throws:
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(org.elasticsearch.cli.Terminal terminal, Path[] dataPaths, int nodeLockId, joptsimple.OptionSet options, Environment env) throws IOException, org.elasticsearch.cli.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:
IOException
org.elasticsearch.cli.UserException
-
toNodePaths
-