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 ...
随机推荐
- inline-block默认间距
inline-block元素默认会有间距 解决方法之移除空格 元素间留白间距出现的原因就是标签段之间的空格,因此,去掉HTML中的空格,自然间距就木有了.考虑到代码可读性,显然连成一行的写法是不可 ...
- BZOJ 2229 / Luogu P3329 [ZJOI2011]最小割 (分治最小割板题)
题面 求所有点对的最小割中<=c的数量 分析 分治最小割板题 首先,注意这样一个事实:如果(X,Y)是某个s1-t1最小割,(Z,W)是某个s2-t2最小割,那么X∩Z.X∩W.Y∩Z.Y∩W这 ...
- this绑定问题
this是属性和方法“当前”(运行时)所在的对象.this是函数调用时发生的绑定,它的值只取决于调用位置(箭头函数除外). 函数调用的时候会产生一个执行上下文,this是对这个执行上下文的记录. ❌误 ...
- VS2012 Update 2: 0x80040154 corrupt install when starting the debugger
使用VS2012開發console program ,发现生成32位的exe文件在別的机上不能正确运行,有文章說update1可以解決這個問題,如下 Setup.exe is not a valid ...
- LibreOJ #102. 最小费用流
二次联通门 : LibreOJ #102. 最小费用流 /* LibreOJ #102. 最小费用流 Spfa跑花费 记录路径 倒推回去 */ #include <cstring> #in ...
- element-ui下拉按钮的用法
<el-dropdown class="avatar-container" trigger="click"> <div class=" ...
- vue 路由跳转记住当前页面位置
从列表页面跳去详情页面, 在列表页面的生命周期:deactivated 中把当前的scrollTop位置存下来,可以存在localstorage中,也可以存在vuex中, 从详情页面返回列表页面:a ...
- JAVA基础知识|反射
一.理解反射 1.1.基础概念 反射:在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意方法和属性:这种动态获取信息以及动态调用对象方法的功能称为ja ...
- ORM SQLAlchemy - 基本关系模式
1 一对多 一个parent对多个child,一对多关系添加一个外键到child表,用于保存对应parent.id的值,引用parent.relationship()在parent中指定,引用/保存 ...
- 第11组 Beta冲刺(3/5)
第11组 Beta冲刺(3/5) 队名 不知道叫什么团队 组长博客 https://www.cnblogs.com/xxylac/p/12006665.html 作业博客 https://edu. ...