Elasticsearch Cluster Launcher on One JVM Instance
Java
Switch branches/tags
elasticsearch-cluster-runner-6.3.2.0 elasticsearch-cluster-runner-6.3.1.0 elasticsearch-cluster-runner-6.3.0.0 elasticsearch-cluster-runner-6.2.4.0 elasticsearch-cluster-runner-6.2.3.0 elasticsearch-cluster-runner-6.2.2.0 elasticsearch-cluster-runner-6.2.1.0 elasticsearch-cluster-runner-6.2.0.1 elasticsearch-cluster-runner-6.2.0.0 elasticsearch-cluster-runner-6.1.4.0 elasticsearch-cluster-runner-6.1.3.0 elasticsearch-cluster-runner-6.1.2.0 elasticsearch-cluster-runner-6.1.1.0 elasticsearch-cluster-runner-6.0.1.0 elasticsearch-cluster-runner-6.0.0.0 elasticsearch-cluster-runner-6.0.0.0-rc2 elasticsearch-cluster-runner-6.0.0.0-rc1 elasticsearch-cluster-runner-5.6.10.0 elasticsearch-cluster-runner-5.6.9.0 elasticsearch-cluster-runner-5.6.8.0 elasticsearch-cluster-runner-5.6.7.0 elasticsearch-cluster-runner-5.6.6.0 elasticsearch-cluster-runner-5.6.5.0 elasticsearch-cluster-runner-5.6.4.0 elasticsearch-cluster-runner-5.6.3.0 elasticsearch-cluster-runner-5.6.2.0 elasticsearch-cluster-runner-5.6.1.0 elasticsearch-cluster-runner-5.6.0.0 elasticsearch-cluster-runner-5.5.3.0 elasticsearch-cluster-runner-5.5.2.0 elasticsearch-cluster-runner-5.5.1.0 elasticsearch-cluster-runner-5.5.0.0 elasticsearch-cluster-runner-5.4.2.0 elasticsearch-cluster-runner-5.4.1.0 elasticsearch-cluster-runner-5.4.0.1 elasticsearch-cluster-runner-5.4.0.0 elasticsearch-cluster-runner-5.3.3.0 elasticsearch-cluster-runner-5.3.2.0 elasticsearch-cluster-runner-5.3.1.0 elasticsearch-cluster-runner-5.3.0.0 elasticsearch-cluster-runner-5.2.2.0 elasticsearch-cluster-runner-5.2.1.0 elasticsearch-cluster-runner-5.2.0.1 elasticsearch-cluster-runner-5.2.0.0 elasticsearch-cluster-runner-5.1.2.0 elasticsearch-cluster-runner-5.1.1.0 elasticsearch-cluster-runner-5.0.2.1 elasticsearch-cluster-runner-5.0.2.0 elasticsearch-cluster-runner-2.4.0.0 elasticsearch-cluster-runner-2.3.5.0 elasticsearch-cluster-runner-2.3.4.0 elasticsearch-cluster-runner-2.3.0.0 elasticsearch-cluster-runner-2.2.0.0 elasticsearch-cluster-runner-2.1.2.0 elasticsearch-cluster-runner-2.1.1.0 elasticsearch-cluster-runner-2.1.0.0 elasticsearch-cluster-runner-2.0.0.0 elasticsearch-cluster-runner-1.7.0.0 elasticsearch-cluster-runner-1.6.0.0 elasticsearch-cluster-runner-1.5.0.1 elasticsearch-cluster-runner-1.5.0.0 elasticsearch-cluster-runner-1.4.2.0 elasticsearch-cluster-runner-1.4.1.0 elasticsearch-cluster-runner-1.4.0.2 elasticsearch-cluster-runner-1.4.0.1 elasticsearch-cluster-runner-1.4.0.0 elasticsearch-cluster-runner-1.3.2.3 elasticsearch-cluster-runner-1.3.2.2 elasticsearch-cluster-runner-1.3.2.1 elasticsearch-cluster-runner-1.3.2.0 elasticsearch-cluster-runner-1.3.1.0 elasticsearch-cluster-runner-1.2.1.0
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src remove http.enabled Aug 9, 2018
.gitignore update gitignore Nov 1, 2015
.travis.yml add travis Sep 14, 2017
LICENSE Initial commit Jun 8, 2014
README.md Update README.md Sep 30, 2017
pom.xml [maven-release-plugin] prepare for next development iteration Jul 26, 2018

README.md

Elasticsearch Cluster Runner

This project runs Elasticsearch cluster on one JVM instance for your development/testing easily. You can use Elasticsearch Cluster Runner as Embedded Elasticsearch in your application.

Version

Versions in Maven Repository

Run on Your Application

Put elasticsearch-cluster-runner if using Maven:

<dependency>
    <groupId>org.codelibs</groupId>
    <artifactId>elasticsearch-cluster-runner</artifactId>
    <version>5.5.2.0</version>
</dependency>

Start Cluster Runner

import static org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner.newConfigs;
...
// create runner instance
ElasticsearchClusterRunner runner = new ElasticsearchClusterRunner();
// create ES nodes
runner.onBuild(new ElasticsearchClusterRunner.Builder() {
    @Override
    public void build(final int number, final Builder settingsBuilder) {
        // put elasticsearch settings
        // settingsBuilder.put("index.number_of_replicas", 0);
    }
}).build(newConfigs());

build(Configs) method configures/starts Clsuter Runner.

Stop Cluster Runner

// close runner
runner.close();

Clean up

// delete all files(config and index)
runner.clean();

Run on JUnit

Put elasticsearch-cluster-runner as test scope:

<dependency>
    <groupId>org.codelibs</groupId>
    <artifactId>elasticsearch-cluster-runner</artifactId>
    <version>5.5.2.0</version>
    <scope>test</scope>
</dependency>

and see ElasticsearchClusterRunnerTest.

Run as Standalone

Install Maven

Download and install Maven 3 from http://maven.apache.org/.

Clone This Project

git clone https://github.com/codelibs/elasticsearch-cluster-runner.git

Build This Project

mvn compile

Run/Stop Elasticsearch Cluster

Run Cluster

Run:

mvn exec:java 

The default cluster has 3 nodes and the root directory for Elasticsearch is es_home. Nodes use 9201-9203 port for HTTP and 9301-9303 port for Transport. If you want to change the number of node, Run:

mvn exec:java -Dexec.args="-basePath es_home -numOfNode 4"

Stop Cluster

Type Ctrl-c or kill the process.

Others

Install Plugins

This project does not have plugin command to install plugins. Therefore, you need to put plugins manually. For example, installing solr-api plugin:

$ mkdir -p es_home/plugins/solr-api
$ wget http://repo1.maven.org/maven2/org/codelibs/elasticsearch-solr-api/1.4.0/elasticsearch-solr-api-1.4.0.zip
$ unzip elasticsearch-solr-api-1.4.0.zip 
$ rm elasticsearch-solr-api-1.4.0.zip 

Issues/Questions

Please file an issue. (Japanese forum is here.)