Module org.elasticsearch.server
Class ElasticsearchNodeCommand
java.lang.Object
org.elasticsearch.cli.Command
org.elasticsearch.common.cli.EnvironmentAwareCommand
org.elasticsearch.cluster.coordination.ElasticsearchNodeCommand
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
DetachClusterCommand,NodeRepurposeCommand,OverrideNodeVersionCommand,RemoveCorruptedShardDataCommand,RemoveCustomsCommand,RemoveIndexSettingsCommand,RemoveSettingsCommand,UnsafeBootstrapMasterCommand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringstatic final NamedXContentRegistryFields inherited from class org.elasticsearch.cli.Command
description, parser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ClusterStateclusterState(Environment environment, PersistedClusterStateService.OnDiskState onDiskState) protected static voidstatic PersistedClusterStateServicecreatePersistedClusterStateService(Settings settings, Path[] dataPaths) final voidexecute(Terminal terminal, joptsimple.OptionSet options, Environment env, ProcessInfo processInfo) Execute the command with the initializedEnvironment.static Tuple<Long, ClusterState> protected abstract voidprocessDataPaths(Terminal terminal, Path[] dataPaths, joptsimple.OptionSet options, Environment env) Process the paths.protected voidprocessDataPaths(Terminal terminal, joptsimple.OptionSet options, Environment env) protected static NodeEnvironment.DataPath[]toDataPaths(Path[] paths) protected booleanvalidateBeforeLock(Terminal terminal, Environment env) Validate that the command can run before taking any locks.Methods inherited from class org.elasticsearch.common.cli.EnvironmentAwareCommand
createEnv, execute, getBuildTypeMethods inherited from class org.elasticsearch.cli.Command
close, exit, main, mainWithoutErrorHandling, parseOptions, printAdditionalHelp, printUserException
-
Field Details
-
DELIMITER
- See Also:
-
FAILED_TO_OBTAIN_NODE_LOCK_MSG
- See Also:
-
ABORTED_BY_USER_MSG
- See Also:
-
CS_MISSING_MSG
- See Also:
-
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 Tuple<Long,ClusterState> loadTermAndClusterState(PersistedClusterStateService psf, Environment env) throws IOException - Throws:
IOException
-
processDataPaths
protected void processDataPaths(Terminal terminal, joptsimple.OptionSet options, Environment env) throws IOException, UserException - Throws:
IOExceptionUserException
-
confirm
-
execute
public final void execute(Terminal terminal, joptsimple.OptionSet options, Environment env, ProcessInfo processInfo) throws Exception Description copied from class:EnvironmentAwareCommandExecute the command with the initializedEnvironment.- Specified by:
executein 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).
-
processDataPaths
protected abstract void processDataPaths(Terminal terminal, Path[] dataPaths, joptsimple.OptionSet options, Environment env) throws IOException, UserException Process 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:
IOExceptionUserException
-
toDataPaths
-