Last active
May 7, 2023 15:45
-
-
Save dacr/41a1170ec482a021b30223ba7ecff889 to your computer and use it in GitHub Desktop.
Elasticsearch minimal startup for test, experiences, proof of concept purposes. / published by https://github.com/dacr/code-examples-manager #773b5f56-0d59-403e-b39b-1728f30a3371/18dbc6f28737592dd97139812ae08ca1d6a742ed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : Elasticsearch minimal startup for test, experiences, proof of concept purposes. | |
// keywords : scala, elasticsearch, cluster-runner | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : 773b5f56-0d59-403e-b39b-1728f30a3371 | |
// created-on : 2019-11-05T11:19:00Z | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc' | |
/* | |
Using [elasticsearch-cluster-runner](https://github.com/codelibs/elasticsearch-cluster-runner) | |
- Use Kibana-OSS edition if you need the kibana UI on top of this cluster | |
+ https://artifacts.elastic.co/downloads/kibana/kibana-oss-7.3.2-linux-x86_64.tar.gz | |
+ Kibana EE is not compatible with the embedded elasticsearch which is the OSS edition | |
+ Keep in sync Kibana-OSS and elasticsearch-cluster-runner releases | |
- This is a java dependency, so no prerequisites related to scala releases (or ammonite) | |
*/ | |
import $ivy.`org.codelibs:elasticsearch-cluster-runner:7.3.2.1` | |
//import $ivy.`org.codelibs:elasticsearch-cluster-runner:7.4.2.0` | |
import org.codelibs.elasticsearch.runner.ElasticsearchClusterRunner | |
import ElasticsearchClusterRunner.newConfigs | |
val runner = new ElasticsearchClusterRunner() | |
runner.build { | |
newConfigs | |
.numOfNode(1) | |
.basePath("elastic-data") | |
.clusterName("my-name") | |
} | |
runner.ensureYellow() | |
/* | |
Next lines are when you're in script mode | |
Not required in REPL mode | |
*/ | |
println("Ready, type <enter> to exit and stop nodes...") | |
scala.io.StdIn.readLine() | |
runner.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment