Backup/Restore Redis and ElasticSearch
来源:互联网 发布:淘宝上怎么买二手货 编辑:程序博客网 时间:2024/05/22 07:58
Backup/Restore Redis and ElasticSearch
Redis
All 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 <passwd> 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
Elasticsearch
Source: https://www.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=http://localhost:9200/my_index \
‐‐type=mapping
elasticdump \
‐‐input=my_index_data.json \
‐‐output=http://localhost:9200/my_index \
‐‐type=data
For example, restoring public_worlds
elasticdump \
‐‐input=public_worlds_mapping.json \
‐‐output=http://localhost:9200/public_worlds \
‐‐type=mapping
elasticdump \
‐‐input=public_worlds_data.json \
‐‐output=http://localhost:9200/public_worlds \
‐‐type=data
Example for Pacman-Maker
elasticdump ‐‐input=public_worlds_mapping.json ‐‐output=http://10.132.110.168:2500/public_worlds ‐‐type=mapping
elasticdump ‐‐input=public_worlds_data.json ‐‐output=http://10.132.110.168:2500/public_worlds ‐‐type=data
elasticdump ‐‐input=world_mapping.json ‐‐output=http://10.132.110.168:2500/world ‐‐type=mapping
elasticdump ‐‐input=world_data.json ‐‐output=http://10.132.110.168:2500/world ‐‐type=data
elasticdump ‐‐input=profile_mapping.json ‐‐output=http://10.132.110.168:2500/profile ‐‐type=mapping
elasticdump ‐‐input=profile_data.json ‐‐output=http://10.132.110.168:2500/profile ‐‐type=data
Redis
All 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 <passwd> 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
Elasticsearch
Source: https://www.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=http://localhost:9200/my_index \
‐‐type=mapping
elasticdump \
‐‐input=my_index_data.json \
‐‐output=http://localhost:9200/my_index \
‐‐type=data
For example, restoring public_worlds
elasticdump \
‐‐input=public_worlds_mapping.json \
‐‐output=http://localhost:9200/public_worlds \
‐‐type=mapping
elasticdump \
‐‐input=public_worlds_data.json \
‐‐output=http://localhost:9200/public_worlds \
‐‐type=data
Example for Pacman-Maker
elasticdump ‐‐input=public_worlds_mapping.json ‐‐output=http://10.132.110.168:2500/public_worlds ‐‐type=mapping
elasticdump ‐‐input=public_worlds_data.json ‐‐output=http://10.132.110.168:2500/public_worlds ‐‐type=data
elasticdump ‐‐input=world_mapping.json ‐‐output=http://10.132.110.168:2500/world ‐‐type=mapping
elasticdump ‐‐input=world_data.json ‐‐output=http://10.132.110.168:2500/world ‐‐type=data
elasticdump ‐‐input=profile_mapping.json ‐‐output=http://10.132.110.168:2500/profile ‐‐type=mapping
elasticdump ‐‐input=profile_data.json ‐‐output=http://10.132.110.168:2500/profile ‐‐type=data
阅读全文
0 0
- Backup/Restore Redis and ElasticSearch
- XCloner - Backup and Restore
- Ubuntu backup and restore
- DB2 Backup and Restore
- Sybase backup and restore
- MySQL Backup and Restore
- SQL Server backup and restore
- win 7 backup and restore
- MySQL Database backup and restore
- TFS Express backup and restore
- BACKUP... VALIDATE、VALIDATE and RESTORE VALIDATE
- Howto: Backup and restore your system!
- Backup and Restore MySQL Database Using mysqldump
- sharepoint Backup and Restore using STSADM
- mysql export & import (backup and restore)
- MySQL 编码转换,backup and restore
- quick ubuntu system backup and restore
- Backup and Restore Search Service Application
- python_numpy_tile(a,(b,c))
- CIFS Publishers拷贝文件到windows
- PHP基础知识重温及整理
- python 打印数组中文显示为'\xe6\xb5\x8b\xe8\xaf\x95\xe4\xb8\xbb\xe6\x9c\xba‘’
- linux下,几种压缩文件的解压
- Backup/Restore Redis and ElasticSearch
- java中可以出现的中文乱码的集中解决
- Java学习心得之网络编程
- 笨方法学习Python-习题23: 读代码
- 通过linux mail实现网站存活监控告警通知
- nginx配置
- crontab使用
- 讲给Android程序员看的前端教程(03)——HTML5标签(2)
- lintcode---旋转图形