Перенос elasticsearch

Через easticsearch

input {
    elasticsearch {
        hosts => ['sbermarket-log-es-http:9200']
        user => "elastic"
        password => "tpd86w88bfn86c2l6jqc6n7q"
        index => "logstash-nginx_json_syslog-*"
        size => 1000
        scroll => "5m"
        ssl => true
        ca_file => "tls.crt"
        docinfo => true
    }
}

filter {
}

output {
    elasticsearch {
        hosts => ["elk-es-http:9200"]
        user => "elastic"
        password => "0c0tl1wU6aH1gMcY8O4b663S"
        index => "%{[@metadata][_index]}"
        ssl => true
        cacert => "tls-new.crt"
    }
}

Через elasticdump

NODE_TLS_REJECT_UNAUTHORIZED=0 elasticdump \
  --input=https://elastic:elastic@sbermarket-log-es-http:9200 \
  --input-index=logstash-nginx_json_syslog-2020.05.01 \
  --output=https://elastic:elastic@elk-es-http:9200 \
  --output-index=logstash-nginx_json_syslog-2020.05.01 \
  --type=data \
  --limit 10000 &

Через shanpshot на S3

# Делаем снапшот
PUT _snapshot/repo/nginx?pretty
{
   "indices": "logstash-nginx_json_syslog-2020.08*",  
   "ignore_unavailable": true,
   "include_global_state": false
}

#Смотрим какие репы есть
GET _cat/snapshots/elasticsearch-repository?v

#Восстанавливаем индексы
POST /_snapshot/elasticsearch-repository/snapshot_1/_restore
{
  "indices": "logstash-*",
  "ignore_unavailable": true,
  "include_global_state": false,              
  "include_aliases": false
}

# Подключаемся к S3 яндекса
PUT _snapshot/elasticsearch-repository?pretty
{
  "type": "s3",
  "settings": {
    "bucket": "elasticsearch-repository",
    "endpoint": "https://storage.yandexcloud.net"
  }
}
Без рубрики

Related Articles

0 Comment