Thursday, April 18, 2024

Take backup of elasticsearch using curl command

Add below path ( as per directory structure) to yml file. 


[elk@PGNODE1 ~]$ cat /u01/elasticsearch-8.13.1/config/elasticsearch.yml

path.repo: ["/u01/backup"]


Restart Elasticsearch services.


[elk@PGNODE1 ~]$ curl -XPUT -H "content-type:application/json" 'http://localhost:9200/_snapshot/esbackup' -d '{"type":"fs","settings":{"location":"/u01/backup","compress":true}}'

{"acknowledged":true}[elk@PGNODE1 ~]$

[elk@PGNODE1 ~]$

[elk@PGNODE1 ~]$ curl -XGET 'http://localhost:9200/_snapshot/_all?pretty'

{

  "esbackup" : {

    "type" : "fs",

    "settings" : {

      "compress" : "true",

      "location" : "/u01/backup"

    }

  }

}

[elk@PGNODE1 ~]$ curl -XGET 'http://localhost:9200/_cat/indices'

yellow open song     U-bMfpDvR-mBYC0D00bhVg 1 1 0 0 249b 249b 249b

yellow open hardware akZTxoR4QmWSzdoOCNzcIg 1 1 0 0 249b 249b 249b

[elk@PGNODE1 ~]$ curl -XPUT 'http://localhost:9200/_snapshot/esbackup/first-snapshot?wait_for_completion=true'

{"snapshot":{"snapshot":"first-snapshot","uuid":"fGBkr1i4Qi-F1RH9PI1xng","repository":"esbackup","version_id":8503000,"version":"8503000","indices":[".ds-ilm-history-7-2024.04.09-000001",".internal.alerts-observability.apm.alerts-default-000001",".apm-custom-link",".internal.alerts-default.alerts-default-000001",".internal.alerts-observability.slo.alerts-default-000001",".ds-.kibana-event-log-ds-2024.04.18-000002",".internal.alerts-security.alerts-default-000001",".kibana_security_session_1",".kibana_task_manager_8.13.2_001",".internal.alerts-observability.logs.alerts-default-000001",".kibana_alerting_cases_8.13.2_001",".internal.alerts-ml.anomaly-detection.alerts-default-000001",".internal.alerts-transform.health.alerts-default-000001",".internal.alerts-observability.metrics.alerts-default-000001","song",".kibana_security_solution_8.13.2_001",".internal.alerts-observability.uptime.alerts-default-000001",".kibana-observability-ai-assistant-kb-000001",".security-7","hardware",".internal.alerts-observability.threshold.alerts-default-000001",".slo-observability.summary-v3.temp",".slo-observability.sli-v3",".kibana_ingest_8.13.2_001",".security-profile-8",".internal.alerts-ml.anomaly-detection-health.alerts-default-000001",".ds-ilm-history-7-2024.04.18-000002",".slo-observability.summary-v3",".internal.alerts-stack.alerts-default-000001",".apm-agent-configuration",".kibana_analytics_8.13.2_001",".apm-source-map",".kibana-observability-ai-assistant-conversations-000001",".kibana_8.13.2_001",".ds-.kibana-event-log-ds-2024.04.09-000001"],"data_streams":["ilm-history-7",".kibana-event-log-ds"],"include_global_state":true,"state":"SUCCESS","start_time":"2024-04-18T12:47:09.069Z","start_time_in_millis":1713444429069,"end_time":"2024-04-18T12:47:09.878Z","end_time_in_millis":1713444429878,"duration_in_millis":809,"failures":[],"shards":{"total":35,"failed":0,"successful":35},"feature_states":[{"feature_name":"security","indices":[".security-7",".security-profile-8"]},{"feature_name":"kibana","indices":[".kibana_ingest_8.13.2_001",".kibana_security_solution_8.13.2_001",".kibana_8.13.2_001",".kibana_alerting_cases_8.13.2_001",".kibana_analytics_8.13.2_001",".apm-custom-link",".apm-agent-configuration",".kibana_task_manager_8.13.2_001",".kibana_security_session_1"]}]}}[elk@PGNODE1 ~]$ curl -XGET 'http://localhost:9200/_snapshot/esbackup/_all?pretty'

{

  "snapshots" : [

    {

      "snapshot" : "first-snapshot",

      "uuid" : "fGBkr1i4Qi-F1RH9PI1xng",

      "repository" : "esbackup",

      "version_id" : 8503000,

      "version" : "8503000",

      "indices" : [

        ".ds-ilm-history-7-2024.04.09-000001",

        ".internal.alerts-observability.apm.alerts-default-000001",

        ".apm-custom-link",

        ".internal.alerts-default.alerts-default-000001",

        ".internal.alerts-observability.slo.alerts-default-000001",

        ".ds-.kibana-event-log-ds-2024.04.18-000002",

        ".internal.alerts-security.alerts-default-000001",

        ".kibana_security_session_1",

        ".kibana_task_manager_8.13.2_001",

        ".internal.alerts-observability.logs.alerts-default-000001",

        ".kibana_alerting_cases_8.13.2_001",

        ".internal.alerts-ml.anomaly-detection.alerts-default-000001",

        ".internal.alerts-transform.health.alerts-default-000001",

        ".internal.alerts-observability.metrics.alerts-default-000001",

        "song",

        ".kibana_security_solution_8.13.2_001",

        ".internal.alerts-observability.uptime.alerts-default-000001",

        ".kibana-observability-ai-assistant-kb-000001",

        ".security-7",

        "hardware",

        ".internal.alerts-observability.threshold.alerts-default-000001",

        ".slo-observability.summary-v3.temp",

        ".slo-observability.sli-v3",

        ".kibana_ingest_8.13.2_001",

        ".security-profile-8",

        ".internal.alerts-ml.anomaly-detection-health.alerts-default-000001",

        ".ds-ilm-history-7-2024.04.18-000002",

        ".slo-observability.summary-v3",

        ".internal.alerts-stack.alerts-default-000001",

        ".apm-agent-configuration",

        ".kibana_analytics_8.13.2_001",

        ".apm-source-map",

        ".kibana-observability-ai-assistant-conversations-000001",

        ".kibana_8.13.2_001",

        ".ds-.kibana-event-log-ds-2024.04.09-000001"

      ],

      "data_streams" : [

        "ilm-history-7",

        ".kibana-event-log-ds"

      ],

      "include_global_state" : true,

      "state" : "SUCCESS",

      "start_time" : "2024-04-18T12:47:09.069Z",

      "start_time_in_millis" : 1713444429069,

      "end_time" : "2024-04-18T12:47:09.878Z",

      "end_time_in_millis" : 1713444429878,

      "duration_in_millis" : 809,

      "failures" : [ ],

      "shards" : {

        "total" : 35,

        "failed" : 0,

        "successful" : 35

      },

      "feature_states" : [

        {

          "feature_name" : "security",

          "indices" : [

            ".security-7",

            ".security-profile-8"

          ]

        },

        {

          "feature_name" : "kibana",

          "indices" : [

            ".kibana_ingest_8.13.2_001",

            ".kibana_security_solution_8.13.2_001",

            ".kibana_8.13.2_001",

            ".kibana_alerting_cases_8.13.2_001",

            ".kibana_analytics_8.13.2_001",

            ".apm-custom-link",

            ".apm-agent-configuration",

            ".kibana_task_manager_8.13.2_001",

            ".kibana_security_session_1"

          ]

        }

      ]

    }

  ],

  "total" : 1,

  "remaining" : 0

}




Thanks,
searchinoracle

No comments:

Post a Comment