Deploying an Elasticsearch cluster via SaltStack

Here is a short guide covering the steps I followed in order to deploy an ElasticSearch cluster using SaltStack to manage configuration.

Prerequisites

For the purposes of testing, I will be using a bunch of locally-installed virtualmachines. Specifically, we'll have:

  • A machine running salt master
  • Three elasticsearch nodes

Creating the VMs

To create the machines, I just installed a bare-bones wheezy image (under KVM) and cloned it four times:

virt-clone -o TemplateWheezy -n es-cluster-salt-master -f /mnt/virtualmachines/es-cluster-salt-master.img -m '52:54:00:ee:55:f0'
for id in 01 02 03; do
    virt-clone -o TemplateWheezy -n es-cluster-node-"$id ...

Importing Apache logs in ElasticSearch

I needed some way to visualize and analyze logs from webservers.

So, I decided to use the "elasticsearch stack" for that:

Setting up ElasticSearch

Just download, untar and launch:

wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.tar.gz
tar xzvf elasticsearch-1.1.1.tar.gz
cd elasticsearch-1.1.1
./bin/elasticsearch

Check if everything is ok:

http localhost:9200

Importing logs to ElasticSearch

I used LogStash to import the logs from file to ElasticSearch. That required a bit of configuration.

First, download & unpack logstash:

wget https://download.elasticsearch.org/logstash/logstash/logstash-1.4.0 ...

Page 1 / 1