9

I have an elastic search cluster running on 6 underpowered nodes. I want to migrate it to a new set of 4 very heavy-duty nodes. I'm trying to figure out the best way to do so. Since I'm going from 6 nodes to 4 nodes, I can't just copy data files from the old cluster to the new one. It looks like the snapshot and restore function is the way to go, but I can't find a documented way to create a snapshot on one set of hardware and restore it into another set. Has anybody ever done this sort of hardware upgrade with ElasticSearch?

Joshua Davies
  • 981
  • 9
  • 16
  • Wouldn't you snapshot on the original hardware, `scp` (copy) it to the new hardware and then perform the restore? It's been a while since I've looked at the docs for this, but perhaps just try it and see what happens? – James Addison May 01 '15 at 04:34
  • Yeah that's pretty much what I was thinking, but I can't find this process documented anywhere. – Joshua Davies May 01 '15 at 13:17

2 Answers2

15

To use snapshot/restore, you have to have a common mount point on all of the servers (ie NFS). You have to add the repository on both clusters, then snapshot on one and restore on the other. The exact commands are pretty well documented here: http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html

Another way to migrate is to join the clusters together initially and wait for everything to be green. Then work through the process of decommissioning the old slow nodes: How to remove node from elasticsearch cluster on runtime without down time

The final way to migrate is the way that @Zouzias recommended which is to use a program to copy the data from one cluster to another. There is an open source node.js based project here: https://github.com/mallocator/Elasticsearch-Exporter that will do what you need without having to write code.

Another way to migrate is to use an API available in 5.x -- reindex from remote from remote:

POST _reindex
{
  "source": {
    "remote": {
      "host": "http://otherhost:9200",
      "username": "user",
      "password": "pass"
    },
    "index": "source"
  },
  "dest": {
    "index": "dest"
  }
}

But be sure to read the documentation at the link provided because you have to set the reindex.remote.whitelist in you elasticsearch.yml file.

Alcanzar
  • 16,985
  • 6
  • 42
  • 59
1

An approach that I followed for this task is the following: Code a custom copy functionality of one (or several) index-ices from one elasticsearch cluster to another cluster using the Java API, bulk API and Scroll API.

More precisely, I use the scroll API to fetch the data from the old index and push it to the new index using the bulk API.

I also use the above functionality for backups/emergency copies of my indices.

Zouzias
  • 2,330
  • 1
  • 22
  • 32