Skip to content

Setup ElasticSearch

Iightspark edited this page Jun 19, 2022 · 6 revisions

Blueflood indexes all metric names in Elastic Search (ES). While this is an optional dependency, to get a list of metrics you will need to have Elasticsearch set up.

Install Elasticsearch

At the moment, Blueflood is tested to work with Elasticsearch 1.7. Because the instructions for installing this older version of Elasticsearch differ slightly from the process to install the latest version of Elasticsearch, we'll detail the process below.

Linux

General information about installing ElasticSearch can be found here:

As mentioned, we will detail the slightly different instructions to install Elasticsearch 1.7:

APT
  1. Add Elasticsearch Repo

    wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
    echo "deb http://packages.elastic.co/elasticsearch/1.7/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-1.7.list
    
  2. Update apt

    sudo apt-get update
    
  3. Install apps

    sudo apt-get install elasticsearch
    
  4. Start Elasticsearch automatically and start server

    sudo update-rc.d elasticsearch defaults 95 10
    sudo service elasticsearch start
    
YUM
  1. Download and install the public signing key

    rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
    
  2. Create elasticsearch.repo Add the following in your /etc/yum.repos.d/ directory in a file with a .repo suffix, for example elasticsearch.repo

    [elasticsearch-1.7]
    name=Elasticsearch repository for 1.7 packages
    baseurl=http://packages.elastic.co/elasticsearch/1.7/centos
    gpgcheck=1
    gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
    enabled=1
    
  3. Install Elasticsearch

    yum install elasticsearch
    
  4. Start Elasticsearch automatically and start the server

    chkconfig --add elasticsearch
    

OSX

For OSX, we recommend using homebrew (http://brew.sh).

  1. Install Elasticsearch

    brew update	
    brew install elasticsearch17
    
  2. Start Elasticsearch automatically and start the server

    ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
    

Prepare Blueflood

Set cluster name

  1. Run the health check to verify that the service is started and to retrieve the cluster name.

    curl -X GET http://localhost:9200/_cluster/health?pretty

    Example output:

    {
      "cluster_name" : "elasticsearch_brew",
      "status" : "yellow",
      "timed_out" : false,
      "number_of_nodes" : 1,
      "number_of_data_nodes" : 1,
      "active_primary_shards" : 10,
      "active_shards" : 10,
      "relocating_shards" : 0,
      "initializing_shards" : 0,
      "unassigned_shards" : 10
    }
    
  2. Edit your blueflood.conf file and add the following properties. The cluster name should match the name(cluster_name) from the curl command output above.

    ELASTICSEARCH_CLUSTERNAME=<cluster_name>
    

    With the previous example output of the _cluster/health API, you would use elasticsearch_brew for <cluster_name>.

  3. Finally, run this script to initialize Blueflood aliases and mappings in Elasticsearch:

    blueflood-elasticsearch/src/main/resources/init-es.sh
    

Well Done!

That should be all you have to do to get Elasticsearch working for Blueflood. If you have any problems, talk to us!