Migrate Elasticsearch to the ECK operator (staged)
Learn how to migrate from the deprecated Elasticsearch for version 1.4
읽는 시간 3분최근 업데이트: 8일 전
Migrate Elasticsearch to the ECK operator (staged)
For version 1.4 and newer.
We are deprecating the StatefulSet chart and will remove it in a future release.
elasticsearchYou need to migrate to ECK. There's no data loss or downtime, but expect a brief write pause during the final copy, because is scaled to zero while data is copied.
catalog-writerPrerequisites
Plan capacity for the parallel run of the ECK and existing Elasticsearch.
The ECK cluster needs about 5.5 CPU and 22 GiB of memory. This is in addition to the existing cluster, until you retire it. In total, you need three dedicated primary nodes and two data nodes at 4 CPU and 8 GiB limits, sized so that org-wide asset search stays fast.
Upgrade
To migrate:
-
Upgrade to this release with.
enable_elasticsearch_eck = true -
Run.
make apply-<region>The ECK operator and an emptycome up alongside your existing Elasticsearch.elastic-eck-clusterCatalog services keep using the existing cluster, so nothing changes yet. -
Stop writes during the copy:kubectl scale deploy/asset-catalog-writer --replicas=0 -n asset-solutions
-
Copy your data into the ECK cluster.The script runs as a one-shot pod streamed over standard input, and uses the publicdebug image for its
nicolaka/netshoot,bash, andcurltooling.jqIf your nodes can't pull from Docker Hub, substitute any image that has those three tools.The Elasticsearch password is injected from thesecret, so it never appears in your shell or in the pod spec:elasticsearch-apps-credentialskubectl run es-reindex -n asset-solutions --restart=Never --rm -i \ --pod-running-timeout=10m \ --image=docker.io/nicolaka/netshoot:v0.14 \ --overrides='{ "spec": { "securityContext": {"runAsNonRoot": true, "runAsUser": 1001, "runAsGroup": 1001, "seccompProfile": {"type": "RuntimeDefault"}}, "containers": [{ "name": "es-reindex", "image": "docker.io/nicolaka/netshoot:v0.14", "stdin": true, "stdinOnce": true, "command": ["bash", "-s"], "securityContext": {"allowPrivilegeEscalation": false, "capabilities": {"drop": ["ALL"]}}, "resources": {"requests": {"cpu": "100m", "memory": "128Mi"}, "limits": {"cpu": "500m", "memory": "256Mi"}}, "env": [{"name": "ELASTIC_PASSWORD", "valueFrom": {"secretKeyRef": {"name": "elasticsearch-apps-credentials", "key": "password"}}}] }] } }' < scripts/elasticsearch-reindex.shTo pass the optional overrides, add them to thearray. For example, passenv. The optional overrides are{"name": "DST_SHARDS", "value": "2"},DST_SHARDS,DST_REPLICAS,SRC, orDST. The script header documents each one.ES_USEREach index's shard count is based on its actual data size: one primary shard for each started 25 GB, and one replica. SetandDST_SHARDSif you need a specific layout.DST_REPLICASRe-running the script only creates indices that are missing on the destination. An index that already exists there keeps its current shard layout, and the script reports it. To re-cut such an index, delete it on the destination first. -
Cut over: set.
use_eck_elasticsearch = true -
Run.
make apply-<region> -
Scaleback up.
asset-catalog-writer -
Verify search and catalog operations.
-
Retire the existing cluster: setand reapply.
enable_elasticsearch = false -
A later release removes the existing chart, and you can then delete the oldPersistentVolumeClaims to reclaim storage.
elasticsearch-master-*
Rollback
To rollback before you scale : set and reapply. Catalog services return to the still-running existing cluster with no data loss.
asset-catalog-writeruse_eck_elasticsearch = falseIf you've started writing against the ECK cluster, the existing cluster is stale. If you roll back at this point, catalog services return to a dataset that's missing everything written since cutover. This means that you need to copy the new data before you rollback:
- Stop writes again.
- Delete the affected indices on the existing cluster (the script skips indices that already exist on the destination).
- re-run the script with and
SRCswapped.DST - Set and reapply.
use_eck_elasticsearch = false