找了很久才找到一个博客写得比较全面的,FrankDeng

系统环境:CentOS7

相关软件:node-v10.9.0.tar.gz、kibana-6.4.0-linux-x86_64.tar.gz、logstash-6.4.0.zip、elasticsearch-6.4.0.tar.gz,下载地址

先准备三个节点,我这里在每个系统里的/etc/hosts里都添加下了以下内容,在后面的elasticsearch(es)集群的配置里会用到

192.168.133.177  CentOS7-ELk-node21

192.168.133.178  CentOS7-ELk-node22

192.168.133.179  CentOS7-ELk-node23

这里在node21里进行集群的配置

[root@CentOS7-ELk-node21 ~]# grep -v "^#" /opt/module/elk/config/elasticsearch.yml
cluster.name: mycluster
node.name: CentOS7-ELk-node21
bootstrap.memory_lock: false
network.host: 192.168.133.177
discovery.zen.ping.unicast.hosts: ["192.168.133.177", "192.168.133.178", "192.168.133.179"]
discovery.zen.minimum_master_nodes:

在node22里进行的配置

[root@CentOS7-ELK-node22 ~]# !grep
grep -v "^#" /opt/module/elk/config/elasticsearch.yml
cluster.name: mycluster
node.name: CentOS7-ELk-node22
network.host: 192.168.133.178
discovery.zen.ping.unicast.hosts: ["192.168.133.177", "192.168.133.178", "192.168.133.179"]
discovery.zen.minimum_master_nodes:

在node23里进行的配置

[root@CentOS7-ELK-node23 ~]# !grep
grep -v "^#" /opt/module/elk/config/elasticsearch.yml
cluster.name: mycluster
node.name: CentOS7-ELk-node23
network.host: 192.168.133.179
discovery.zen.ping.unicast.hosts: ["192.168.133.177", "192.168.133.178", "192.168.133.179"]
discovery.zen.minimum_master_nodes:

在node22和node23的节点的elasticsearch.yml的文件里将node.name的值改成自动对应的内容然后直接启动es

[root@CentOS7-ELk-node21 ~]# /opt/module/elk/bin/elasticsearch
[root@CentOS7-ELk-node22 ~]# /opt/module/elk/bin/elasticsearch
[root@CentOS7-ELk-node23 ~]# /opt/module/elk/bin/elasticsearch

使用curl命令进行访问看到如下内容说明启动成功

[root@CentOS7-ELk-node21 ~]# curl http://CentOS7-ELk-node21:9200
{
"name" : "CentOS7-ELk-node21",
"cluster_name" : "mycluster",
"cluster_uuid" : "_na_",
"version" : {
"number" : "6.4.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "595516e",
"build_date" : "2018-08-17T23:18:47.308994Z",
"build_snapshot" : false,
"lucene_version" : "7.4.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}

安装个最常用的head插件,下载地址,因为它实际上是一个node.js工作,所以这先来安装个node.js

[root@CentOS7-ELK-node21 ~]# cd /opt/module/node-v10.9.0/
[root@CentOS7-ELK-node21 node-v10.9.0]# ./configure --prefix=/opt/module/node
[root@CentOS7-ELK-node21 node-v10.9.0]# make && make install

经过一次刺激战场经典局鸡屁股的时间。。。

装完成了之后将如下配置添加到/etc/profie里

export NODE_HOME=/opt/module/node
export PATH=$NODE_HOME/bin:$PATH

生效

[root@CentOS7-ELk-node21 node]# source /etc/profile

到elasticsearch-head压缩包所有的目录,解压它后需要安装grunt,先来设置个国内源后再执行

[root@CentOS7-ELk-node21 elasticsearch-head-master]# npm config set registry https://registry.npm.taobao.org
[root@CentOS7-ELk-node21 elasticsearch-head-master]# npm install -g grunt
/opt/module/node/bin/grunt -> /opt/module/node/lib/node_modules/grunt/bin/grunt
+ grunt@1.0.3
added 96 packages from 60 contributors in 5.424s
[root@CentOS7-ELk-node21 elasticsearch-head-master]# npm install
npm WARN deprecated http2@3.3.7: Use the built-in module in node 9.0.0 or newer, instead
npm WARN deprecated coffee-script@1.10.0: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)

> phantomjs-prebuilt@2.1.16 install /usr/local/elasticsearch-head-master/node_modules/phantomjs-prebuilt
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
skipped....
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 66 packages from 69 contributors in 8.049s

版本确认一下

[root@CentOS7-ELk-node21 elasticsearch-head-master]# node -v
v10.9.0
[root@CentOS7-ELk-node21 elasticsearch-head-master]# npm -v
6.2.
[root@CentOS7-ELk-node21 elasticsearch-head-master]# grunt -version
grunt-cli v1.2.0
grunt v1.0.1

修改head的源码文件

[root@CentOS7-ELk-node21 elasticsearch-head-master]# vim Gruntfile.js
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: ,
base: '.',
keepalive: true
}
}
}

修改es的配置文件

[root@CentOS7-ELk-node21 elk]# tail - config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"

重启es,启动head

[root@CentOS7-ELk-node21 elasticsearch-head-master]# grunt server &
[]
[root@CentOS7-ELk-node21 elasticsearch-head-master]# (node:) ExperimentalWarning: The http2 module is an experimental API.
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

在启动中间会遇到类bootstrap checkd failed的报错,在这个错误下面会有错误的详细信息,常见的有两种

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

解决方案:

编辑 /etc/security/limits.conf,追加以下内容;
* soft nofile
* hard nofile
此文件修改后需要重新登录用户,才会生效

另外一种:

[]: max virtual memory areas vm.max_map_count [] is too low, increase to at least []

解决方案:

编辑 /etc/sysctl.conf,追加以下内容:
vm.max_map_count=
保存后,执行: sysctl -p 重新启动

启动好之后访问node21的9100端口

再来一个bigdesk插件

[root@CentOS7-ELk-node21 local]# wget https://github.com/hlstudio/bigdesk/archive/master.zip
[root@CentOS7-ELk-node21 local]# yum install httpd -y
[root@CentOS7-ELk-node21 local]# systemctl start httpd
[root@CentOS7-ELk-node21 local]# systemctl enable httpd

bigdesk是一个master.zip的包,解压后将它移动到/var/www/html下面即可

[root@CentOS7-ELk-node21 local]# mv bigdesk-master/ /var/www/html/

使用浏览器访问:http://192.168.133.177/bigdesk-master/_site/#nodes

可以说相当好看了,再来一发IK的分词

[root@CentOS7-ELk-node21 local]# mv bigdesk-master/ /var/www/html/
[root@CentOS7-ELk-node21 local]# cd /opt/module/elk/bin/
[root@CentOS7-ELk-node21 bin]# su es
[es@CentOS7-ELk-node21 bin]$ ./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.0/elasticsearch-analysis-ik-6.4.0.zip

本人在安装的时候第一次出现Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused),可怜我的上进心,再来一次

-> Downloading https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.0/elasticsearch-analysis-ik-6.4.0.zip
[=================================================] %  
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: plugin requires additional permissions @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.net.SocketPermission * connect,resolve
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks. Continue with installation? [y/N]y
-> Installed analysis-ik

重启es后,测试IK,

[es@CentOS7-ELk-node21 bin]$ curl -XPUT http://192.168.133.177:9200/index

logstash的安装

[root@CentOS7-ELk-node21 local]# unzip filebeat-6.4.-linux-x86_64.tar.gz
[root@CentOS7-ELk-node21 local]# cd logstash-6.4.

修改logstach的配置文件

[root@CentOS7-ELk-node21 logstash-6.4.]# vim logstash-simple.conf
input { stdin { } }
output {
elasticsearch { hosts => ["192.168.133.177:9200"] }
}

一般在企业中,filebeat做为input,然后output到es中,这里得先构建离线插件

[root@CentOS7-ELk-node21 bin]# ./logstash-plugin prepare-offline-pack logstash-input-beats
[root@CentOS7-ELk-node21 bin]# ./logstash-plugin install file:///usr/local/logstash-6.4.0/logstash-offline-plugins-6.4.0.zip

修改配置文件

[root@CentOS7-ELk-node21 config]# vim logstash-sample.conf
input {
beats {
port =>
}
} output {
elasticsearch {
hosts => ["http://192.168.133.177:9200"]
#stdout { codec => rubydebug }
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
manage_template => false
document_type => "%{[@metadata][type]}"
#user => "elastic"
#password => "changeme"
}
}

启动logstash

[root@CentOS7-ELk-node21 logstash-6.4.]# bin/logstash -f config/logstash-sample.conf &

logstash只是一个日志引擎,日志其实都是通过filebeat上报的,我这里在node22上安装filebeat,解压后进行filebeat目录后,修改配置文件

[root@CentOS7-ELK-node22 filebeat-6.4.-linux-x86_64]# vim filebeat.yml
- type: log
enabled: true
paths:
- /var/log/nginx/*.log //如果没有安装nignx的可以这写这一段,这里有设置了上报日志的参数,我的目的只要有日志生成就可以了 - type: log # Change to true to enable this input configuration.
enabled: true # Paths that should be crawled and fetched. Glob based paths.
paths:
- /var/log/*.log output.logstash:
# The Logstash hosts
hosts: ["192.168.133.177:5044"] //注意这里

启动filebeat

[root@CentOS7-ELK-node22 filebeat-6.4.-linux-x86_64]# ./filebeat -e -c filebeat.yml

好的,再安装个kibana,这就全部结束了

[root@CentOS7-ELk-node21 kibana-6.4.-linux-x86_64]# cd
/usr/local/kibana-6.4.-linux-x86_64 [root@CentOS7-ELk-node21 kibana-6.4.-linux-x86_64]# grep -v "^#\|^$" config/kibana.yml
server.host: "192.168.133.177"
elasticsearch.url: "http://192.168.133.177:9200"

启动kibana

[root@CentOS7-ELk-node21 kibana-6.4.-linux-x86_64]# bin/kibana &

看到端口占用5601即可使用浏览器浏览

在第一次浏览的时候会要我们设置索引的关键字,在设置栏的下面也会有相应的提示

设置好之后再回到Discover的菜单就可以看到你的日志了

[operator]ELK6的安装的更多相关文章

  1. [operator]ELK6 index pattern的问题

    完成了EL/FK的搭建之后,在kibana的主页只能看到默认的索引? 其实这个索引名字的设置是在logstash-smaple.conf(elk6.4)里的设置,比如我这样设置 input { bea ...

  2. ELK6.x_Kafka 安装配置文档

    1. 环境描述 1.1.   环境拓扑 如上图所示:Kafka为3节点集群负责提供消息队列,ES为3节点集群.日志通过logstash或者filebeat传送至Kafka集群,再通过logstash发 ...

  3. elk6快速安装

    rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch [elasticsearch-6.x] name=Elasticsear ...

  4. 项目中遇到的bug

    1. babel编译转换时发生了报错: BabelLoaderError: SyntaxError: Unexpected token babel预置的转换器是 babel-preset-es2015 ...

  5. 使用 Flux,Helm v3,Linkerd 和 Flagger 渐进式交付 Kubernetes

    介绍 本指南将引导您在 Kubernetes 集群上设置渐进式交付 GitOps 管道. GitOps Helm 研讨会 原文地址:GitOps Progressive Deliver with Fl ...

  6. Calico网络插件

    以下大部分是本人参考各种资料{官方文档.书籍}对知识的汇总和整理,其中有理解错误的地方请大神留言和指正,嘿嘿~~ 1.概述 参考文档:https://projectcalico.docs.tigera ...

  7. K8S Calico网络插件

    0.前言 参考文档:https://github.com/containernetworking/cni Pod网络插件,为了实现Pod网络而需要的插件.组件.由于Kubernetes通过开放的CNI ...

  8. 使用k8s operator安装和维护etcd集群

    关于Kubernetes Operator这个新生事物,可以参考下文来了解这一技术的来龙去脉: https://yq.aliyun.com/articles/685522?utm_content=g_ ...

  9. elk6.3 centos集群搭建 head插件安装

    版本elk均为6.3+centos7.0 准备工作 官网下载elk6.3的linux环境的压缩包,sftp上传 下载对应的head插件sftp上传到指定目录 tar.gz文件解压 tar -zxvf ...

随机推荐

  1. centos如何使用utc时间

    1.将本地时间文件改名,做备份文件为localtime2 mv /etc/localtime /etc/localtime2 2.将UTC文件和本地文件做连接ln -s /usr/share/zone ...

  2. Jq将字符串复制粘贴到剪贴板

      第一种: 自己测试时 只适合于input 和textarea 但是针对于其他标签的复制就不能用了.代码如下: <!DOCTYPE html> <html> <head ...

  3. 第十一章: Hadoop核心架构HDFS+MapReduce+Hbase+Hive内部机理详解

    HDFS的体系架构 整个Hadoop的体系结构主要是通过HDFS来实现对分布式存储的底层支持,并通过MR来实现对分布式并行任务处理的程序支持. HDFS采用主从(Master/Slave)结构模型,一 ...

  4. [Python] Argparse module

    he recommended command-line parsing module in the Python standard library 1. Basic import argparse p ...

  5. django之设置缓存

    缓存 一句话总结:缓存可以对view.模板.数据进行缓存可以设置缓存在不同的地方(本地内存.redis.系统文档)可以为服务器节省性能.减少用户等待时间. 对于中等流量的网站来说,尽可能地减少开销是必 ...

  6. C++builder 递归获取继承基类根类

    TClass ClassRef; ListBox1->Clear(); ClassRef = Sender->ClassType(); while (ClassRef != NULL) { ...

  7. 浅谈AVL树,红黑树,B树,B+树原理及应用(转)

    出自:https://blog.csdn.net/whoamiyang/article/details/51926985 背景:这几天在看<高性能Mysql>,在看到创建高性能的索引,书上 ...

  8. rtmp一些状态信息详解-as连接FMS服务器报错状态汇总~~

    原地址:http://help.adobe.com/zh_CN/AIR/1.5/jslr/flash/events/NetStatusEvent.html 下表说明了 code 和 level 属性可 ...

  9. C++Primer笔记-----day06

    ================================================================day06=============================== ...

  10. UNITY UI字体模糊的原因

    根本原因:像素少. 解决办法:字体的 font size将像素设置大些,然后用scale来缩放大小