elk,centos7,filebeat,elasticsearch-head详细安装步骤

先来张图,大致结构应该晓得,对吧!

安装jdk:至少1.8以上

yum -y localinstall jdk-8u73-linux-x64.rpm

安装elasticsearch5.2.1 用普通用户安装es:

tar -zxvf elasticsearch-5.2.1.tar.gz

[[email protected] elasticsearch-5.2.1]$ ./bin/elasticsearch

处理错误:

ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

cat /etc/security/limits.conf 加上下面这个:

* soft nofile 65536

* hard nofile 131072

* soft nproc 2048

* hard nproc 4096

cat /etc/sysctl.conf

vm.max_map_count=262144
fs.file-max=65536

然后启动成功!

也可以指定名字启动:

./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name

健康基本检测

[[email protected] bin]$ curl -XGET ‘192.168.36.141:9200/_cat/master?v&pretty‘
id host ip node
lbWUxIvITHy_0SufW6fBtw 192.168.36.141 192.168.36.141 my_node_name

[[email protected] bin]$ curl -XGET ‘192.168.36.141:9200/_cat/health?v&pretty‘
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1499173093 08:58:13 my_cluster_name green 1 1 0 0 0 0 0 0 - 100.0%
[[email protected] bin]$

练习索引和文档:

新建索引,显示索引:

[[email protected] bin]$ curl -XPUT ‘localhost:9200/customer?pretty&pretty‘
[2017-07-04T09:02:16,302][INFO ][o.e.c.m.MetaDataCreateIndexService] [my_node_name] [customer] creating index, cause [api], templates [], shards [5]/[1], mappings []
{
"acknowledged" : true,
"shards_acknowledged" : true
}
[[email protected] bin]$ curl -XGET ‘localhost:9200/_cat/indices?v&pretty‘
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open customer gtxHBupjSQ-4DNgMAMnuqQ 5 1 0 0 650b 650b
[[email protected] bin]$

56 curl -XPUT ‘localhost:9200/customer?pretty&pretty‘
57 curl -XGET ‘localhost:9200/_cat/indices?v&pretty‘
58 curl -XPUT ‘localhost:9200/customer/external/1?pretty&pretty‘ -H ‘Content-Type: application/json‘ -d‘
{
"name": "John Doe"
}

59 curl -XGET ‘localhost:9200/customer/external/1?pretty&pretty‘
60 curl -XDELETE ‘localhost:9200/customer?pretty&pretty‘
61 curl -XGET ‘localhost:9200/_cat/indices?v&pretty‘
62 curl -XPUT ‘localhost:9200/customer/external/1?pretty&pretty‘ -H ‘Content-Type: application/json‘ -d‘
{
"name": "John Doe"
}

63 PUT /customer/external/1?pretty
64 { "name": "Jane Doe"; }
65 curl -XPUT ‘localhost:9200/customer/external/1?pretty&pretty‘ -H ‘Content-Type: application/json‘ -d‘
{
"name": "Jane Doe"
}

66 PUT /customer/external/2?pretty
67 { "name": "Jane Doe"; }
68 curl -XPUT ‘localhost:9200/customer/external/2?pretty&pretty‘ -H ‘Content-Type: application/json‘ -d‘
{
"name": "Jane Doe"
}

69 curl -XDELETE ‘localhost:9200/customer/external/2?pretty&pretty‘

官方文档说可以在kibana里面写更加直观。

反正这个装好了!下一个

安装kibana:

tar zxvf kibana-5.2.1-linux-x86_64.tar.gz

./kibana &

http://192.168.36.141:5601/status#?_g=()

先安装filebeat:

docker run -itd --name java -p 5000:22 bc74bce8afa1 镜像是我以前做的,直接用,在另外自己的一个网站上,有时间弄下来:

测试:启动我的java包nohup java -jar /data/exchange/exchange-1.4.jar & > nohup.out >/dev/null

获取 nohup.out

tar zxvf filebeat-5.2.1-linux-x86_64.tar.gz

配置:

[[email protected] ~]# cat filebeat-5.2.1-linux-x86_64/filebeat.yml
#filebeat.prospectors:
#- input_type: log
# paths:
# - /root/logstash-tutorial.log
#output.logstash:
# hosts: ["192.168.36.150:5043"]
filebeat.prospectors:
- input_type: log
paths:
- /root/nohup.out
# - /var/log/secure
# - /var/log/messages
# - /var/log/*.log
fields:
type: syslog
output.logstash:
hosts: ["192.168.36.141:5043"]

[[email protected] ~]#

启动filebeat:./filebeat-5.2.1-linux-x86_64/filebeat -e -c filebeat-5.2.1-linux-x86_64/filebeat.yml -d "publish"

安装logstach:

tar zxvf logstash-5.2.1.tar.gz

配置pip:

[[email protected] logstash-5.2.1]# cat first-pipline.conf
input {
beats {
port => 5043
# ssl => true
# ssl_certificate => "/etc/pki/tls/certs/logstash-forwarder.crt"
# ssl_key => "/etc/pki/tls/private/logstash-forwarder.key"
}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
output {
elasticsearch {
hosts => ["192.168.36.141:9200"]
sniffing => true
manage_template => false
index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
document_type => "%{[@metadata][type]}"
}
}

启动起来:

./bin/logstash -f first-pipline.conf --config.reload.automatic

最后在kibana上面建一个索引:

好了数据出来了:

---------------我是有底线的-------------------- 
作者:jt
出处:http://www.cnblogs.com/Jt00/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
如果文中有什么错误,欢迎指出。以免更多的人被误导。

时间: 2024-08-07 10:56:35

elk,centos7,filebeat,elasticsearch-head详细安装步骤的相关文章

LAMP----linux+apache+mysql+php详细安装步骤之一APACHE篇(openldap等)

LAMP----linux+apache+mysql+php详细安装步骤之一APACHE篇(openldap等) linux详细版本为RHEL5.3 [[email protected] mail]# uname -a Linux localhost.localdomain 2.6.18-128.el5 #1 SMP Wed Dec 17 11:42:39 EST 2008 i686 i686 i386 GNU/Linux 1.上传apache源代码文件 httpd-2.2.13.tar.bz2

Windows下Oracle安装图解----oracle-win-64-11g 详细安装步骤

一. Oracle 下载 官方下地址 http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html win 32位操作系统 下载地址: http://download.oracle.com/otn/nt/oracle11g/112010/win32_11gR2_database_1of2.zip http://download.oracle.com/otn/nt/oracle11g/11201

Rational Rose2007详细安装步骤

学习了UML,那么Rational rose画图软件当然就是必不可少的了.我的电脑是win7 64位的系统.下面的链接是安装软件以及破解方法.该软件是BIN格式的,也就是镜像文件,需要安装一个虚拟驱动对其进行安装. 安装软件:http://yunpan.cn/cgEFPECZjcK6H 提取码 af67 破解方法:http://yunpan.cn/cgEF6TBbBrLqg   提取码 c35b 下面说下详细地安装步骤. (1)      双击setup安装程序,进入安装向导界面,如图1. 图1

Oracle(11g)详细安装步骤

 最详细的Oracle安装步骤就在这里,话不多说直接给大家上安装Oracle的详细教程  如果没有安装包,可以先点击下载下载地址:http://download.oracle.com/otn/nt/oracle11g/112010/win64_11gR2_database_1of2.ziphttp://download.oracle.com/otn/nt/oracle11g/112010/win64_11gR2_database_2of2.zip 一.首先大家要确定自己电脑上有没有安装过Orac

CentOS7.2详细安装步骤(二)

7)语言设置(可以在上一个主界面进行设置,这里不用再次设置) 8)SECURITY设置(安全设置) 选择default(默认的)策略就可以,通过进行选择,单击完成即可 Default   #默认策略 隐式XCCDF概要文件.通常情况下,默认不包含规则 Standard System Security Profile #标准系统安全性配置文件 这个概要文件包含规则,以确保标准安全基地CenOS Linux 7系统 Draft PCI-DSS v3 Control Baseline for Cent

CentOS7.2详细安装步骤(三)

13)网络配置,开启以太网连接,将会自动获取IP地址,如果要手动配置,单击 ,开启以太网连接,将会自动获取IP地址,如果要手动配置,单击 手动配置如下: 14)全部配置完成之后如下,单击开始安装,进行系统安装 15)进入安装界面,这里需要配置用户密码 Root密码配置,如果密码过于简单,需要单击两次完成进行确认 创建普通用户,如果密码过于简单,需要单击两次完成进行确认 安装过程,请等待 16)安装完成,重启系统 17)进入启动引导界面 18)首次启动,输入数字1,进行许可认证 输入数字2,接受许

elk,centos7,filebeat,elasticsearch-head集成搭建

1.安装 elasticsearch-5.2.2.tar.gz cd elasticsearch-5.2.2/bin ./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name 2.健康检测: 启动kibana: 然后访问这个地址:http://192.168.36.150:5601/app/kibana#/dev_tools/console?load_from=https:%2F%2Fwww.elastic.c

ELK 架构之 Elasticsearch 和 Kibana 安装配置

阅读目录: 1. ELK Stack 简介 2. 环境准备 3. 安装 Elasticsearch 4. 安装 Kibana 5. Kibana 使用 6. Elasticsearch 命令 最近在开发分布式服务追踪,使用 Spring Cloud Sleuth Zipkin + Stream + RabbitMQ 中间件,默认使用内存存储数据,但这样应用于生产环境,就不太合适了. 最终我采用的方案:服务追踪数据使用 RabbitMQ 进行采集 + 数据存储使用 Elasticsearch +

Oracle9i的详细安装步骤(有图解)

Oracle9i的安装和卸载详解 本章将以Windows操作系统为例讲述Oracle9i数据库的安装 主要内容包括:安装前的准备  Oracle9i数据库的安装  验证安装成功 以及数据库的卸载 2.1  安装前的准备 2.1.1  安装需求 Oracle公司推荐在Windows NT和Windows 2000下安装Oracle数据库,并且磁盘的分区为NTFS格式.但是你也可以使用Windows 98或者Windows XP,磁盘分区也可以是FAT32. Oracle数据库大体上分为两个版本,一