elasticSearch插件的安装以及使用nginx的modles收集nginx的日志
1、首先在windows环境上搭建es的集群
集群的配置如下
#node01的配置:
cluster.name: es-itcast-cluster
node.name: node01
node.master: true
node.data: true
network.host: 0.0.0.0
http.port:
transport.tcp.port:
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
discovery.zen.minimum_master_nodes:
http.cors.enabled: true
http.cors.allow-origin: "*"
#node01的配置:
cluster.name: es-itcast-cluster
node.name: node02
node.master: true
node.data: true
network.host: 0.0.0.0
http.port:
transport.tcp.port:
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
discovery.zen.minimum_master_nodes:
http.cors.enabled: true
http.cors.allow-origin: "*"
#node01的配置:
cluster.name: es-itcast-cluster
node.name: node03
node.master: true
node.data: true
network.host: 0.0.0.0
http.port:
transport.tcp.port:
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
discovery.zen.minimum_master_nodes:
http.cors.enabled: true
http.cors.allow-origin: "*"
在linux环境下配置es集群的配置文件为
ELasticsearch的集群是由多个节点组成的,通过cluster.name设置集群名称,并且用于区分其它的集群,每个节点
通过node.name指定节点的名称。
在Elasticsearch中,节点的类型主要有4种:
master节点
配置文件中node.master属性为true(默认为true),就有资格被选为master节点。
master节点用于控制整个集群的操作。比如创建或删除索引,管理其它非master节点等。
data节点
配置文件中node.data属性为true(默认为true),就有资格被设置成data节点。
data节点主要用于执行数据相关的操作。比如文档的CRUD。
客户端节点
配置文件中node.master属性和node.data属性均为false。
北京市昌平区建材城西路金燕龙办公楼一层 电话:400-618-9090
该节点不能作为master节点,也不能作为data节点。
可以作为客户端节点,用于响应用户的请求,把请求转发到其他节点
部落节点
当一个节点配置tribe.*的时候,它是一个特殊的客户端,它可以连接多个集群,在所有连接的集群上执行
搜索和其他操作。
#启动3个虚拟机,分别在3台虚拟机上部署安装Elasticsearch
mkdir /itcast/es-cluster
#分发到其它机器
scp -r es-cluster elsearch@192.168.40.134:/itcast
#node01的配置:
cluster.name: es-itcast-cluster
node.name: node01
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.40.133","192.168.40.134","192.168.40.135"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
#node02的配置:
cluster.name: es-itcast-cluster
node.name: node02
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.40.133","192.168.40.134","192.168.40.135"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
#node03的配置:
cluster.name: es-itcast-cluster
node.name: node02
node.master: true
node.data: true
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.40.133","192.168.40.134","192.168.40.135"]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
#分别启动3个节点
./elasticsearch
特别需要的是下面参数
特别说明:
如果在配置文件中discovery.zen.minimum_master_nodes设置的不是N/2+1时,会出现脑裂问题,之前宕机
的主节点恢复后不会加入到集群。
接下来我们要安装es的插件:插件一定要和es的版本一致,例如当前es是6.2.4版本,那离线安装插件的版本也必须是6.2.4版本
接下来我们要安装三个插件analysis-ik、ingest-geoip和ingest-user-agent
在线安装插件的方式

sudo bin/elasticsearch-plugin install ingest-user-agent
sudo bin/elasticsearch-plugin install ingest-geoip
离线安装的方式:
下载对应的插件版本,当前es是6.2.4,插件一定要是6.2.4版本,如果是其他版本就会报错

elasticsearch-plugin install file:C:\Users\Administrator\Desktop\ELK\es-cluster\ingest-geoip-6.2.4.zip
离线安装ingest-geoip-6.2.4.zip

4.7、Module
前面要想实现日志数据的读取以及处理都是自己手动配置的,其实,在Filebeat中,有大量的Module,可以简化我
们的配置,直接就可以使用,如下
./filebeat modules list
Enabled:
Disabled:
apache2
auditd
elasticsearch
haproxy
icinga
iis
kafka
1 2 3 4 5 6 7 8 9
10
11
12
北京市昌平区建材城西路金燕龙办公楼一层 电话:400-618-9090
可以看到,内置了很多的module,但是都没有启用,如果需要启用需要进行enable操作:
可以发现,nginx的module已经被启用。
4.7.1、nginx module 配置
kibana
logstash
mongodb
mysql
nginx
osquery
postgresql
redis
suricata
system
traefik
可以看到,内置了很多的module,但是都没有启用,如果需要启用需要进行enable操作:
可以发现,nginx的module已经被启用

nginx module 配置
- module: nginx
# Access logs
access:
enabled: true
var.paths: ["C:/Users/Administrator/Desktop/ELK/nginx-1.15.5/nginx-1.15.5/logs/access.log"]
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths: # Error logs
error:
enabled: true
var.paths: ["C:/Users/Administrator/Desktop/ELK/nginx-1.15.5/nginx-1.15.5/logs/error.log"]
# Set custom paths for the log files. If left empty,
# Filebeat will choose the paths depending on your OS.
#var.paths:
在这里指定nginx日志的位置
var.paths: ["C:/Users/Administrator/Desktop/ELK/nginx-1.15.5/nginx-1.15.5/logs/access.log"]
接下来配置配置filebeat的配置文件
filebeatwithnginxmoudles.yml
#============================= Filebeat modules =============================== filebeat.config.modules:
# Glob pattern for configuration loading
path: ${path.config}/modules.d/*.yml
reload.enabled: true
setup.template.settings:
index.number_of_shards: 3 setup.kibana: #----------------------------- Logstash output --------------------------------
output:
elasticsearch:
hosts: ["127.0.0.1:9200","127.0.0.1:9201","127.0.0.1:9202"]
整个filebeat的配置文件我们都要分析下
filebeat.config.modules:
# Glob pattern for configuration loading
path: ${path.config}/modules.d/*.yml
reload.enabled: true
这个配置就会去加载上面的modules.d目录下面的nginx.yml配置文件,在这个配置文件中使用moudles来收集nginx的配置文件
output:
elasticsearch:
hosts: ["127.0.0.1:9200","127.0.0.1:9201","127.0.0.1:9202"]
这个指定filebeat收集到日志之后直接发送到es的集群中
setup.template.settings:
index.number_of_shards: 3
这个指定一个索引文件存储在3个分片中

es-head中0 1 2 就是对于的分片,每个文档都是分别存储在上面的三个分片中
elasticSearch插件的安装以及使用nginx的modles收集nginx的日志的更多相关文章
- 转:ElasticSearch的安装和相关插件的安装
原文来自于:http://blog.csdn.net/whxaing2011/article/details/18237733 本文主要介绍如下内容: 1.ElasticSearch ...
- elasticsearch 中文分词、插件的安装和使用(一)
1. 安装elasticsearch.kibana.x-pack #安装elasticsearch wget https://artifacts.elastic.co/downloads/elasti ...
- elasticsearch插件安装之--linux下安装及head插件
/** * 系统环境: vm12 下的centos 7.2 * 当前安装版本: elasticsearch-2.4.0.tar.gz */ 安装和学习可参照官方文档: 1, 安装 # 下载, 获取不成 ...
- Elasticsearch插件head的安装(有坑)
http://blog.csdn.net/u012332735/article/details/56283932 Elasticsearch出了5.2.1版本之后,就去试试它的新版本的使用,为了以后的 ...
- Elasticsearch之Hadoop插件的安装(图文详解)
这个Hadoop插件的安装是非常重要. Hadoop插件安装 在es的安装目录下 bin/plugin install elasticsearch/elasticsearch-repository-h ...
- ElasticSearch 5.2.2 安装及 head 插件的安装
ElasticSearch 是一个基于 Lucene 的高度可扩展的开源全文搜索和分析引擎.它能够做到可以快速.实时地存储.搜索和分析大量数据.它通常作为底层引擎/技术,为具有复杂搜索功能和要求的应用 ...
- Elasticsearch进阶篇(一)~head插件的安装与配置
1.安装node.js 1.1.通过官网下载二进制安装包 https://nodejs.org/en/download/ 选择对应的版本,右键复制下载链接,进入linux目录,切换到要安装目录的磁盘. ...
- ElasticSearch 集群环境搭建,安装ElasticSearch-head插件,安装错误解决
ElasticSearch-5.3.1集群环境搭建,安装ElasticSearch-head插件,安装错误解决 说起来甚是惭愧,博主在写这篇文章的时候,还没有系统性的学习一下ES,只知道可以拿来做全文 ...
- 批量搞机(二):分布式ELK平台、Elasticsearch介绍、Elasticsearch集群安装、ES 插件的安装与使用
一.分布式ELK平台 ELK的介绍: ELK 是什么? Sina.饿了么.携程.华为.美团.freewheel.畅捷通 .新浪微博.大讲台.魅族.IBM...... 这些公司都在使用 ELK!ELK! ...
随机推荐
- nginx学习资料整理一
一.安装运行 1.1.安装环境支撑 1.gcc 环境,一般情况linux 系统自带该环境,也可自行下载安装使用新版本: 2.pcre 环境,一般需自行安装,其是一个perl库,包含正则表达式等功能,h ...
- 2019-ICLR-DARTS: Differentiable Architecture Search-论文阅读
DARTS 2019-ICLR-DARTS Differentiable Architecture Search Hanxiao Liu.Karen Simonyan.Yiming Yang GitH ...
- R 语言
ps 帮人学习R语言代码: 定义变量 alldata<-c(32.56,1.4072,28.94,0.231,11.005,2.48713,40.33,1.5334,34.79,0.288,18 ...
- 【大厂面试03期】MySQL是怎么解决幻读问题的?
问题分析 首先幻读是什么? 根据MySQL文档上面的定义 The so-called phantom problem occurs within a transaction when the same ...
- Java写算法题中那些影响你效率的细节(关于暴力破解算法题的细节处理)
QQ讨论群:99979568 多交流才能进步 暂时写到这里,有不懂的欢迎评论, 如果有什么其他提高效率的细节,欢迎评论或者私信我,小编一定努力学习,争取早日分享给大家 如果大家嫌三连累的话,可以看看这 ...
- (Java实现)蓝桥杯Excel地址
历届试题 Excel地址 原题地址 时间限制:1.0s 内存限制:256.0MB 提交此题 问题描述 Excel单元格的地址表示很有趣,它使用字母来表示列号. 比如, A表示第1列, B表示第2列, ...
- Java实现 LeetCode 599 两个列表的最小索引总和(使用hash提高效率)
599. 两个列表的最小索引总和 假设Andy和Doris想在晚餐时选择一家餐厅,并且他们都有一个表示最喜爱餐厅的列表,每个餐厅的名字用字符串表示. 你需要帮助他们用最少的索引和找出他们共同喜爱的餐厅 ...
- SQLServer2019安装教程
可以去官网下载,我百度网盘也有都一样 https://pan.baidu.com/s/1i3umqHXSUMbxJ9rRi6mU4A 提取码:5g9q 打开应用程序 点击安装,点第一个全新得SQL s ...
- Java实现 LeetCode 9 回文数
9. 回文数 判断一个整数是否是回文数.回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数. 示例 1: 输入: 121 输出: true 示例 2: 输入: -121 输出: false ...
- java实现第四届蓝桥杯组素数
组素数 题目描述 素数就是不能再进行等分的数.比如:2 3 5 7 11 等. 9 = 3 * 3 说明它可以3等分,因而不是素数. 我们国家在1949年建国.如果只给你 1 9 4 9 这4个数字卡 ...