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

public abstract class ElasticsearchNodeCommand extends EnvironmentAwareCommand
  • Field Details

  • Constructor Details

    • ElasticsearchNodeCommand

      public ElasticsearchNodeCommand(String description)
  • 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

      protected void confirm(org.elasticsearch.cli.Terminal terminal, String msg)
    • execute

      public final void execute(org.elasticsearch.cli.Terminal terminal, joptsimple.OptionSet options, Environment env) throws Exception
      Description copied from class: EnvironmentAwareCommand
      Execute the command with the initialized Environment.
      Specified by:
      execute in class EnvironmentAwareCommand
      Throws:
      Exception
    • validateBeforeLock

      protected boolean validateBeforeLock(org.elasticsearch.cli.Terminal terminal, Environment env)
      Validate that the command can run before taking any locks.
      Parameters:
      terminal - the terminal to print to
      env - 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.UserException
      Process the paths. Locks for the paths is held during this method invocation.
      Parameters:
      terminal - the terminal to use for messages
      dataPaths - the paths of the node to process
      options - the command line options
      env - the env of the node to process
      Throws:
      IOException
      org.elasticsearch.cli.UserException
    • toNodePaths

      protected NodeEnvironment.NodePath[] toNodePaths(Path[] dataPaths)