Setting up a node

Elasticsearch allows customizing several parameters in an installation. In this recipe, we'll see the most used ones to define where to store our data and to improve the overall performances.

Getting ready

You need a working Elasticsearch installation as we described in the Downloading and installing Elasticsearch recipe and a simple text editor to change configuration files.

How to do it...

The steps required for setting up a simple node are as follows:

  • Open config/elasticsearch.yml with an editor of your choice.
  • Setup the directories that store your server data.
  • For Linux or Mac OS X type the following command:
        path.conf: /opt/data/es/conf
        path.data: /opt/data/es/data1,/opt2/data/data2
        path.work: /opt/data/work 
        path.logs: /opt/data/logs 
        path.plugins: /opt/data/plugins 
  • For Windows type the following command:
        path.conf: c:Elasticsearchconf 
        path.data: c:Elasticsearchdata 
        path.work: c:Elasticsearchwork 
        path.logs: c:Elasticsearchlogs 
        path.plugins: c:Elasticsearchplugins 
  • Set up parameters to control the standard index creation. These parameters are:
        index.number_of_shards: 5 
        index.number_of_replicas: 1 

How it works...

The path.conf defines the directory that contains your configuration: mainly elasticsearch.yml and logging.yml. This is default $ES_HOME/config with ES_HOME to install directory.

Note

It's useful to set up the config directory outside your application directory, so you don't need to copy the configuration files every time you update your version or change the Elasticsearch installation directory.

The path.data is the most important one: it allows us to define one or more directories (in different disk) where you can store your index data. When you define more than one directory, they are managed a la RAID 0 (their space is sum up), favoring locations with most free space.

The path.work is a location when Elasticsearch stores temporary files.

The path.log is where log files are put. The control how to log is managed in logging.yml.

The path.plugins allows you to override the plugins path (the default is $ES_HOME/plugins). It's useful to put system-wide plugins.

The main parameters used to control index and shards in index.number_of_shards that controls the standard number of shards for a new created index and index.number_of_replicas that controls the initial number of replicas.

There's more...

There are a lot of other parameters that can be used to customize your Elasticsearch installation and new ones are added with new releases. The most important ones are described in this and the next recipe.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.69.199