elasticsearch备份脚本
- 安装elasticdump (预计20分钟 )
mkdir /data/nodejs
cd /data/nodejs
wget https://nodejs.org/dist/v10.16.2/node-v10.16.2-linux-x64.tar.xz
tar xvf node-v10.16.2-linux-x64.tar.xz -C /usr/local/
echo 'export PATH=/usr/local/node-v10.16.2-linux-x64/bin:$GOPATH/bin:$PATH' >> /etc/profile
npm install elasticdump -g
2.获取所有的索引 (10分钟)
curl -u elastic:'ES&ceshi720' 172.30.0.17:9200/_cat/indices >/tmp/indecies.txt
cat /tmp/indecies.txt |awk '{print $3}' >/tmp/all_indeciex.txt
3备份 (20G数据预计3个小时)
执行备份脚本/tmp/backup_es.sh备份
cat /tmp/backup_es.sh
#!/bin/bash
mkdir -p /mnt//
for indecies in `cat /tmp/all_indeciex.txt`
do
/usr/local/node-v10.16.2-linux-x64/bin/elasticdump --httpAuthFile=/tmp/a.txt --input=http://172.30.0.17:9200/$indecies --output=/mnt/030901/${indecies}data.json --type=data
/usr/local/node-v10.16.2-linux-x64/bin/elasticdump --httpAuthFile=/tmp/a.txt --input=http://172.30.0.17:9200/$indecies --output=/mnt/030901/${indecies}mapping.json --type=mapping
/usr/local/node-v10.16.2-linux-x64/bin/elasticdump --httpAuthFile=/tmp/a.txt --input=http://172.30.0.17:9200/$indecies --output=/mnt/030901/${indecies}settings.json --type=settings
/usr/local/node-v10.16.2-linux-x64/bin/elasticdump --httpAuthFile=/tmp/a.txt --input=http://172.30.0.17:9200/$indecies --output=/mnt/030901/${indecies}analyzer.json --type=analyzer
done
4.恢复 (预计2个小时)
执行恢复脚本/tmp/restore_es.sh恢复
cat /tmp/restore_es.sh
#!/bin/bash
for indecies in `cat /tmp/all_indeciex.txt`
do
elasticdump --input=/mnt//${indecies}settings.json --output=http://10.0.0.7:9200/$indecies --type=settings
elasticdump --input=/mnt//${indecies}mapping.json --output=http://10.0.0.7:9200/$indecies --type=mapping
#elasticdump --input=/mnt//${indecies}analyzer.json --output=http://10.0.0.7:9200/$indecies --type=analyzer
elasticdump --input=/mnt//${indecies}data.json --output=http://10.0.0.7:9200/$indecies --type=data
done
elasticsearch备份脚本的更多相关文章
- 分享一个MySQL分库分表备份脚本(原)
分享一个MySQL分库备份脚本(原) 开发思路: 1.路径:规定备份到什么位置,把路径(先判断是否存在,不存在创建一个目录)先定义好,我的路径:/mysql/backup,每个备份用压缩提升效率,带上 ...
- 修改sys密码与nbu备份脚本密码后,nbu备份报密码无效
公司要求口令强化,在修改sys密码后nbu的.sh脚本connect备份归档的sys/passwd也随之修改修改后每个业务备份均失败, 每次备份到归档那里就结束报密码无效,疑惑备份脚本密码也同步修改了 ...
- Python数据库备份脚本
Python数据库备份脚本 #!/usr/bin/env python # author: liudong # -*- coding: utf-8 -*- # filename: db_bak.py ...
- 一个简单的RMAN自动备份脚本
rman备份脚本: #!/bin/bashsource /home/oracle/.bash_profile rman target / << EOFrun {allocate chann ...
- Windows环境下Oracle数据库的自动备份脚本
批处理文件(.bat) @echo off echo ================================================ echo Windows环境下Oracle数据 ...
- Oracle自动备份脚本(网上找到的资料)
废话不多说了,直接给大家贴代码了,具体代码如下所示: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 ...
- LINUX 自动备份脚本文件
首先我在/root/backup 目录下建立一个文件夹, #mkdir /root/backup/mysqlbackup 以后在每天五点钟,就会有一个文件保存在这里. 接着新建文件 #vim /roo ...
- Windows的Subversion备份脚本
2015-12-08更新:备份时添加--revision head 只备份最新的版本,已从脚本中移除. 2013-12-09更新:forfiles命令添加错误输出日志. 2013-12-04更新:添加 ...
- centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobackupex/Xtrabackup 第四十节课
centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobacku ...
随机推荐
- 分布式文件系统FastDFS架构认知
FastDFS是一款类Google FS的开源分布式文件系统(应用级的分布式文件存储服务). FastDFS的设计理念 FastDFS是为互联网应用量身定做的分布式文件系统,充分考虑了冗余备份.负载均 ...
- EF 多表联查方法
两个表的linq private DataContext dc; dc = new DataContext(); var heji = (from da in dc.q1 ...
- Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) B2. TV Subscriptions (Hard Version)
链接: https://codeforces.com/contest/1247/problem/B2 题意: The only difference between easy and hard ver ...
- 4、获取Class中的构造函数
4.获取Class中的构造函数 4.1 早期创建对象 早期创建对象,先根据被new的类的名称找寻该类的字节码文件,并加载进内存,并创建该字节码文件对象,并接着创建该接文件的对应的Person对象 co ...
- 事务日志已满 请参阅sys.databases中的log_reuse_wait_desc列解决办法
http://www.myexception.cn/sql-server/153219.html http://blog.csdn.net/kedingboy12345/article/details ...
- js批量下载文件
关于兼容性问题: <a href="xxx.docx" target='_blank'></a> 下载文件时,这种写法是没有兼容性问题:但是下载图 ...
- 牛客练习赛53 (E 老瞎眼 pk 小鲜肉) 线段树+离线
考试的时候切的,类似HH的项链~ code: #include <bits/stdc++.h> #define ll long long #define M 500003 #define ...
- 校庆神秘建筑(HDU 1411)
Problem 杭州电子科技大学即将迎来50周年的校庆,作为校庆委员会成员的我被上级要求设计一座神秘的建筑物来迎合校庆,因此我苦思冥想了一个月,终于设计出了一套方案,这座建筑物有点象古老埃及的金字塔, ...
- c isnormal
Returns whether x is a normal value: i.e., whether it is neither infinity, NaN, zero or subnormal. / ...
- shell 显示详细信息
MacdeMacBook-Pro:test macname$ ls -al | more total drwxr-xr-x macname staff : . drwxr-xr-x+ macname ...