由于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"
}
}
索引名 必须小写