赞
踩
Elasticsearch+Fluentd+Kibana的日志收集分析系统
安装步骤略过。
关闭防火墙:
/etc/init.d/iptables stop
/etc/init.d/iptables stop
chkconfig iptables off
chkconfig --list|grep ipt
su –root
命令:rpm –qa | grep java
Rpm –e –nodeps jdk名称(名称是上面显示的名称)
cd /usr
mkdir java
使用yum的rz,或者其他工具
tar –zxvf jdk压缩包名称
ln –s /usr/java/解压的包名 /usr/jdk
vi /etc/profile
在最下面添加
export JAVA_HOME=/usr/jdk export PATH=$PATH:$JAVA_HOME/bin export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export JAVA_HOME PATH CLASSPATH |
source /etc/profile
curl -L https://toolbelt.treasuredata.com/sh/install-redhat-td-agent2.sh| sh
/etc/init.d/td-agent status
上面都显示ok时,表示安装完成
curl -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.1.tar.gz
tar zxvf elasticsearch-1.7.1.tar.gz
cd elasticsearch-1.7.1/
./bin/elasticsearch
启动出现Name or servicenot known异常
解决方案:修改vi/etc/sysconfig/network中的
添加服务路径
在启动步报错
./elasticsearch-1.7.1/bin/plugin installlmenezes/elasticsearch-kopf/1.0
./elasticsearch-1.7.1/bin/elasticsearch
访问路径:http://192.168.56.154:9200/
出现效果:
在访问插件效果:http://192.168.56.154:9200/_plugin/head/
./elasticsearch console ------前台运行
./elasticsearch start ------后台运行
./elasticsearch install -------添加到系统自动启动
./elasticsearch remove -----取消随系统自动启动
curl -Ohttps://download.elastic.co/kibana/kibana/kibana-4.1.4-linux-x64.tar.gz
tar zxvf kibana-4.1.4-linux-x64.tar.gz
cd kibana-4.1.4-linux-x64/
./bin/kibana
注意:kibana只是一个前端展示平台需要es作为数据源,所以在启动ka的之前请确认es的连接地址是否正确!
./kibana-4.1.4-linux-x64/config/kibana.yml
# The host to bind the server to.
host: "0.0.0.0"
# The Elasticsearch instance to use for allyour queries.
elasticsearch_url:"http://localhost:9200"
后面还是进行三大软件的联系配置
/usr/sbin/td-agent-gem installfluent-plugin-elasticsearch
/usr/sbin/td-agent-gem installfluent-plugin-typecast
/usr/sbin/td-agent-gem installfluent-plugin-secure-forward
虚机101centos6.5:nginx所在服务器,es,fd,ka 所在服务器 client agent
虚机102centos6.5 :fd及插件所在服务器server agent,负责文件存储nginx日志,并转发101es存储
/etc/td-agent/td-agent.conf
<source> type tail path /var/log/nginx/access.log format /^(?<remote>[^ ]*) - - (?<time>[^ ]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*) +\S*)?" (?<status>[^ ]*) (?<body_bytes_sent>[^ ]*) "(?<http_referer>[^\"]*)" ClientVersion "(?<clientVersion>[^ ]*)" "(?<userAgent>[^\"]*)" "(?<remoteHost>[^ ]*)" "(?<http_x_forwarded_for>[^\"]*)" upstream_response_time "(?<upstream_response_time>[^ ]*)" request_time "(?<request_time>[^ ]*)"\s$/ time_format %d/%b/%Y:%H:%M:%S %z types remote:ip,time:time,method:string,path:string,status:integer:body_bytes_sent:integer,http_referer:string,userAgent:string,remoteHost:string,http_x_forwarded_for:string,upstream_response_time:string,request_time:float tag 101nginx.access.log pos_file /var/log/td-agent/pos/nginx.access.log.pos </source> |
<match
<server> host 10.22.205.102 port 24224 </server> </match> |
/etc/td-agent/td-agent.conf
<store> type elasticsearch host 10.22.205.101 port 9200 include_tag_key true tag_key @log_name logstash_format true flush_interval 10s </store |
这里102对匹配到的日志做了2个操作:(1). 以时间文件夹路径本地存储nginx日志 (2). 转发获得的日志到101的es上。
/etc/init
.d/td-agent restart
修改借鉴于:
http://blog.csdn.net/ebw123/article/details/46707559
http://blog.csdn.net/shiwenqing/article/details/50475330
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。