クラス ElasticsearchClusterRunner

java.lang.Object
org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner
すべての実装されたインタフェース:
Closeable, AutoCloseable

public class ElasticsearchClusterRunner
extends Object
implements Closeable
ElasticsearchClusterRunner manages multiple Elasticsearch instances.
作成者:
shinsuke
  • フィールド詳細

    • LOG4J2_PROPERTIES

      protected static final String LOG4J2_PROPERTIES
      関連項目:
      定数フィールド値
    • ELASTICSEARCH_YAML

      protected static final String ELASTICSEARCH_YAML
      関連項目:
      定数フィールド値
    • MODULE_TYPES

      protected static final String[] MODULE_TYPES
    • DATA_DIR

      protected static final String DATA_DIR
      関連項目:
      定数フィールド値
    • LOGS_DIR

      protected static final String LOGS_DIR
      関連項目:
      定数フィールド値
    • CONFIG_DIR

      protected static final String CONFIG_DIR
      関連項目:
      定数フィールド値
    • nodeList

      protected List<org.elasticsearch.node.Node> nodeList
    • envList

      protected List<org.elasticsearch.env.Environment> envList
    • pluginList

      protected Collection<Class<? extends org.elasticsearch.plugins.Plugin>> pluginList
    • maxHttpPort

      protected int maxHttpPort
    • basePath

      protected String basePath
    • confPath

      protected String confPath
    • dataPath

      protected String dataPath
    • logsPath

      protected String logsPath
    • numOfNode

      protected int numOfNode
    • baseHttpPort

      protected int baseHttpPort
    • clusterName

      protected String clusterName
    • indexStoreType

      protected String indexStoreType
    • useLogger

      protected boolean useLogger
    • disableESLogger

      protected boolean disableESLogger
    • printOnFailure

      protected boolean printOnFailure
    • moduleTypes

      protected String moduleTypes
    • pluginTypes

      protected String pluginTypes
    • settingsBuilder

      protected ElasticsearchClusterRunner.Builder settingsBuilder
  • コンストラクタの詳細

    • ElasticsearchClusterRunner

      public ElasticsearchClusterRunner()
  • メソッドの詳細

    • main

      public static void main​(String[] args)
    • isClosed

      public boolean isClosed()
      Check if a cluster runner is closed.
      戻り値:
      true if a runner is closed.
    • close

      public void close() throws IOException
      Close a cluster runner.
      定義:
      close インタフェース内 AutoCloseable
      定義:
      close インタフェース内 Closeable
      例外:
      IOException - i/o exception
    • clean

      public void clean()
      Delete all configuration files and directories.
    • onBuild

      Configure each Elasticsearch instance by builder.
      パラメータ:
      builder - builder to create a cluster
      戻り値:
      this instance
    • build

      public void build​(ElasticsearchClusterRunner.Configs configs)
      Create and start Elasticsearch cluster with Configs instance.
      パラメータ:
      configs - configuration
    • build

      public void build​(String... args)
      Create and start Elasticsearch cluster with arguments.
      パラメータ:
      args - artuments for starting a cluster
    • execute

      protected void execute​(int id)
    • getAvailableHttpPort

      protected int getAvailableHttpPort​(int number)
    • putIfAbsent

      protected void putIfAbsent​(org.elasticsearch.common.settings.Settings.Builder builder, String key, String value)
    • setMaxHttpPort

      public void setMaxHttpPort​(int maxHttpPort)
    • getNode

      public org.elasticsearch.node.Node getNode​(int i)
      Return a node by the node index.
      パラメータ:
      i - A node index
      戻り値:
      null if the node is not found
    • startNode

      public boolean startNode​(int i)
      Start a closed node.
      パラメータ:
      i - the number of nodes
      戻り値:
      true if the node is started.
    • getNode

      public org.elasticsearch.node.Node getNode​(String name)
      Return a node by the name.
      パラメータ:
      name - A node name
      戻り値:
      null if the node is not found by the name
    • getNodeIndex

      public int getNodeIndex​(org.elasticsearch.node.Node node)
      Return a node index.
      パラメータ:
      node - node to check an index
      戻り値:
      -1 if the node does not exist.
    • getNodeSize

      public int getNodeSize()
      Return the number of nodes.
      戻り値:
      the number of nodes
    • print

      public void print​(String line)
    • createDir

      protected void createDir​(Path path)
    • node

      public org.elasticsearch.node.Node node()
      Return an available node.
      戻り値:
      node
    • masterNode

      public org.elasticsearch.node.Node masterNode()
      Return a master node.
      戻り値:
      master node
    • nonMasterNode

      public org.elasticsearch.node.Node nonMasterNode()
      Return a non-master node.
      戻り値:
      non-master node
    • client

      public org.elasticsearch.client.Client client()
      Return an elasticsearch client.
      戻り値:
      client
    • admin

      public org.elasticsearch.client.AdminClient admin()
      Return an elasticsearch admin client.
      戻り値:
      admin client
    • ensureGreen

      public org.elasticsearch.cluster.health.ClusterHealthStatus ensureGreen​(String... indices)
      Wait for green state of a cluster.
      パラメータ:
      indices - indices to check status
      戻り値:
      cluster health status
    • ensureYellow

      public org.elasticsearch.cluster.health.ClusterHealthStatus ensureYellow​(String... indices)
      Wait for yellow state of a cluster.
      パラメータ:
      indices - indices to check status
      戻り値:
      cluster health status
    • waitForRelocation

      public org.elasticsearch.cluster.health.ClusterHealthStatus waitForRelocation()
    • flush

      public org.elasticsearch.action.admin.indices.flush.FlushResponse flush()
    • flush

      public org.elasticsearch.action.admin.indices.flush.FlushResponse flush​(boolean force)
    • flush

      public org.elasticsearch.action.admin.indices.flush.FlushResponse flush​(ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.flush.FlushRequestBuilder> builder)
    • refresh

      public org.elasticsearch.action.admin.indices.refresh.RefreshResponse refresh()
    • refresh

      public org.elasticsearch.action.admin.indices.refresh.RefreshResponse refresh​(ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder> builder)
    • upgrade

      public org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse upgrade()
    • upgrade

      public org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse upgrade​(boolean upgradeOnlyAncientSegments)
    • upgrade

      public org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse upgrade​(ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequestBuilder> builder)
    • forceMerge

      public org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse forceMerge()
    • forceMerge

      public org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse forceMerge​(int maxNumSegments, boolean onlyExpungeDeletes, boolean flush)
    • forceMerge

      public org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse forceMerge​(ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequestBuilder> builder)
    • openIndex

      public org.elasticsearch.action.admin.indices.open.OpenIndexResponse openIndex​(String index)
    • openIndex

      public org.elasticsearch.action.admin.indices.open.OpenIndexResponse openIndex​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.open.OpenIndexRequestBuilder> builder)
    • closeIndex

      public org.elasticsearch.action.support.master.AcknowledgedResponse closeIndex​(String index)
    • closeIndex

      public org.elasticsearch.action.support.master.AcknowledgedResponse closeIndex​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.close.CloseIndexRequestBuilder> builder)
    • createIndex

      public org.elasticsearch.action.admin.indices.create.CreateIndexResponse createIndex​(String index, org.elasticsearch.common.settings.Settings settings)
    • createIndex

      public org.elasticsearch.action.admin.indices.create.CreateIndexResponse createIndex​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder> builder)
    • indexExists

      public boolean indexExists​(String index)
    • indexExists

      public boolean indexExists​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequestBuilder> builder)
    • deleteIndex

      public org.elasticsearch.action.support.master.AcknowledgedResponse deleteIndex​(String index)
    • deleteIndex

      public org.elasticsearch.action.support.master.AcknowledgedResponse deleteIndex​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.delete.DeleteIndexRequestBuilder> builder)
    • createMapping

      @Deprecated public org.elasticsearch.action.support.master.AcknowledgedResponse createMapping​(String index, String type, String mappingSource)
      推奨されていません。
    • createMapping

      @Deprecated public org.elasticsearch.action.support.master.AcknowledgedResponse createMapping​(String index, String type, org.elasticsearch.common.xcontent.XContentBuilder source)
      推奨されていません。
    • createMapping

      public org.elasticsearch.action.support.master.AcknowledgedResponse createMapping​(String index, String mappingSource)
    • createMapping

      public org.elasticsearch.action.support.master.AcknowledgedResponse createMapping​(String index, org.elasticsearch.common.xcontent.XContentBuilder source)
    • createMapping

      public org.elasticsearch.action.support.master.AcknowledgedResponse createMapping​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequestBuilder> builder)
    • insert

      @Deprecated public org.elasticsearch.action.index.IndexResponse insert​(String index, String type, String id, String source)
      推奨されていません。
    • insert

      @Deprecated public org.elasticsearch.action.index.IndexResponse insert​(String index, String type, String id, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.index.IndexRequestBuilder> builder)
      推奨されていません。
    • insert

      public org.elasticsearch.action.index.IndexResponse insert​(String index, String id, String source)
    • insert

      public org.elasticsearch.action.index.IndexResponse insert​(String index, String id, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.index.IndexRequestBuilder> builder)
    • delete

      @Deprecated public org.elasticsearch.action.delete.DeleteResponse delete​(String index, String type, String id)
      推奨されていません。
    • delete

      @Deprecated public org.elasticsearch.action.delete.DeleteResponse delete​(String index, String type, String id, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.delete.DeleteRequestBuilder> builder)
      推奨されていません。
    • delete

      public org.elasticsearch.action.delete.DeleteResponse delete​(String index, String id)
    • delete

      public org.elasticsearch.action.delete.DeleteResponse delete​(String index, String id, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.delete.DeleteRequestBuilder> builder)
    • count

      @Deprecated public org.elasticsearch.action.search.SearchResponse count​(String index, String type)
      推奨されていません。
    • count

      public org.elasticsearch.action.search.SearchResponse count​(String index)
    • count

      public org.elasticsearch.action.search.SearchResponse count​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.search.SearchRequestBuilder> builder)
    • search

      @Deprecated public org.elasticsearch.action.search.SearchResponse search​(String index, String type, org.elasticsearch.index.query.QueryBuilder queryBuilder, org.elasticsearch.search.sort.SortBuilder<?> sort, int from, int size)
      推奨されていません。
    • search

      public org.elasticsearch.action.search.SearchResponse search​(String index, org.elasticsearch.index.query.QueryBuilder queryBuilder, org.elasticsearch.search.sort.SortBuilder<?> sort, int from, int size)
    • search

      public org.elasticsearch.action.search.SearchResponse search​(String index, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.search.SearchRequestBuilder> builder)
    • getAlias

      public org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse getAlias​(String alias)
    • getAlias

      public org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse getAlias​(String alias, ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequestBuilder> builder)
    • updateAlias

      public org.elasticsearch.action.support.master.AcknowledgedResponse updateAlias​(String alias, String[] addedIndices, String[] deletedIndices)
    • updateAlias

      public org.elasticsearch.action.support.master.AcknowledgedResponse updateAlias​(ElasticsearchClusterRunner.BuilderCallback<org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder> builder)
    • clusterService

      public org.elasticsearch.cluster.service.ClusterService clusterService()
    • getInstance

      public <T> T getInstance​(Class<T> clazz)
    • getClusterName

      public String getClusterName()
    • newConfigs

      public static ElasticsearchClusterRunner.Configs newConfigs()