beat --------  kafka -------- logstash---------------elasticsearch--------------kibana

beat配置文件

[root@varnish1 filebeat-5.5.-linux-x86_64]# grep -v "#" filebeat.yml  | sed '/^$/d'
filebeat.prospectors:
- input_type: log
paths:
- /data/*.log
tags: ["haproxy-log"]
output.kafka:
enabled : true
hosts: ["kafka1:9092","kafka2:9092","kafka3:9092"]
topic: logostash-%{[type]}
[root@varnish1 filebeat-5.5.0-li

logstash配置文件

[root@logstashserver etc]# cat logstash.conf
input {
kafka {
bootstrap_servers => "kafka1:9092,kafka2:9092,kafka3:9092"
topics => ["logostash-log"]
consumer_threads =>
decorate_events => true
}
} filter {
grok{
patterns_dir => "/data/logstash/patterns"
match => {"message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{IPORHOST:syslog_server} %{SYSLOGPROG}: %{IP:client_ip}:%{INT:client_port} \[%{HAPROXYDATE:accept_date}\] %{NOTSPACE:frontend_name} %{NOTSPACE:backend_name}/%{NOTSPACE:server_name} %{INT:time_request}/%{INT:time_queue}/%{INT:time_backend_connect}/%{INT:time_backend_response}/%{NOTSPACE:time_duration} %{INT:http_status_code} %{NOTSPACE:bytes_read} %{FENG:captured_request_cookie} %{FENG:captured_response_cookie} %{NOTSPACE:termination_state} %{INT:actconn}/%{INT:feconn}/%{INT:beconn}/%{INT:srvconn}/%{NOTSPACE:retries} %{INT:srv_queue}/%{INT:backend_queue} \"%{WORD:verb} %{URIPATHPARAM:request} %{WORD:http_socke}/%{NUMBER:http_version}\""}
}
geoip {
source => "client_ip"
fields => ["ip","city_name","country_name","location"]
add_tag => [ "geoip" ]
}
} output {
elasticsearch {
hosts => ["es1:9200","es2:9200","es3:9200"]
manage_template => true
index => "logstash-feng.log-%{+YYYY-MM-dd}"
}
}

在es1上操作:

下载elasticsearch5.5安装:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.tar.gz

解压:

tar -zxvf elasticsearch-5.5.0.tar.gz

mv elasticsearch-5.5.0   elasticsearch

接下来创建el用户,因为elasticsearch不允许以root运行(其实也可以运行,需要配置)。

1.设置虚拟 –Xms  -Xmx 内存大小

vim  /data/elasticsearch/config/jvm.options

2.设置虚拟内存

echo “vm.max_map_count=262144” >> /etc/sysctl.conf

3.关闭swap分区

Swapoff –a

修改配置文件fstab

#/dev/mapper/centos-swap swap           swap    defaults        0 0

4.设置elastrisearch用户名密码

useradd es

passwd es

5. 需要修改
/etc/security/limits.conf 
es soft memlock unlimited
es hard memlock unlimited

6.修改:
/etc/sysctl.conf 
vm.swappiness=0

之后重启机器

chown -R es:es /data/elasticsearch

su - es

cd elasticsearch/conf/

修改配置文件:

vim elasticsearch.yml

cluster.name: senyint_elasticsearch
node.name: es1
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/logs
bootstrap.memory_lock: false
network.host: 192.168.99.8
http.port:
discovery.zen.ping.unicast.hosts: ["es1", "es2", "es3"]
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.security.enabled: false  #安装x-pack 插件使用

安装X-Pack

在5.x版本中一些es插件(Shield, Watcher, Marvel, Graph, Reporting)都集成在x-pack组件中

在Es的根目录(每个节点),运行 bin/elasticsearch-plugin进行安装

bin/elasticsearch-plugin install x-pack

安装head插件:

#elasticsearch-head 不能放置在 /data/elasticsearch/plugins/目录下,否者报错

cd /data/elasticsearch/

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

root用户

cd /data/

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

xz -d node-v6.11.1-linux-x64.tar.xz

tar -xf node-v6.11.1-linux-x64.tar

vi /etc/profile

export NODE_HOME=/data/node-v6.11.1-linux-x64

export PATH=${PATH}:${NODE_HOME}/bin

source /etc/profile

su -  es

cd /data/elasticsearch/elasticsearch-head/

npm install

vim /data/elasticsearch/elasticsearch-head/Gruntfile.js

vim /data/elasticsearch/elasticsearch-head/_site/app.js

启动elasticsearch

su - es

/data/elasticsearch/bin/elasticsearch  -d

启动 grunt

cd   /data/elasticsearch/plugins/elasticsearch-head/node_modules/grunt/bin

#  nohup ./grunt  server  &

访问 http://192.168.99.9:9100

安装kibana

Kibana是一个强大的es图形化组件,可以通过http的方式来查看es集群的状态,操作数据等.

当前es官方推荐的拓展组件为Kibana和X-Pack,而X-Pack需要依赖于Kibana.

下载地址:https://artifacts.elastic.co/downloads/kibana/kibana-5.5.0-linux-x86_64.tar.gz

选择任意一台es节点安装kibana

vim config/kibana.yml
server.port:
server.host: "192.168.10.116"
elasticsearch.url: "http://192.168.99.8:9200"
xpack.security.enabled: false 

在Kibana根目录运行 bin/kibana-plugin 进行安装

bin/kibana-plugin install x-pack

启动Kibana

启动之前需要禁用X-Pack 插件 security

vim config/kibana.yml

vim config/elasticsearch.yml

添加以下内容

xpack.security.enabled: false     #重要

nginx 日志格式

    log_format logstash_json '{ "@timestamp": "$time_local", '
'"client": "$remote_addr", '
'"hostname": "$hostname", '
'"remote_user": "$remote_user", '
'"upstream_addr": "$upstream_addr", '
'"upstream_response_time": "$upstream_response_time", '
'"body_bytes_sent": "$body_bytes_sent", '
'"request_time": "$request_time", '
'"status": "$status", '
'"request": "$request", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"body_bytes_sent":"$body_bytes_sent", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"http_user_agent": "$http_user_agent" }'; access_log logs/access.log logstash_json;

filebeat 部署在nginx服务器上,收集日志

filebeat.prospectors:
- input_type: log
paths:
- /data/nginx/logs/access.log
document_type: nginx_access
output.kafka:
enabled : true
hosts: ["kafka1:9092","kafka2:9092","kafka3:9092"]
topic: logostash_%{[type]}

logstash 从kafka订阅消息,并存储到es中配置文件

input {
kafka {
bootstrap_servers => "kafka1:9092,kafka2:9092,kafka3:9092"
topics => ["logostash__nginx_access"]
consumer_threads =>
decorate_events => true
codec => "json"
}
} filter {
json {
remove_field => ["@timestamp","beat","type","kafka","domain","serverip","url","@version","offset","input_type","count","source","fields","beat.hostname","host","tags"]
source => "message"
remove_field => ["message"]
} } output {
elasticsearch {
hosts => ["es1:9200","es2:9200","es3:9200"]
manage_template => true
index => "logstash-nginx.log-%{+YYYY-MM-dd}"
}
}

elasticsearch5.5安装的更多相关文章

  1. windows 7 下elasticsearch5.0 安装head 插件

    windows 7 下elasticsearch5.0 安装head 插件 elasticsearch5.0 和2有了很大的变化,以前的很多插件都有了变化比如 bigdesk head,以下是安装he ...

  2. Elasticsearch5.0 安装问题集锦【转】

    转自 Elasticsearch5.0 安装问题集锦 - 代码&优雅着&生活 - 博客园http://www.cnblogs.com/sloveling/p/elasticsearch ...

  3. 【转】Elasticsearch5.0 安装问题集锦

    Elasticsearch5.0 安装问题集锦 elasticsearch 5.0 安装过程中遇到了一些问题,通过查找资料几乎都解决掉了,这里简单记录一下 ,供以后查阅参考,也希望可以帮助遇到同样问题 ...

  4. Elasticsearch5.6安装

    Elasticsearch5.6安装 1.下载 5.6.8 sudo curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/e ...

  5. ElasticSearch5.3安装IK分词器并验证

    ElasticSearch5.3安装IK分词器 之前使用Elasticsearch安装head插件成功了,但是安装IK分词器却失败了.貌似是ElasticSearch5.0以后就不支持直接在elast ...

  6. Elasticsearch5.0 安装问题集锦

    使用Elasticsearch5.0 必须安装jdk1.8 [elsearch@vm-mysteel-dc-search01 bin]$ java -version java version &quo ...

  7. ElasticSearch-5.0安装head插件

    环境 Windows10企业版X64 JDK-1.8 ElasticSearch-5.0.0 node-v4.5.0-x64.msi git客户端 步骤 安装node到D盘.如D:\nodejs. 把 ...

  8. Elasticsearch5.5安装部署

    一 ES基础知识介绍 Near Reamtime(NRT) Elasticsearch 是一个实时的查询平台,从索引数据开始到索引数据结束几乎是1s的时间 Cluster 集群是一个或多个节点的集合, ...

  9. Elasticsearch5.0 安装问题

    使用Elasticsearch5.0 必须安装jdk1.8 [elsearch@vm-mysteel-dc-search01 bin]$ java -version java version &quo ...

随机推荐

  1. Tomcat配置JVM参数步骤

    这里向大家描述一下如何使用Tomcat配置JVM参数,Tomcat本身不能直接在计算机上运行,需要依赖于硬件基础之上的操作系统和一个java虚拟机.您可以选择自己的需要选择不同的操作系统和对应的JDK ...

  2. HwUI,CMS管理系统模板,漂亮,简单,兼容好

    HwUI兼容目前所有浏览器,IE6+,Opera,Firefox,Chorme,Safari,由于IE6基本已废弃,所以也没有测试IE6的兼容,但做了部分IE6兼容调整.HwUI操作简单,路由导航不需 ...

  3. MySQL内连接和外连接

    INNER JOIN(内连接,或等值连接):获取两个表中字段匹配关系的记录. LEFT JOIN(左连接):获取左表所有记录,即使右表没有对应匹配的记录. RIGHT JOIN(右连接): 与 LEF ...

  4. php excel原理

  5. 区分IE8/IE7/IE6及其他浏览器-CSS “\9″

    区分IE8/IE7/IE6及其他浏览器-CSS “\9″ 原创文章,转载请注明来自张鑫旭-鑫空间-鑫生活[http://www.zhangxinxu.com] by zhangxinxu from h ...

  6. 转-超链接a的target属性

    超链接a的target属性 <a>标签的target意思很明确就是在哪里打开目标文档. 第一种情况: 默认情况:当我们没有设置超链接属性target的value值时默认是_self,即&l ...

  7. java Date 当天时间戳处理

    1. 代码 private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; private static Date ...

  8. [AMPPZ2014]Petrol

    关键点的最小生成树? 关键点初始化为0,跑多源最短路,然后重构整个图,用Kruskal跑最小生成树 然后跑树链剖分在线回答询问 对树上每个点维护到链顶的最大值,结合线段树可以做到\(\Theta(n ...

  9. iOS上Delegate的悬垂指针问题

    文章有点长,写的过程很有收获,但读的过程不一定有收获,慎入 [摘要]   悬垂指针(dangling pointer)引起的crash问题,是我们在iOS开发过程当中经常会遇到的.其中由delegat ...

  10. git 上传文件到仓库上提示:origin does not to be a git repository

    最近上传代码到GitHub的时候,当我输入 git push -u origin master的时候,它提示: origin does not to be a git repository 在网上找到 ...