2018-07-02     21:32:33

ELK 单实例搭建

环境搭建

1.1我的系统版本

Distributor ID: CentOS

Description:     CentOS release 6.5 (Final)

1.2需要的软件:(elk的下载路径:https://www.elastic.co/downloads/

ElasticSearch:2.2.1

Logstash:2.2.2

Kibana:4.4.2

JRE:1.8.2

1.3 创建用户

[root@db ~]#
useradd elk password

[root@db ~]#
passwd elk

1.4 创建elk 需要的目录

[root@db ~]#
mkdir -p /data/elk/

赋予所有和所属

[root@db ~]#
chown -R elk:elk /data/elk/

一下操作都在用户 elk 下执行,不然服务搭建不成功,会各种报错

安装 jdk 1.8

[elk@db elk]$
pwd

/data/elk

[elk@db elk]$
mkdir java

[elk@db elk]$
tar -zxvf jdk-8u171-linux-x64.tar.gz

配置环境变量(此时切换到root用户下配置)

[root@db ~]#
vim /etc/profile

export
JAVA_HOME=/data/elk/java

export
JRE_HOME=/data/elk/java/jre

export
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

export
PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

配置文件限制

(Elk为启动用户,也可以指定为*)

[root@db ~]# vim /etc/security/limits.conf

elk                 soft    nofile 
65536

elk                 hard    nofile 
131072

elk                 soft    nproc  
65536

elk                 hard    nproc  
131072

[root@db ~]# vim
/etc/security/limits.d/90-nproc.conf

*         
soft    nproc     2048  
(原来是1024 改成2048即可)

切换到elk用户下在操作

安装 elasticsearch

[elk@db elk]$ tar -zxvf
elasticsearch-2.2.1.tar.gz

对elasticsearch 进行配置

[elk@db config]$ pwd

/data/elk/elasticsearch-2.2.1/config

[elk@db config]$ vim elasticsearch.yml

启动进行验证
通浏览器访问

[elk@db elasticsearch-2.2.1]$
./bin/elasticsearch

(nohup bin/elasticsearch & 这种启动调用到后台了,不然会一直在前台挂着, Ctrl + 
会杀掉进程,后续的都一样)

验证

下载插件 elasticsearch-head

新建目录

[elk@db mobz]$ pwd

/data/elk/elasticsearch-2.2.1/bin/mobz

[elk@db mobz]$ mkdir mobz

下载elasticsearch-head的路径:https://github.com/mobz/elasticsearch-head

(这个时候下载需要到github上才能下载到,在Windows 安装git客户端进行下载:下载命令:

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

新建目录

[elk@db bin]$ pwd

/data/elk/elasticsearch-2.2.1/bin

[elk@db bin]$ mkdir mobz

把elasticsearch-head 放到目录下

加载 elasticsearch-head 插件

[elk@db bin]$ pwd

/data/elk/elasticsearch-2.2.1/bin

[elk@db bin]$ ./plugin install
mobz/elasticsearch-head/

(特别声明:最好在bin 目录下加载,不要在上一级加载,容易出错,加载不出来)

加载完成后再次启动服务

[elk@db elasticsearch-2.2.1]$
./bin/elasticsearch

验证访问

安装logstash

[elk@db elk]$ tar -zxvf logstash-2.2.2.tar.gz

[elk@db logstash-2.2.2]$ pwd

/data/elk/logstash-2.2.2

[elk@db logstash-2.2.2]$ vim
logstash-simple.conf

input {stdin { } }

output {

elasticsearch {hosts => "192.168.25.50" }

stdout { codec=> rubydebug }

}

启动

[elk@db logstash-2.2.2]$ pwd

/data/elk/logstash-2.2.2

[elk@db logstash-2.2.2]$ ./bin/logstash -f
logstash-simple.conf

安装kibana

[elk@db elk]$ tar -zxvf
kibana-4.4.2-linux-x64

进行配置

[elk@db config]$ pwd

/data/elk/kibana-4.4.2-linux-x64/config

[elk@db config]$ vim kibana.yml

只需要修改(去掉注释):server.port: 5601 、

server.host: "192.168.25.50"

elasticsearch.url: http://192.168.25.50:9200

kibana.index:
".kibana"

特别声明:配置的内容要和左面一定要顶齐,不能留有空格,不然启动失败

启动:

[elk@db kibana-4.4.2-linux-x64]$
./bin/kibana

log 
 [15:23:07.861] [info][status][plugin:kibana] Status changed from
uninitialized to green - Ready

log   [15:23:07.902]
[info][status][plugin:elasticsearch] Status changed from uninitialized to
yellow - Waiting for Elasticsearch

log   [15:23:07.919]
[info][status][plugin:kbn_vislib_vis_types] Status changed from uninitialized
to green - Ready

log   [15:23:07.931]
[info][status][plugin:markdown_vis] Status changed from uninitialized to green
- Ready

log   [15:23:07.939]
[info][status][plugin:metric_vis] Status changed from uninitialized to green -
Ready

log   [15:23:07.965]
[info][status][plugin:spyModes] Status changed from uninitialized to green - Ready

log   [15:23:07.972]
[info][status][plugin:statusPage] Status changed from uninitialized to green -
Ready

log   [15:23:07.977]
[info][status][plugin:table_vis] Status changed from uninitialized to green -
Ready

log   [15:23:07.983]
[info][listening] Server running at http://192.168.25.505601

log   [15:23:12.980]
[info][status][plugin:elasticsearch] Status changed from yellow to yellow - No
existing Kibana index found

log   [15:23:16.749]
[info][status][plugin:elasticsearch] Status changed from yellow to green -
Kibana index ready

验证

最新文章

  1. Java学习过程中的总结的小知识点(长期更新)
  2. 视频聊天APP
  3. php 函数preg_match、preg_match_all ,以及正则表达式规则
  4. git常用命令-基本操作
  5. iOS 新窗口在最上层
  6. wget的下载与安装使用
  7. HTML5触摸屏touch事件使用实例1
  8. Python之系统交互(subprocess)
  9. Hibernate学习笔记(1)---hibernate快速上手与准备工作
  10. css中的关于margin-top,position和z-index的一些bug解决方案
  11. C++模板类与Qt信号槽混用
  12. Q语言-[帝王三国送将辅助]
  13. 雾霾天出行,如何精确避开“雷区”?2016 SODA数据侠十强
  14. ajaxsubmit 上传文件 在IE中返回的内容 提示下载文件
  15. LeetCode Container With Most Water (Two Pointers)
  16. Android -- Camera.ShutterCallback
  17. tcp3次握手,https加密,ca认证
  18. cmake重新编译
  19. afx_msg解释
  20. webapp开发绝对定位引发的问题

热门文章

  1. 如何写一个自己的渣渣PHP框架
  2. StringBuffer类的常用方法
  3. ZLYZD团队第四周项目总结
  4. VS+Qt使用资源
  5. 内核加载模块时提示usb_common: exports duplicate symbol of_usb_get_dr_mode
  6. UVa 11732 strcmp()函数(左孩子右兄弟表示法)
  7. Hive安装-windows(转载)
  8. Java开源-astar:A 星算法
  9. Leetcode 34
  10. 让FireFox支持window.event属性