๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
ElasticSearch(OpenSearch)

[ES] minio์— ์Šค๋ƒ…์ƒท ์ƒ์„ฑํ•˜๊ธฐ(๋ฐฑ์—…)

by soo min 2023. 9. 10.

8.2 ๋ฒ„์ „์€ s3 ๋ฆฌํฌ์ง€ํ† ๋ฆฌ ํ”Œ๋Ÿฌ๊ทธ์ธ์ด elasticsearch์— ํฌํ•จ๋˜์–ด์žˆ์–ด ๋”ฐ๋กœ ์„ค์น˜ํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค. 

https://www.elastic.co/guide/en/elasticsearch/plugins/8.2/repository-s3.html

# s3 ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์น˜ํ•˜๋ ค๊ณ  ํ•˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฉ”์‹œ์ง€๊ฐ€ ๋œฌ๋‹ค ๋”ฐ๋ผ์„œ ๋”ฐ๋กœ ์„ค์น˜ํ•˜์ง€ ์•Š์•„๋„ ๋œ๋‹ค.
elasticsearch@e1f8e9abc280:~/bin$ elasticsearch-plugin installrepository-s3 --batch
-> Installing repository-s3
[repository-s3] is no longer a plugin but instead a module packaged with this distribution of Elasticsearch
-> Please restart Elasticsearch to activate any plugins installed

 

 

1. es์— minio ์ž๊ฒฉ ์ฆ๋ช… ์ถ”๊ฐ€ํ•˜๊ธฐ

๋ชจ๋“  ๋…ธ๋“œ์— minio ์ž๊ฒฉ ์ฆ๋ช…์„ ์ถ”๊ฐ€ํ•œ๋‹ค. 

docker exec -it ${์ปจํ…Œ์ด๋„ˆ id} /bin/bash
bin/elasticsearch-keystoreadd s3.client.default.access_key
bin/elasticsearch-keystoreadd s3.client.default.secret_key

๋…ธ๋“œ ๋‹ค์‹œ ์‹œ์ž‘ํ•œ๋‹ค(๋‹ค์‹œ ์‹œ์ž‘ํ• ๋•Œ๋Š” ์ƒค๋“œ ํ• ๋‹น ์ œํ•œ → ๋‹ค์‹œ ์‹œ์ž‘ → ์ƒค๋“œ ํ• ๋‹น ํ™œ์„ฑํ™”)

 

2. ์Šค๋ƒ…์ƒท repository ์ƒ์„ฑ

ํ‚ค๋ฐ”๋‚˜ dev tool ๋˜๋Š” curl ๋ช…๋ น์–ด๋กœ ๋‚ ๋ฆฐ๋‹ค.

# _snapshot/๋ ˆํฌ์ง€ํ† ๋ฆฌ์ด๋ฆ„
PUT _snapshot/minio-backup
{
   "type": "s3",
   "settings": {
      "bucket": "elasticsearch", # minio์˜ ๋ฐฑ์—…ํ•  ๋ฒ„ํ‚ท ์ด๋ฆ„
      "endpoint": "XXXX.com:9000", # minio ์ฃผ์†Œ
      "path_style_access": "true",
      "protocol": "https"
   }
}

 

3. ์Šค๋ƒ…์ƒท ์ƒ์„ฑ

# _snapshot/๋ ˆํฌ์ง€ํ† ๋ฆฌ์ด๋ฆ„/์Šค๋ƒ…์ƒท์ด๋ฆ„
# wait_for_completion๋Š” ๋™๊ธฐ ์ž‘์—…์œผ๋กœ ์‹คํ–‰ํ•ด์ฃผ์–ด ๋ช…๋ น์ด ๋๋‚˜์ง€ ์•Š๊ณ  ๋Œ€๊ธฐํ•˜๋„๋ก ์„ค์ •ํ•ด์ฃผ๋Š” ์˜ต์…˜
PUT _snapshot/minio-backup/log?wait_for_completion=true
{
   "indices": "log*" #์Šค๋ƒ…์ƒท๋Œ€์ƒ์ด๋˜๋Š” ์ธ๋ฑ์Šค๋“ค์„ ์ง€์ • * ์ ์šฉํ•˜์—ฌ log๋กœ ์‹œ์ž‘ํ•˜๋Š” ์ธ๋ฑ์Šค๋ฅผ ๋Œ€์ƒ์œผ๋กœ ํ•œ๋‹ค.
}

 

4. ์Šค๋ƒ…์ƒท ์ƒ์„ฑ ํ™•์ธ

GET _snapshot/minio-backup/log-snap
{
   "snapshots" : [
     {
       "snapshot" : "log-snap", # ์Šค๋ƒ…์ƒท ์ด๋ฆ„์„ ํ™•์ธํ•œ๋‹ค.
       "uuid" : "JGPoE8HrSLCF8stdUhMCvw",
       "repository" : "minio-backup", # ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋ฅผ ํ™•์ธํ•œ๋‹ค.
       "version_id" : 8020099,
       "version" : "8.2.0",
       "indices" : [ # ์Šค๋ƒ…์ƒท์œผ๋กœ ์ €์žฅ๋˜๋Š” ์ธ๋ฑ์Šค๋ฅผ ํ™•์ธํ•œ๋‹ค.
         "log-2023.04.02-000367",
         "log-2023.04.02-000366",
       ],
       "data_streams" : [ ],
       "include_global_state" : true,
       "state" : "IN_PROGRESS", # ํ˜„์žฌ ์Šค๋ƒ…์ƒท ์ƒํƒœ๋ฅผ ํ™•์ธํ•œ๋‹ค. ์ง„ํ–‰์ค‘์ด๋ฉด IN_PROGRESS, ์„ฑ๊ณตํ–ˆ์œผ๋ฉด SUCCESS ๊ฐ€ ๋œฌ๋‹ค.
       "start_time" : "2023-05-31T10:01:38.894Z",
       "start_time_in_millis" : 1685527298894,
       "end_time" : "1970-01-01T00:00:00.000Z",
       "end_time_in_millis" : 0,
       "duration_in_millis" : 0,
       "failures" : [ ],
       "shards" : {
         "total" : 146,
         "failed" : 125,
         "successful" : 21
       }
     }
   ],
   "total" : 1,
   "remaining" : 0
 }