Reindexing with Logstash can be done with the following Logstash configuration:
input {
# We read from the "old" index
elasticsearch {
hosts => ["http://<host>:<port>"]
index => "<old_index>"
size => 500
scroll => "5m"| n_shards=$1 | |
| echo "ES version" | |
| curl -s localhost:9200 | |
| echo "Create index" | |
| curl -si -H 'Content-type: application/json' -X PUT localhost:9200/twitter -d ' | |
| { | |
| "settings": { | |
| "index": { |
| #!/bin/bash -e | |
| # Setup a Root CA in vault | |
| # Generate and sign an Intermediate cert | |
| # | |
| # Requires: | |
| # * A running vault server already initialzed and unsealed | |
| # * Environment variable VAULT_TOKEN is set | |
| # * vault cli (https://www.vaultproject.io) | |
| # * httpie (https://github.com/jkbrzt/httpie) |
| version: "3.3" | |
| services: | |
| traefik: | |
| image: traefik | |
| command: | |
| - "--api" | |
| - "--entrypoints=Name:http Address::80 Redirect.EntryPoint:https" | |
| - "--entrypoints=Name:https Address::443 TLS" | |
| - "--defaultentrypoints=http,https" |
| # coding:utf-8 | |
| from elasticsearch import Elasticsearch | |
| import json | |
| # Define config | |
| host = "127.0.0.1" | |
| port = 9200 | |
| timeout = 1000 | |
| index = "index" |
| variable "name" {} | |
| variable "policy" {} | |
| resource "null_resource" "acl" { | |
| triggers { | |
| name = "${var.name}" | |
| policy = "${var.policy}" | |
| } | |
| provisioner "local-exec" { |
| FROM mirror-hub.docker.tech.lastmile.com/alpine:3.5 | |
| RUN apk add --no-cache curl jq | |
| RUN curl -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.5.3/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl | |
| COPY rmpeers / | |
| CMD ["/rmpeers"] |
Reindexing with Logstash can be done with the following Logstash configuration:
input {
# We read from the "old" index
elasticsearch {
hosts => ["http://<host>:<port>"]
index => "<old_index>"
size => 500
scroll => "5m"| #!/bin/bash -e | |
| # Setup a Root CA in vault | |
| # Generate and sign an Intermediate cert | |
| # | |
| # Requires: | |
| # * A running vault server already initialzed and unsealed | |
| # * Environment variable VAULT_TOKEN is set | |
| # * vault cli (https://www.vaultproject.io) | |
| # * httpie (https://github.com/jkbrzt/httpie) |
| from elasticsearch import Elasticsearch | |
| es = Elasticsearch(hosts=['es-host:9200'], timeout=600) #long timeout for the restore operation | |
| snapshotName='index_name_20151012140502' | |
| alias = es.indices.get_alias('index_name').keys()[0] if es.indices.exists_alias(name='index_name') else '' | |
| indices = filter(lambda x: x.startswith('index_name'), es.indices.get_aliases()) | |
| indices.sort() | |
| print 'restore repository' | |
| es.snapshot.restore(repository='repository_name', snapshot=snapshotName, body ='{ "ignore_unavailable": "true", "include_global_state": false}', wait_for_completion=True) | |
| if (len(alias) > 1): |
| #!/usr/bin/python | |
| """ | |
| Multicast group scanner. | |
| Author: Lasse Karstensen <lasse.karstensen@gmail.com>, November 2014 | |
| """ | |
| import gevent | |
| from gevent import monkey | |
| monkey.patch_all() |