Skip to content

Instantly share code, notes, and snippets.

@patte
Last active June 22, 2018 17:01
Show Gist options
  • Save patte/ffefe681f6318e666b86967377070011 to your computer and use it in GitHub Desktop.
Save patte/ffefe681f6318e666b86967377070011 to your computer and use it in GitHub Desktop.
Steps to switch the production elasticsearch server.

Operation Grillzange

Steps to switch the production elasticsearch server.

  1. Preparations

    • write down current ELASTIC_URL of republik-api
    • test on staging first
    • export / import kibana (management -> saved objects -> export everything)
  2. Stop writing to elasticsearch;

    • publikator-api: DISABLE_PUBLISH=true
    • republik-api: SEARCH_PG_LISTENER=false (postgresql <-> elasticsearch sync)
  3. pull data into new elastic

    • dpcuments, comments, users, ...
     heroku run "DEBUG=search:* ELASTIC_URL=https://elastic:PASSWORD@NEW_URL yarn run pull:elasticsearch --flush" -a republik-publikator-api --size=performance-l
    
    • searches
    elasticdump \
        --input=OLD_ELASTIC_URL/republik-searches \
         --output=NEW_ELASTIC_URL/republik-searches
    

    https://github.com/taskrabbit/elasticsearch-dump

  4. switch address

    • publikator-api and republik-api: ELASTIC_URL=new
  5. Checks

  6. reenable writing to elasticsearch

    • publikator-api: DISABLE_PUBLISH=false
    • republik-api: SEARCH_PG_LISTENER=true
  7. check again

    • for rollback: begin anew and reverse step 3
  8. profit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment