This document applies prior to Apache Skywalking 6.3.0, because in 6.3.0, the probe was officially provided without a restart mechanism.

Since the probe and Skywalking OAP have a registration mechanism, if the data of Elasticsearch used by Skywalking is cleaned up, you need to restart the probe so that the probe can register with the OAP again.

If you are using the new Elasticsearch as the data store, you can migrate the probe metadata from the old Elasticsearch to the new ES index (this method only migrates the metadata and therefore loses the metric data).

Material preparation

  • Pull to migrate Elasticsearch documenttaskrabbit/elasticsearch-dumpThe mirror.
    $ docker pull taskrabbit/elasticsearch-dumpCopy the code

Step-by-step instructions

  • The ES metadata is passedtaskrabbit/elasticsearch-dumpTools fromThe oldDerived from Elasticsearch.
  • Import old data into new Elasticsearch.

Export old Elasticsearch data

To export data to a JSON file, you need to export data to four indexes: service_inventory, service_instance_inventory, endpoint_inventory, and network_address_inventory

Note that ⚠️ : the Elasticsearch address of the link in this step is the address of the old data.

  • exportservice_inventoryData to theskywalking_service_inventory.json:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \
 --input=http://localhost:9200/service_inventory \
 --output=/tmp/skywalking_service_inventory.json \
 --type=dataCopy the code

  • exportservice_instance_inventoryData to theskywalking_service_instance_inventory.json:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \
 --input=http://localhost:9200/service_instance_inventory \
 --output=/tmp/skywalking_service_instance_inventory.json \
 --type=dataCopy the code

  • exportendpoint_inventoryData to theskywalking_endpoint_inventory.json:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \ --input=http://localhost:9200/endpoint_inventory \  --output=/tmp/skywalking_endpoint_inventory.json \ --type=dataCopy the code

  • exportnetwork_address_inventoryData to theskywalking_network_address_inventory.json:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \
 --input=http://localhost:9200/network_address_inventory \
 --output=/tmp/skywalking_network_address_inventory.json \
 --type=dataCopy the code

Import the JSON file exported in the previous steps into the new Elasticsearch

If your new Elasticsearch is being written by a new Skywalking OAP, please stop the OAP and run the following command to delete the new Elasticsearch document:

For example, clean up the service_inventory document:

curl -XPOST "http://localhost:9200/service_inventory/_doc/_delete_by_query? conflicts=proceed" -H 'Content-Type: application/json' -d' { "query": { "match_all": {} } }'Copy the code

Similarly, clear the files of the remaining service_instance_inventory, endpoint_inventory, and network_address_inventory indexes.

Note that ⚠️ : the Elasticsearch address of the link in this step is the address of the new data.

  • willskywalking_service_inventory.jsonImported into theservice_inventory:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \ --output=http://localhost:9200/service_inventory \  --input=/tmp/skywalking_service_inventory.json \ --type=dataCopy the code

  • willskywalking_service_instance_inventory.jsonImported into theservice_instance_inventory:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \
 --output=http://localhost:9200/service_instance_inventory \
 --input=/tmp/skywalking_service_instance_inventory.json \
 --type=dataCopy the code

  • willskywalking_endpoint_inventory.jsonImported into theendpoint_inventory:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \
 --output=http://localhost:9200/endpoint_inventory \
 --input=/tmp/skywalking_endpoint_inventory.json \
 --type=dataCopy the code

  • willskywalking_network_address_inventory.jsonImported into thenetwork_address_inventory:
docker run --rm -ti -v ~/Desktop:/tmp taskrabbit/elasticsearch-dump \
 --output=http://localhost:9200/network_address_inventory \
 --input=/tmp/skywalking_network_address_inventory.json \
 --type=dataCopy the code

reference

  • Taskrabbit/elasticsearch – dump tool

The article was first published on the official account: Xiaoke Coding Notes

Published by OpenWrite!