Backup/Restore Redis and ElasticSearch

网友投稿 379 2022-09-07

Backup/Restore Redis and ElasticSearch

Backup/Restore Redis and ElasticSearch RedisAll data (by default) is stored both in an .aof and a .rdb file, which is a snapshot of your Redis dataset. They are made at specified intervals. The default location of this file is: /data/redis You can backup the files just by copying it or taking it from a backup spanpshot, but is not guaranteed an up-to-the-minute backup. To guarantee (this will incur downtime in the source machine), first login in redis and save the snapshot: # redis‐cli ‐a shutdown save The is in the api_v1 repo, inside the file common/config.js , in redis.password . To restore the data, first stop the target redis: # docker stop redis‐master Move the .rdb and .aof files to /data/redis in the target machine and start the service # docker start redis‐master ElasticsearchSource: https://npmjs.com/package/elasticdump Requirements: NodeJS 5.x Install elasticdump globally using npm npm install elasticdump ‐g Remove existing data in Elasticsearch. If you are usind Docker data is in /data/elasticsearch/data Stop Elasticsearch and delete any content inside that directory. IMPORTANT: You must always restore backups to MASTER node otherwise will fail. Connect to Backup Droplet [ IP: 45.55.159.91 ] and download the backup you want to restore. backups are located in /root/backup. For example tsb-dev-DATE-elasticsearch.tar.gz where date is the backup date in format YYYY-MM-DD-hhmm, example: tsb-dev-2016-07-28-19-00-elasticsearch.tar.gz Uncompress the backup file and change directory tar xzvf tsb‐dev‐2016‐07‐28‐19‐00‐elasticsearch.tar.gz cd tsb‐dev‐2016‐07‐28‐19‐00‐elasticsearch/ Here we store to files per index: data and mapping To restore this backup, run this command for each index replacing my_index with the index name elasticdump \ ‐‐input=my_index_mapping.json \ ‐‐output=\ ‐‐type=mapping elasticdump \ ‐‐input=my_index_data.json \ ‐‐output=\ ‐‐type=data For example, restoring public_worlds elasticdump \ ‐‐input=public_worlds_mapping.json \ ‐‐output=\ ‐‐type=mapping elasticdump \ ‐‐input=public_worlds_data.json \ ‐‐output=\ ‐‐type=data Example for Pacman-Maker elasticdump ‐‐input=public_worlds_mapping.json ‐‐output=‐‐type=mapping elasticdump ‐‐input=public_worlds_data.json ‐‐output=‐‐type=data elasticdump ‐‐input=world_mapping.json ‐‐output=‐‐type=mapping elasticdump ‐‐input=world_data.json ‐‐output=‐‐type=data elasticdump ‐‐input=profile_mapping.json ‐‐output=‐‐type=mapping elasticdump ‐‐input=profile_data.json ‐‐output=‐‐type=data

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:仙人JUMP:关于不想加班,年轻人是对的!
下一篇:嵌入式Web开发——Boa服务器移植
相关文章

 发表评论

暂时没有评论,来抢沙发吧~