elasticsearch-head-master安装和Logstash安装使用

由于head插件本质上还是一个nodejs的工程,因此需要安装node,使用npm来安装依赖的包。

wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz

下载nodejs包

修改配置文件并生效 root账户下

vim /etc/profile

export NODE_HOME=/usr/local/node

export PATH=$PATH:$NODE_HOME/bin

source /etc/profile

能正确查询版本

 

下载head插件

如果未安装git ,则先安装git工具 

yum install –y git

git clone https://github.com/mobz/elasticsearch-head.git

安装grunt

cd elasticsearch-head

npm install -g grunt --registry=https://registry.npm.taobao.org

 

在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行:

npm install grunt --save 

修改配置 elasticsearch-head下Gruntfile.js文件

修改connect配置节点

 

 

 

修改 _site/app.js 修改http://localhost:9200字段到本机ES端口与IP

 修改elasticsearch.yml文件加入以下内容:

# 是否支持跨域

http.cors.enabled: true

 

# *表示支持所有域名

http.cors.allow-origin: "*"

 

 

运行elasticsearch-head-master 
先启动elasticsearch
进入elasticsearch-head-master,执行npm install (可能phantomjs耗时较长)
最后启动nodejs:

elasticsearch-head/node_modules/grunt/bin下执行

 grunt server

 

Logstash安装 在elasticserach下载相应的包版本保持一致

解压后即可运行 ./bin/logstash -f wenjian.conf  

运行自己编写的conf文件 index等信息不能大写

 

编写的一个导入csv 的文档

input{

  file{

    path => ["/home/hadoop01/Downloads/data/tb_coal_cctdprice_w.csv"]

    type => "tb_coal_cctdprice_w"

start_position => "beginning"

codec =>plain{//设置输入文件编码解决中文乱码情况

    charset =>'GB2312'

   }

  }

}

 

filter{

 

}

 

output{

  elasticsearch{

    hosts => ["127.0.0.1:9200"]

    index => "tb_coal_cctdprice_w"

  }

}

索引名 必须小写

 

 

转载于:https://my.oschina.net/u/3322291/blog/3077113

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值