ELK初学搭建(elasticsearch)

elasticsearch
logstash
kibana

ELK初学搭建 elasticsearch

1.环境准备

centos6.8_64 mini

IP:192.168.10.78

tar包:

logstash-2.4.0.tar.gz

elasticsearch-2.4.0.tar.gz

kibana-4.6.1-linux-x86_64.tar.gz

JDK环境

elasticsearch logstach kibana java
V2.4 V2.4 V4.6.1 V1.8.0_111
1.1环境准备
  1. [root@localhost ~]# yum install java-1.8.0-openjdk* -y 

  2. [root@localhost ~]# export JAVA_HOME=/usr/lib/jvm/java-1.8.0 

  3. [root@localhost ~]# export PATH=$JAVA_HOME/bin:$PATH 

  4. [root@localhost ~]# export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar 

  5. [root@localhost ~]# java -version 

  6. openjdk version "1.8.0_111" 

  7. OpenJDK Runtime Environment (build 1.8.0_111-b15) 

  8. OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode) 

此时jdk环境已经正常可用。

2.软件上传之服务器并解压到/usr/local目录下

解压,并重新命名文件夹:

[root@localhost ~]# xvf elasticsearch-2.4.0.tar.gz
[root@localhost ~]# mv elasticsearch-2.4.0 /usr/local/elasticsearch

同理 将这三个软件解压...

3. 运行软件

  1. [root@localhost elasticsearch]# ./bin/elasticsearch 

  2. Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root. 

  3. at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:94) 

  4. at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:160) 

  5. at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) 

  6. at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) 

  7. Refer to the log for complete error details. 

  8. [root@localhost elasticsearch]#  

运行报错,发现elasticsearch不允许在root下运行,解决:

  1. [root@localhost elasticsearch]# groupadd es 

  2. [root@localhost elasticsearch]# useradd -g es es 

  3. [root@localhost elasticsearch]# useradd -g es es 

  4. [root@localhost elasticsearch]# passwd es 

  5. Changing password for user es. 

  6. New password:  

  7. BAD PASSWORD: it is based on a dictionary word 

  8. Retype new password:  

  9. passwd: all authentication tokens updated successfully. 

  10. [root@localhost elasticsearch]# chown -R root . 

  11. [root@localhost elasticsearch]# chown -R es . 

  12. [root@localhost elasticsearch]# chgrp -R es . 

  13. [root@localhost elasticsearch]# ls -l 

  14. total 56 

  15. drwxr-xr-x 2 es es 4096 Nov 7 17:25 bin 

  16. drwxr-xr-x 3 es es 4096 Nov 7 19:37 config 

  17. drwxrwxr-x 3 es es 4096 Nov 7 17:34 data 

  18. drwxr-xr-x 2 es es 4096 Nov 7 17:25 lib 

  19. -rw-rw-r-- 1 es es 11358 Aug 24 00:46 LICENSE.txt 

  20. drwxrwxr-x 2 es es 4096 Nov 7 17:34 logs 

  21. drwxrwxr-x 5 es es 4096 Aug 29 17:23 modules 

  22. -rw-rw-r-- 1 es es 150 Aug 24 00:46 NOTICE.txt 

  23. drwxrwxr-x 4 es es 4096 Nov 7 17:50 plugins 

  24. -rw-rw-r-- 1 es es 8700 Aug 24 00:46 README.textile 

此时,ES 不能通过IP访问,最好修改 config/elasticsearch.yml,配置一下 ES。

首先,找到“network.host”行,添加一行:

network.host: 192.168.10.78

再找到“http.port”行,添加一行:

http.port: 9200

否则,ES 每次启动时,端口可能会变(端口被占用,ES 自己会改端口)~

如果还不能正常启动 ES,并提示端口被占用,就查看一下什么程序占用 9200 端口,kill 掉,重启 ES 就行。

就能通过IP,或浏览器访问。

切换至es用户先运行elasticsearch

  1. [root@localhost ~]# su es 

  2. [es@localhost root]$ cd /usr/local/elasticsearch/ 

  3. [es@localhost elasticsearch]$ ls 

  4. bin config data lib LICENSE.txt logs modules NOTICE.txt plugins README.textile 

  5. [es@localhost elasticsearch]$ ./bin/elasticsearch 

  6. [2016-11-07 21:50:45,580][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed 

  7. [2016-11-07 21:50:45,824][INFO ][node ] [Man-Eater] version[2.4.0], pid[1880], build[ce9f0c7/2016-08-29T09:14:17Z] 

  8. [2016-11-07 21:50:45,824][INFO ][node ] [Man-Eater] initializing ... 

  9. [2016-11-07 21:50:46,521][INFO ][plugins ] [Man-Eater] modules [reindex, lang-expression, lang-groovy], plugins [head, kopf], sites [head, kopf] 

  10. [2016-11-07 21:50:46,548][INFO ][env ] [Man-Eater] using [1] data paths, mounts [[/ (/dev/mapper/VolGroup-lv_root)]], net usable_space [5gb], net total_space [8.2gb], spins? [possibly], types [ext4] 

  11. [2016-11-07 21:50:46,548][INFO ][env ] [Man-Eater] heap size [1007.3mb], compressed ordinary object pointers [true] 

  12. [2016-11-07 21:50:46,548][WARN ][env ] [Man-Eater] max file descriptors [4096] for elasticsearch process likely too low, consider increasing to at least [65536] 

  13. [2016-11-07 21:50:49,052][INFO ][node ] [Man-Eater] initialized 

  14. [2016-11-07 21:50:49,053][INFO ][node ] [Man-Eater] starting ... 

  15. [2016-11-07 21:50:49,124][INFO ][transport ] [Man-Eater] publish_address {192.168.10.78:9300}, bound_addresses {192.168.10.78:9300} 

  16. [2016-11-07 21:50:49,130][INFO ][discovery ] [Man-Eater] elasticsearch/kAMEcJDUQ_2jK0jm7fVWeQ 

  17. [2016-11-07 21:50:52,210][INFO ][cluster.service ] [Man-Eater] new_master {Man-Eater}{kAMEcJDUQ_2jK0jm7fVWeQ}{192.168.10.78}{192.168.10.78:9300}, reason: zen-disco-join(elected_as_master, [0] joins received) 

  18. [2016-11-07 21:50:52,289][INFO ][http ] [Man-Eater] publish_address {192.168.10.78:9200}, bound_addresses {192.168.10.78:9200} 

  19. [2016-11-07 21:50:52,290][INFO ][node ] [Man-Eater] started 

  20. [2016-11-07 21:50:52,385][INFO ][gateway ] [Man-Eater] recovered [2] indices into cluster_state 

  21. [2016-11-07 21:50:53,045][INFO ][cluster.routing.allocation] [Man-Eater] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[logstash-%{type}-2016.11.07][1], [.kibana][0]] ...]). 

此时,在另一个终端,访问 elasticsearch:

  1. [root@localhost ~]# curl -X GET http://192.168.10.78:9200 



  2. "name" : "Egghead", 

  3. "cluster_name" : "elasticsearch", 

  4. "version" : { 

  5. "number" : "2.4.0", 

  6. "build_hash" : "ce9f0c7394dee074091dd1bc4e9469251181fc55", 

  7. "build_timestamp" : "2016-08-29T09:14:17Z", 

  8. "build_snapshot" : false, 

  9. "lucene_version" : "5.5.2" 



  10. "tagline" : "You Know, for Search" 



到这一不,ES 已经安装成功。可用浏览器测试是都正常即可。

Head 插件

Head 是一个用来监控 ES 状态的客户端插件,可以为初学用户提供很多便利,例如,使用 Head 提供的 HTTP 客户端,通过 HTTP 方式来操作 ES。

ES 支持在线和本地安装 Head。本地安装时,从 Github 上下载 Head 插件,然后上传到你的 ES 服务器,比如,Elasticsearch/plugins 目录。

下面是在线安装:

  1. [root@localhost elasticsearch]# ./bin/plugin install mobz/elasticsearch-head 

  2. -> Installing mobz/elasticsearch-head... 

  3. Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ... 

  4. Downloading ...................................................................................................................................................................................................................................................................................................................................................................................................................................DONE 

  5. Verifying https://github.com/mobz/elasticsearch-head/archive/master.zip checksums if available ... 

  6. NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify) 

  7. Installed head into /usr/local/elasticsearch/plugins/head 

用浏览器访问 http://192.168.10.78:9200/_plugin/head

logstash-%{type}-2016.11.07是我自己创建的,后续介绍。

至此Elasticsearch Head 就成功安装了。

Marvel 图形化监控插件收费,安装方法同上,本免费党不测试了 哈哈~

安装 kopf 网络插件

[root@localhost elasticsearch]# ./bin/plugin install mobz/elasticsearch-kopf
-> Installing lmenezes/elasticsearch-kopf...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip...
Downloading ..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................DONE
Installed lmenezes/elasticsearch-kopf into /usr/local/elasticsearch/plugins/kopf

kopf.png

至此elasticsearch准备就绪,下一章安装losstach.

ELK初学搭建(elasticsearch)的更多相关文章

  1. ELK初学搭建(kibana)

    ELK初学搭建(kibana) elasticsearch logstash kibana ELK初学搭建 kibana 1.环境准备 centos6.8_64 mini IP:192.168.10. ...

  2. ELK初学搭建(logstash)

    ELK初学搭建(logstash) elasticsearch logstash kibana ELK初学搭建 logstash 1.环境准备 centos6.8_64 mini IP:192.168 ...

  3. ELK初学搭建

    目录:基础准备 修改相关系统配置 安装elasticsearch 安装 kibana 安装logstash X-pack插件的安装 登录网页查看 ELK名字解释 ELK就是ElasticSearch ...

  4. 【linux】【ELK】搭建Elasticsearch+Logstash+Kibana+Filebeat日志收集系统

    前言 ELK是Elasticsearch.Logstash.Kibana的简称,这三者是核心套件,但并非全部. Elasticsearch是实时全文搜索和分析引擎,提供搜集.分析.存储数据三大功能:是 ...

  5. ELK系列(1) - Elasticsearch + Logstash + Kibana + Log4j2快速入门与搭建用例

    前言 最近公司分了个ELK相关的任务给我,在一边学习一边工作之余,总结下这些天来的学习历程和踩坑记录. 首先介绍下使用ELK的项目背景:在项目的数据库里有个表用来存储消息队列的消费日志,这些日志用于开 ...

  6. 搭建ELK日志分析平台(上)—— ELK介绍及搭建 Elasticsearch 分布式集群

    笔记内容:搭建ELK日志分析平台(上)-- ELK介绍及搭建 Elasticsearch 分布式集群笔记日期:2018-03-02 27.1 ELK介绍 27.2 ELK安装准备工作 27.3 安装e ...

  7. ELK+redis搭建nginx日志分析平台

    ELK+redis搭建nginx日志分析平台发表于 2015-08-19   |   分类于 Linux/Unix   |  ELK简介ELKStack即Elasticsearch + Logstas ...

  8. 使用elk+redis搭建nginx日志分析平台

    elk+redis 搭建nginx日志分析平台 logstash,elasticsearch,kibana 怎么进行nginx的日志分析呢?首先,架构方面,nginx是有日志文件的,它的每个请求的状态 ...

  9. linux下利用elk+redis 搭建日志分析平台教程

    linux下利用elk+redis 搭建日志分析平台教程 http://www.alliedjeep.com/18084.htm   elk 日志分析+redis数据库可以创建一个不错的日志分析平台了 ...

随机推荐

  1. 【实习记】2014-08-20实习的mini项目总结

        实习项目总结文档 项目介绍 项目逻辑很简单,只有几个页面,只能登录,查看,支付和退款.主要作用是熟悉C++的cgi的web服务开发方式. 项目页面截图 图一:登录页面 图二:买家查看 图三:买 ...

  2. 【实习记】2014-08-18使用curl排错http头的content-length

        总结一,用curl排错Content-Length设置错误,误导了客户端. 访问/cgi-bin/txproj_list时,firebug显示总是不多不少15秒,调试其他问题时郁闷. fire ...

  3. 闭包 this,arguemnts 问题

    因为每个函数在被调用时,其活动对象都会自动取得两个特殊的变量,this和arguments.内部函数的搜索这两个变量时,只会搜索到其活动对象为止.因此永远不可能直接访问到外部函数中的这两个变量     ...

  4. [转] 小tip: 使用CSS将图片转换成模糊(毛玻璃)效果 ---张鑫旭

    by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=3804 去年盛夏之时, ...

  5. [BZOJ 1040] [ZJOI2008] 骑士 【基环+外向树DP】

    题目链接:BZOJ - 1040 题目分析 这道题目的模型就是一个图,不一定联通,每个连通块的点数等于边数. 每个连通块都是一个基环+外向树.即树上增加了一条边. 如果是树,就可以直接树形DP了.然而 ...

  6. Lunch Time

    hdu4807:http://acm.hdu.edu.cn/showproblem.php?pid=4807 题意:给你n个点(0--n-1),点之间是有向边,0号点有k个人,现在0号点的k个人要到n ...

  7. 集群-Session解决方案

    在集群中session安全和同步是个最大的问题,下面是收集到的几种session同步的方案,希望能通过分析其各自的优劣找出其适应的场景. 1. 客户端cookie加密 简单,高效.比较好的方法是自己采 ...

  8. lc面试准备:Implement Stack using Queues

    1 题目 Implement the following operations of a stack using queues. push(x) -- Push element x onto stac ...

  9. Oracle 搜集统计信息

    常用的统计信息收集脚本: 非分区表: BEGIN   DBMS_STATS.GATHER_TABLE_STATS(ownname          => 'SCOTT',             ...

  10. 实例讲解MSSQL日期相加减比大小函数 转

    1. 当前系统日期.时间select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值例如:向日期加上2天select dateadd(day ...