1. 安装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备份脚本的更多相关文章

  1. 分享一个MySQL分库分表备份脚本(原)

    分享一个MySQL分库备份脚本(原) 开发思路: 1.路径:规定备份到什么位置,把路径(先判断是否存在,不存在创建一个目录)先定义好,我的路径:/mysql/backup,每个备份用压缩提升效率,带上 ...

  2. 修改sys密码与nbu备份脚本密码后,nbu备份报密码无效

    公司要求口令强化,在修改sys密码后nbu的.sh脚本connect备份归档的sys/passwd也随之修改修改后每个业务备份均失败, 每次备份到归档那里就结束报密码无效,疑惑备份脚本密码也同步修改了 ...

  3. Python数据库备份脚本

    Python数据库备份脚本 #!/usr/bin/env python # author: liudong # -*- coding: utf-8 -*- # filename: db_bak.py ...

  4. 一个简单的RMAN自动备份脚本

    rman备份脚本: #!/bin/bashsource /home/oracle/.bash_profile rman target / << EOFrun {allocate chann ...

  5. Windows环境下Oracle数据库的自动备份脚本

    批处理文件(.bat) @echo off echo ================================================ echo  Windows环境下Oracle数据 ...

  6. 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 ...

  7. LINUX 自动备份脚本文件

    首先我在/root/backup 目录下建立一个文件夹, #mkdir /root/backup/mysqlbackup 以后在每天五点钟,就会有一个文件保存在这里. 接着新建文件 #vim /roo ...

  8. Windows的Subversion备份脚本

    2015-12-08更新:备份时添加--revision head 只备份最新的版本,已从脚本中移除. 2013-12-09更新:forfiles命令添加错误输出日志. 2013-12-04更新:添加 ...

  9. centos shell编程6一些工作中实践脚本 nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志 直接送给bc做计算 gzip innobackupex/Xtrabackup 第四十节课

    centos   shell编程6一些工作中实践脚本   nagios监控脚本 自定义zabbix脚本 mysql备份脚本 zabbix错误日志  直接送给bc做计算  gzip  innobacku ...

随机推荐

  1. 3、Spring Boot 2.x 核心技术

    1.3 Spring Boot 核心技术 1.3.1 起步依赖 为项目的依赖管理提供帮助.起步依赖其实就是特殊的Maven,利用了传递依赖解析,把常用库聚合在一起,组成几个为特定功能而定制的依赖. 1 ...

  2. P4136 谁能赢呢? 脑子

    思路:脑子(教练说是博弈论?) 提交:1次 题解: 结论:若\(n\)为奇数后手胜,若\(n\)为偶数先手胜. 大致证明: 我们发现,若我们把棋盘黑白染色并设左上角为黑色,那么显然有:若\(n\)为奇 ...

  3. P4568 [JLOI2011]飞行路线 分层图最短路

    思路:裸的分层图最短路 提交:1次 题解: 如思路 代码: #include<cstdio> #include<iostream> #include<cstring> ...

  4. STS创建spring boot项目,pom.xml文件第一行报错

    亲测能用url地址:https://blog.csdn.net/jrx1995/article/details/100008552

  5. 帝国CMS 7.2-插件包整合

    版权所有 2009-2019 荆门泽优软件有限公司 保留所有权利 官方网站:http://www.ncmem.com/index.aspx 产品首页:http://www.ncmem.com/weba ...

  6. 23333 又是一篇水文章(以下是各种复制来的关于maven转成eclipse项目)

    (转载) 当我们通过模版(比如最简单的maven-archetype-quikstart插件)生成了一个maven的项目结构时,如何将它转换成eclipse支持的java project呢? 1. 定 ...

  7. 【线性代数】6-3:微分方程的应用(Applications to Differential Equations)

    title: [线性代数]6-3:微分方程的应用(Applications to Differential Equations) categories: Mathematic Linear Algeb ...

  8. 关于lda算法的一个博客

    http://www.cnblogs.com/LeftNotEasy/archive/2011/01/08/lda-and-pca-machine-learning.html

  9. Luogu5339 [TJOI2019]唱、跳、rap和篮球 【生成函数,NTT】

    当时看到这道题的时候我的脑子可能是这样的: My left brain has nothing right, and my right brain has nothing left. 总之,看到&qu ...

  10. Maxim-可自定义的Monkey测试工具(Android)

    Maxim 基于monkey做的二次开发,相比原始monkey,新增如下功能 多种随机测试模式:dfs(深度遍历) mix模式(monkey随机测试+控件识别) troy模式(按照控件选择器进行遍历) ...