Noteworthy at Compose - Elasticsearch Index Replicas and Redis Cache Mode

Published

This is your weekly summary of Compose news for those changes and updates which can make your life easier. In this edition, we'll look at Elasticsearch index replication settings, setting up Redis in cache mode, and take a look back at the week in Compose Articles.

Setting up Elasticsearch Indexes

When you provision an Elasticseach database on Compose, you get a three data node Elasticsearch cluster. For each index you create, it's allocated three shards and one complete replica over these nodes. This means that with three nodes your index will have three primary shards and another three replica shards, or six shards per index.

Recently, we've noticed that some Compose Elasticsearch users have opted for zero replicas when setting up an index. Setting your index to have zero replicas might give you some added performance when bulk importing a very large data. Replicas should be reset after that, but this step is frequently forgotten.

The downside of not adding a replica is that there isn't a failover system in place in case a shard/node fails. This means that you could potentially lose your data because you forgot to add a replica after ingesting data. Therefore, if you aren't anticipating bulk importing very large data sets into an index, keeping even a single replica is better than none at all.

So, we advise Compose Elasticsearch users to check whether they have at least the default one replica per index set up. You can quickly check the index settings using the following cURL command with your Compose Elasticsearch URI with your index name appended with /_settings like:

curl -u username:password https://porta99999-1.my-elastic-search-99.compose-20.composedb.com:88888/my_index/_settings?pretty  

You'll get a summary of your index's settings like the following with the number_of_replicas for that index:

{
  "my_index" : {
    "settings" : {
      "index" : {
        "number_of_shards" : "3",
        "provided_name" : "my_index",
        "creation_date" : "1525473826967",
        "store" : {
          "type" : "niofs"
        },
        "unassigned" : {
          "node_left" : {
            "delayed_timeout" : "5m"
          }
        },
        "number_of_replicas" : "1",
        "uuid" : "KU-iEg0FTseJHIw5Tn3a6A",
        "version" : {
          "created" : "6020299"
        }
      }
    }
  }
}

Enabling Redis Cache Mode

Compose user's may have noticed a change in provisioning Redis. The button to enable Redis's cache mode on the database's provisioning page was removed. This was a custom setting that Compose provided users, but we noticed that the cache mode option, when selected at provisioning, was not reliably applied to the database.

Cache mode is still available and can be enabled inside the database settings. To enable cache mode, provision a Redis database first. Once it's finished setting up, you'll see a menu on the left side in the database's Overview view. Click Settings which will take you to the database Settings view.

There, you'll find the Redis as a Cache panel with a button Enable Cache Mode. Click that button to enable cache mode.

Compose Articles

Last week in Compose Articles:

That's it for this week's Noteworthy at Compose. Onwards to next week!

Abdullah Alger
Abdullah Alger is a former University lecturer who likes to dig into code, show people how to use and abuse technology, talk about GIS, and fish when the conditions are right. Coffee is in his DNA. Love this article? Head over to Abdullah Alger’s author page to keep reading.

Conquer the Data Layer

Spend your time developing apps, not managing databases.