One-click to build production level Elasticsearch.
require
- Go 1.8.x
- Ansible 2.x
-
Install ansible
-
Clone ansible-elasticsearch and make
elasticsearch
role availiable in ansible globlly.git clone https://github.com/elastic/ansible-elasticsearch
sudo mkdir -p /etc/ansible/roles/ && mv ansible-elasticsearch /etc/ansible/roles
-
git clone https://github.com/visaxin/ansible-go-elastic.git && cd ansible-go-elastic && go build
-
start
go-ansible-elastic-cluster
default listen on8080
Config a cluster:
Request:
curl -XPOST localhost:8080/api/v1/cluster --data '
{
"hosts": [
{
"instances": [
{},
{},
{}
],
"host_name": "host19"
},
{
"instances": [
{},
{},
{}
],
"host_name": "host20"
},
{
"instances": [
{},
{},
{}
],
"host_name": "host21"
}
],
"cluster_name": "test",
"data_path_dir": [
"/path1",
"/path2",
"/path3",
"/path4",
"/path5"
],
"log_path_dir": "/path/to/log"
}
'
Response:
{
"name": "cluster-xxxx"
}
-
{} represents an Instance. You can provide a new config for one instance:
{ "log_path_dir": "/var/log/", "data_path_dir": "/var/data/", "config":{ "bootstrap.mlockall": false } }
deploy a cluster
Request:
curl -XPOST 'localhost:8080/api/v1/deploy?name="cluster-xxxx"'
Response:
{"msg":""}