Better support for clustering
diff --git a/README.rst b/README.rst
index 90df9be..0c7021f 100644
--- a/README.rst
+++ b/README.rst
@@ -8,15 +8,44 @@
Sample pillars
==============
+Single-node elasticsearch with clustering disabled:
+
.. code-block:: yaml
elasticsearch:
server:
enabled: true
- version: 1.0.1
bind:
address: 0.0.0.0
port: 9200
+ cluster:
+ multicast: false
+ index:
+ shards: 1
+ replicas: 0
+
+Cluster with manually defined members:
+
+.. code-block:: yaml
+
+ elasticsearch:
+ server:
+ enabled: true
+ bind:
+ address: 0.0.0.0
+ port: 9200
+ cluster:
+ multicast: false
+ members:
+ - host: elastic01
+ port: 9300
+ - host: elastic02
+ port: 9300
+ - host: elastic03
+ port: 9300
+ index:
+ shards: 5
+ replicas: 1
Read more
=========
diff --git a/elasticsearch/files/elasticsearch.yml b/elasticsearch/files/elasticsearch.yml
index 89a1c5c..fcea2a9 100644
--- a/elasticsearch/files/elasticsearch.yml
+++ b/elasticsearch/files/elasticsearch.yml
@@ -32,10 +32,8 @@
# multiple clusters on the same network, make sure you're using unique names.
#
# cluster.name: elasticsearch
-{%- if server.clustername is defined %}
-
-cluster.name: {{ server.clustername }}
-
+{%- if server.get('cluster', {}).name is defined %}
+cluster.name: {{ server.cluster.name }}
{% endif %}
#################################### Node #####################################
@@ -50,11 +48,11 @@
#
# Allow this node to be eligible as a master node (enabled by default):
#
-# node.master: true
+node.master: {{ server.get('master', True)|lower }}
#
# Allow this node to store data (enabled by default):
#
-# node.data: true
+node.data: {{ server.get('data', True)|lower }}
# You can exploit these settings to design advanced cluster topologies.
#
@@ -89,6 +87,9 @@
# is a simple key value pair, similar to node.key: value, here is an example:
#
# node.rack: rack314
+{%- if server.rack is defined %}
+node.rack: {{ server.rack }}
+{%- endif %}
# By default, multiple nodes are allowed to start from the same installation location
# to disable it, set the following:
@@ -110,11 +111,11 @@
# Set the number of shards (splits) of an index (5 by default):
#
-# index.number_of_shards: 5
+index.number_of_shards: {{ server.get('index', {}).get('shards', 5) }}
# Set the number of replicas (additional copies) of an index (1 by default):
#
-# index.number_of_replicas: 1
+index.number_of_replicas: {{ server.get('index', {}).get('replicas', 1) }}
# Note, that for development on a local machine, with small indices, it usually
# makes sense to "disable" the distributed features:
@@ -213,7 +214,9 @@
# Set the address other nodes will use to communicate with this node. If not
# set, it is automatically derived. It must point to an actual IP address.
#
-# network.publish_host: 192.168.0.1
+{%- if server.publish_host is defined %}
+network.publish_host: {{ server.publish_host }}
+{%- endif %}
# Set both 'bind_host' and 'publish_host':
#
@@ -326,12 +329,14 @@
#
# 1. Disable multicast discovery (enabled by default):
#
-# discovery.zen.ping.multicast.enabled: false
+discovery.zen.ping.multicast.enabled: {{ server.get('cluster', {}).get('multicast', True)|lower }}
#
# 2. Configure an initial list of master nodes in the cluster
# to perform discovery when new nodes (master or data) are started:
#
-# discovery.zen.ping.unicast.hosts: ["host1", "host2:port"]
+{%- if server.get('cluster', {}).members is defined %}
+discovery.zen.ping.unicast.hosts: [{% for member in server.cluster.members %}"{{ member.host }}:{{ member.get('port', 9300) }}"{% if not loop.last %}, {% endif %}{% endfor %}]
+{%- endif %}
# EC2 discovery allows to use AWS EC2 API in order to perform discovery.
#
diff --git a/metadata/service/server/cluster.yml b/metadata/service/server/cluster.yml
new file mode 100644
index 0000000..e432f74
--- /dev/null
+++ b/metadata/service/server/cluster.yml
@@ -0,0 +1,14 @@
+applications:
+- elasticsearch
+classes:
+- service.elasticsearch.support
+parameters:
+ elasticsearch:
+ server:
+ enabled: true
+ bind:
+ address: 0.0.0.0
+ port: 9200
+ cluster:
+ name: elasticsearch
+ multicast: true
diff --git a/metadata/service/server/local.yml b/metadata/service/server/local.yml
index bb0e319..e3572ea 100644
--- a/metadata/service/server/local.yml
+++ b/metadata/service/server/local.yml
@@ -9,3 +9,8 @@
bind:
address: 127.0.0.1
port: 9200
+ index:
+ shards: 1
+ replicas: 0
+ cluster:
+ multicast: false
diff --git a/metadata/service/server/single.yml b/metadata/service/server/single.yml
index 2dd8332..a77268e 100644
--- a/metadata/service/server/single.yml
+++ b/metadata/service/server/single.yml
@@ -9,3 +9,8 @@
bind:
address: 0.0.0.0
port: 9200
+ index:
+ shards: 1
+ replicas: 0
+ cluster:
+ multicast: false