RousselTMLEARNING

TP · Elasticsearch: from discovery to expertise

Backup and restore

What you will learn in this TP
  • Declare a snapshot repository
  • Create a backup policy
  • Restore an index or part of the data
Mode :

All steps and instructions are shown. Recommended for this lab: autonomous

Prerequisites #

Context. A human error can delete a production index. You set up scheduled snapshots, then test several restores.

Prerequisites: an Elasticsearch cluster and Kibana (lab "Installing Elasticsearch"), Dev Tools  ·  Estimated time: 50 min

You need an Elasticsearch cluster with a Kibana instance connected to it. If that is not yet the case, we invite you to complete the lab on installing Elasticsearch.

You also need a space to store the backups. For this lab, we will use a shared folder mounted on all the containers/VMs.
WARNING: Whatever mechanism is used to store the snapshots, it must have its own backup policy, which you must manage outside Elasticsearch.

Backup storage #

  1. Creating the storage

    You need storage space for your backups. Elasticsearch offers several options: Cloud (Azure, GCP and AWS) and others. In this lab we will use the 'Shared file system' option. This requires an NFS share mounted at the same location on the master and data nodes. This is already done in the Docker configuration, so you can use the '/data/backups' folder.

  2. Declaring the storage

    Declare the '/data/backups' storage in Elasticsearch

  3. Configuring the storage

    Create a new 'repository' named 'monpremierrepo' of type 'shared file system' with the following parameters:
    • Chunk size: 1 GB
    • restore speed per second: half a GB
  4. Verifying the storage

    Check that all master and data nodes can access the repo.

The backup policy #

  1. My first policy

    Configure a policy named 'mapremierepolicy' that generates snapshots named 'monpremiersnaphot', stores the backups in the 'monpremierrepo' 'repository', backs up the indices starting with mon and runs every day at 3 a.m. with a 3-day rotation.
    WARNING: It is advisable to have several backup policies depending on the type of data. For example, there is no point backing up a setting every day when it changes once or twice a year. Conversely, you will have indices with critical information that may need to be backed up every hour?
  2. Testing my policy

    Force the policy to run.

What next #

At this stage, we have set up our snapshot with its policy. We will now test a restore. To check the restore, we will simulate some accidental actions.

  1. Index mistake

    Delete the 'mon-deuxieme-index' index

  2. Document mistake

    In the 'mon-second-index' index, delete the document with id 4.

  3. Rolling back

    Restore the most recent snapshot.

  4. Targeted rollback

    Restore only the 'mon-deuxieme-index' index

Validate your work

Check that each goal above is reached and that you get the result described in the introduction.

Difficulty level : ●●●●○ (4/5)

My progress

  • ⏱ Estimated time : ≈ 50 min

Sign in to track your progress and take notes. Sign in

⭐ Rate this lesson

5.0 initial rating from the teaching team

Sign in to rate this lesson →

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Course Glossary

RBAC (Role-Based Access Control)

An access control method where permissions are assigned to specific roles (e.g., admin, reader) rather than directly to individual users.

Authentication

The process of verifying the identity of a user or system (e.g., login/password, tokens, biometrics).

Authorization

The process that occurs after authentication to determine if the entity has the necessary rights and privileges to access a resource.

API Key

A unique alphanumeric code used to identify, authenticate, and authorize access to an Application Programming Interface (API).

Architecture

The overall structural design of an IT system, defining its various components, their relationships, and the principles guiding its evolution.

Repository

A centralized storage location. This can refer to a source code repository (e.g., Git) or an artifact and binary repository (e.g., Harbor, Nexus, Arti...

Elasticsearch

A distributed, RESTful search and analytics engine capable of addressing a growing number of use cases, built on Apache Lucene.

Recommended Articles

Snapshot Lifecycle Management: automated backups, restore and disaster recovery

Protect Elasticsearch data: snapshot repositories (S3, GCS, Azure, file system), SLM policies wit...

Cross-cluster search and cross-cluster replication: multi-cluster Elasticsearch architectures

Design multi-cluster Elasticsearch architectures: remote clusters, cross-cluster search, cross-cl...

Automation and infrastructure as code for Elasticsearch: API, Terraform, Ansible and CI/CD

Automate Elasticsearch administration: REST API and clients, the elasticstack Terraform provider ...

Elasticsearch distributed architecture: node roles, shards, replicas and allocation

Understand how Elasticsearch works as a distributed system: node roles, master nodes and quorum, ...

Elasticsearch ingestion: Bulk API, ingest pipelines, enrich and reindex

Ingest and transform data in Elasticsearch: Bulk API, ingest pipelines and processors (grok, diss...

Elasticsearch monitoring and troubleshooting: health, unassigned shards, JVM, hot threads and slow logs

Diagnose an Elasticsearch cluster: cluster health and CAT APIs, unassigned shards and allocation ...

Understanding the Elastic Common Schema (ECS)

As always in our consulting engagements, we recommend that companies harmonise and standardise: k...

Advanced Elasticsearch security: TLS, certificates, API keys, FLS, DLS and audit

Secure Elasticsearch in depth: transport and HTTP TLS, certificate management with elasticsearch-...

OpenSearch in production: ISM, backups, security and best practices

Automate the lifecycle with ISM, back up with snapshots, manage roles and size an OpenSearch clus...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!