zoukankan      html  css  js  c++  java
  • CentOS 7 es搭建测试

    搭建本地yum repo

    pass
    

    指定特定repo 安装,比如安装wget。(指定特定repo 是为了从最快的repo安装)

    yum --disablerepo=* --enablerepo=os install wget
    

    安装 EPEL

    wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -ivh epel-release-latest-7.noarch.rpm
    

    安装JDK 8,配置JAVA_HOME

    pass
    

    安装es,启动

    pass
    nohup ./elasticsearch --cluster.name sflow --node.name sflow1 &
    

    准备数据,数据格式如下:

    TAG,SRC_MAC,DST_MAC,VLAN,COS,IN_IFACE,OUT_IFACE,SRC_IP,DST_IP,SRC_MASK,DST_MASK,SRC_PORT,DST_PORT,PROTOCOL,PACKETS,BYTES
    10019,52:54:00:6f:d0:9e,52:54:00:58:86:ec,2662,31,3,2,42.120.83.55,42.120.83.125,24,24,15113,17359,ipv6-route,12,2070
    10084,52:54:00:04:bd:01,52:54:00:18:dc:b2,1122,81,2,3,42.120.85.119,42.120.85.196,24,24,12110,14868,rsvp,19,4404
    

    创建index,index设计如下

    index name 格式为 "sflow_routerIP_interfaceID_direction"

    • 统一前缀可以跨indices调用
    • 一个index存储一个interface的一个方向,缩小单个index的数据量

    mapping设计

    • not_analyzed 目的是可以精确匹配,不计算score,提升速度。(ES 是全文搜索引擎,默认模糊匹配并且计算匹配score)
    • 增加IP_PAIRE 字段对应 SRC_IP+DST_IP。目的是测试不同方式多字段聚合效率(对比script方式)

    template设计

    • 把mapping 放入template
    • 统一前缀(sflow_)的 index将自动采用template

    template如下:

    curl -XPUT localhost:9200/_template/template_sflow -d '
    {
    	"template" : "sflow_*",
    	"mappings" : {
    			"sflow" : {
    				"properties" : {
    					"@timestamp": { "index": "analyzed", "type": "date" },
    					"SRC_MAC" : { "type" : "string", "index" : "not_analyzed"},
    					"DST_MAC" : { "type" : "string", "index" : "not_analyzed"},
    					"IP_PAIRE" : { "type" : "string", "index" : "not_analyzed"},
    					"SRC_IP" : { "type" : "ip", "index" : "not_analyzed"},
    					"DST_IP" : { "type" : "ip", "index" : "not_analyzed"},
    					"SRC_PORT" : { "type" : "integer", "index" : "not_analyzed"},
    					"DST_PORT" : { "type" : "integer", "index" : "not_analyzed"},
    					"VLAN" : { "type" : "integer", "index" : "not_analyzed" },
    					"PROTOCOL" : { "type" : "string", "index" : "not_analyzed" },
    					"BYTES" : { "type" : "long", "index" : "not_analyzed" },
    					"PACKETS" : { "type" : "long", "index" : "not_analyzed" }
    				}
    			}
    		}
    }
    '
    

    导入数据

    pass
    

    查询曲线

    1. 某端口,某方向,一段时间曲线

    2. 某端口,某方向,某tag,一段时间曲线

    3. 某端口,某方向,多tag,一段时间曲线

    4. 一组端口,某方向,一段时间曲线

    5. 一组端口,某方向,某tag,一段时间曲线

    6. 一组端口,某方向,多tag,一段时间曲线

    查询topN

    1. 某端口,某方向,某tag,一段时间topN

    2. 某端口,某方向,多tag,一段时间topN

    3. 一组端口,某方向,某tag,一段时间topN

    4. 一组端口,某方向,多tag,一段时间topN

    查询某个点的time series data

    删除数据

    1. 删除某端口某段时间
    2. 删除某组端口某段时间
    3. 删除某个index
    4. 删除某组index
  • 相关阅读:
    Base64编码原理分析
    对 js 高程 Preflighted Reqeusts 的理解
    js 跨域 之 修改服务器配置-XAMPP-Apache (nginx 拉到最后!)
    js 模拟 select 的 click 事件
    串讲-解释篇:作用域,作用域链,执行环境,变量对象,活动对象,闭包
    js 匿名函数-立即调用的函数表达式
    Java I/O流输入输出,序列化,NIO,NIO.2
    Java8Lambda表达式
    设计模式之适配器模式
    设计模式之装饰器设计模式
  • 原文地址:https://www.cnblogs.com/kramer/p/5165911.html
Copyright © 2011-2022 走看看