[elk]elasticsearch dashboard+保留10天内索引+导入导出备份
es dashboard
有两款
- head 这款我一直在用
https://github.com/mobz/elasticsearch-head
先修改es的配置文件: elasticsearch.yml追加
http.cors.enabled: true
http.cors.allow-origin: "*"
docker run -d -v /etc/localtime:/etc/localtime --restart=always -p 9100:9100 mobz/elasticsearch-head:5
- elasticsearch-HQ这款相对好看点
https://github.com/royrusso/elasticsearch-HQ

docker run -d \
--net=host \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-v /root/elasticsearch-HQ/royrusso-elasticsearch-HQ-eb117d4:/usr/share/nginx/html \
--name nginx \
es数据保留10天以内
#!/bin/bash
###################################
#删除早于十天的ES集群的索引
###################################
function delete_indices() {
comp_date=`date -d "10 day ago" +"%Y-%m-%d"`
date1="$1 00:00:00"
date2="$comp_date 00:00:00"
t1=`date -d "$date1" +%s`
t2=`date -d "$date2" +%s`
if [ $t1 -le $t2 ]; then
echo "$1时间早于$comp_date,进行索引删除"
#转换一下格式,将类似2017-10-01格式转化为2017.10.01
format_date=`echo $1| sed 's/-/\./g'`
curl -XDELETE http://192.168.x.x:9200/*$format_date
fi
}
curl -XGET http://192.168.x.x:9200/_cat/indices | awk -F" " '{print $3}' | awk -F"-" '{print $NF}' | egrep "[0-9]*\.[0-9]*\.[0-9]*" | sort | uniq | sed 's/\./-/g' | while read LINE
do
#调用索引删除函数
delete_indices $LINE
done
es数据备份: elasticsearch-dump
https://github.com/taskrabbit/elasticsearch-dump
- 安装
npm install elasticdump
./bin/elasticdump
- 使用
支持导出文件
支持导出文件压缩
支持导出后直接导入到另一个stage escluster
elasticdump --help
# Backup index data to a file:
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=/data/my_index_mapping.json \
--type=mapping
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=/data/my_index.json \
--type=data
# Backup and index to a gzip using stdout:
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=$ \
| gzip > /data/my_index.json.gz
# Backup the results of a query to a file
elasticdump \
--input=http://production.es.com:9200/my_index \
--output=query.json \
--searchBody '{"query":{"term":{"username": "admin"}}}'
1g的日志不到四五分钟就导完毕: 从一个集群到另一个集群

[elk]elasticsearch dashboard+保留10天内索引+导入导出备份的更多相关文章
- (转)开源分布式搜索平台ELK(Elasticsearch+Logstash+Kibana)入门学习资源索引
Github, Soundcloud, FogCreek, Stackoverflow, Foursquare,等公司通过elasticsearch提供搜索或大规模日志分析可视化等服务.博主近4个月搜 ...
- 开源分布式搜索平台ELK(Elasticsearch+Logstash+Kibana)入门学习资源索引
from: http://www.w3c.com.cn/%E5%BC%80%E6%BA%90%E5%88%86%E5%B8%83%E5%BC%8F%E6%90%9C%E7%B4%A2%E5%B9%B ...
- (4.10)sql server导入导出
SQL Server快速导入数据分享 核心参考:官网~~https://docs.microsoft.com/zh-cn/sql/relational-databases/import-export/ ...
- ELK学习总结(4-1)elasticsearch更改mapping(不停服务重建索引)
elasticsearch更改mapping(不停服务重建索引)原文 http://donlianli.iteye.com/blog/1924721Elasticsearch的mapping一旦创建, ...
- 使用ELK(Elasticsearch + Logstash + Kibana) 搭建日志集中分析平台实践--转载
原文地址:https://wsgzao.github.io/post/elk/ 另外可以参考:https://www.digitalocean.com/community/tutorials/how- ...
- CentOS 6.x ELK(Elasticsearch+Logstash+Kibana)
CentOS 6.x ELK(Elasticsearch+Logstash+Kibana) 前言 Elasticsearch + Logstash + Kibana(ELK)是一套开源的日志管理方案, ...
- Elasticsearch核心技术(四):索引原理分析
本文探讨Elasticsearch的数据请求.路由和写入过程的原理,主要涉及ES的分布式存储架构.节点和副本的写入过程.近实时搜索的原因.持久化机制等. 4.1 ES存储架构 我们经常说,看一件事情千 ...
- Elasticsearch从入门到放弃:索引基本使用方法
前文我们提到,Elasticsearch的数据都存储在索引中,也就是说,索引相当于是MySQL中的数据库.是最基础的概念.今天分享的也是关于索引的一些常用的操作. 创建索引 curl -X PUT & ...
- Elasticsearch系列---实战零停机重建索引
前言 我们使用Elasticsearch索引文档时,最理想的情况是文档JSON结构是确定的,数据源源不断地灌进来即可,但实际情况中,没人能够阻拦需求的变更,在项目的某个版本,可能会对原有的文档结构造成 ...
随机推荐
- 解决HUE报错MultipleObjectsReturned: get() returned more than one Document2 -- it returned 2!
表现:界面上报错:,刚登陆进去就能看到,点击执行也会出现.日志里报: Traceback (most recent call last): File "/home/work/hue-3.10 ...
- JS是否存在方法重载
java里面是存在重载的,那么js中呢?这个问题面试的时候会经常遇到.但是可以肯定的说,js中是不存在重载的,但是我们可以通过其他的方式来模拟重载,我们可以通过argument方法来实现. argum ...
- Latex中为作者添加多个单位属性(IEEE模板)
\author{ \IEEEauthorblockN{name1 name1\IEEEauthorrefmark{1}\IEEEauthorrefmark{2}, name2 name2\IEEEa ...
- 8.volatile原子性
原子性 1.一个操作是不可中断的,即使多个线程在一起执行的时候,一旦操作执行开始,就不会被其他的线程干扰执行并导致执行中断. 2.对于静态变量int ,2个线程同时对它进行修改,线程a ...
- Power Desginer系列02【转载】
在概念模型中主要有以下几个操作和设置的对象:实体(Entity).实体属性 (Attribute).实体标识(Identifiers).关系(Relationship).继承(Inheritance) ...
- Android -- ListView与Adapter
ListView在Android中有着很重要的作用.Android开发中ListView是比较常用的组件,它以列表的形式展示具体内容,并且能够根据数据的长度自适应显示. 背景 ...
- Deep Learning论文笔记之(一)K-means特征学习
Deep Learning论文笔记之(一)K-means特征学习 zouxy09@qq.com http://blog.csdn.net/zouxy09 自己平时看了一些论文,但老感 ...
- 利用MyEclipse开发一个调用webservice接口的程序
上一篇文章我们已经学习了如何使用Java 工具MyEclipse开发一个webservice接口,那么接口开发好了如何调用?接下来我们就来解决这个问题. 1:首先随便创建一个Java project选 ...
- (剑指Offer)面试题41:和为s的两个数字
题目: 输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s,如果有多对数字的和等于s,输出任意一对即可. 思路: 1.枚举 固定一个数字,然后依次判断数组中该数字后面的数字与 ...
- android-关于友盟的自动版本更新(面向小白)
今天说一下关于友盟的自动版本更新(傻瓜式版本更新) 关于自动更新的话,如果让android程序猿自己写的话还是不是那么简单的(对于我这个菜鸟来说...),又要检查当前版本,又要在服务器存储新的版本,又 ...