centos6 - elk基础入门搭建

简介:
1
2
3
4
5
6
7
[root@host-192-168-53-108 ~] # rm -rf /etc/yum.repos.d/*
[root@host-192-168-53-108 ~] # wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
[root@host-192-168-53-108 ~] # yum clean all
[root@host-192-168-53-108 ~] # yum -y install java-1.8.0-openjdk*
[root@host-192-168-53-108 ~] # wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.rpm
[root@host-192-168-53-108 ~] # rpm -ivh elasticsearch-5.5.0.rpm
[root@host-192-168-53-108 ~] # chkconfig --add elasticsearch
1
2
[root@host-192-168-53-108 ~] # cat /etc/hosts
192.168.53.108 elk1
1
2
3
4
5
6
7
8
9
[root@host-192-168-53-108 ~] # cat /etc/elasticsearch/elasticsearch.yml
node.name: elk1
network.host: 192.168.53.108
http.port: 9200
bootstrap.memory_lock:  false
bootstrap.system_call_filter:  false
discovery.zen. ping .unicast.hosts: [elk1]
http.cors.enabled:  true
http.cors.allow-origin:  "*"
1
2
3
4
[root@host-192-168-53-108 ~] # cat /etc/elasticsearch/jvm.options | grep -v '^#' | grep -v ^$
#修改
-Xms6g
-Xmx6g
1
2
3
4
5
[root@host-192-168-53-108 ~] # vim /etc/security/limits.conf 
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 1000000
* hard nproc 1000000
1
2
3
[root@host-192-168-53-108 ~] # cat /etc/security/limits.d/90-nproc.conf 
*          soft    nproc     100000
root       soft    nproc     unlimited
1
2
3
4
5
6
[root@host-192-168-53-108 ~] # cd /usr/local/
[root@host-192-168-53-108  local ] # git clone git://github.com/mobz/elasticsearch-head.git
[root@host-192-168-53-108  local ] # wget https://nodejs.org/dist/v8.2.0/node-v8.2.0-linux-x64.tar.gz --no-check-certificate
[root@host-192-168-53-108  local ] # tar zxf node-v8.2.0-linux-x64.tar.gz 
[root@host-192-168-53-108  local ] # ln -s /usr/local/node-v8.2.0-linux-x64/bin/node /usr/sbin/node
[root@host-192-168-53-108  local ] # ln -s /usr/local/node-v8.2.0-linux-x64/bin/npm /usr/sbin/npm
1
2
3
4
5
# 设置npm代理镜像
[root@host-192-168-53-108  local ] # npm config set registry https://registry.npm.taobao.org
[root@host-192-168-53-108  local ] # npm install -g grunt
[root@host-192-168-53-108  local ] # ln -s /usr/local/node-v8.2.0-linux-x64/lib/node_modules/grunt/bin/grunt /usr/sbin/grunt
[root@host-192-168-53-108  local ] # cd elasticsearch-head/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@host-192-168-53-108 elasticsearch- head ] # npm install
Error making request.
Error: connect ETIMEDOUT 52.216.1.0:443
     at Object.exports._errnoException (util.js:1024:11)
     at exports._exceptionWithHostPort (util.js:1047:20)
     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1150:14)
Please report this full log at https: //github .com /Medium/phantomjs
npm WARN elasticsearch- head @0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules /fsevents ):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform  for  fsevents@1.1.2: wanted { "os" : "darwin" , "arch" : "any" } (current: { "os" : "linux" , "arch" : "x64" })
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.14  install : `node  install .js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.14  install  script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found  in :
npm ERR!      /root/ .npm /_logs/2017-07-26T11_29_47_063Z-debug .log
1
2
[root@host-192-168-53-108 elasticsearch- head ] # npm install phantomjs-prebuilt@2.1.14 --ignore-scripts
[root@host-192-168-53-108 elasticsearch- head ] # npm install
1
2
3
4
[root@host-192-168-53-108 elasticsearch- head ] # vim /usr/local/elasticsearch-head/_site/app.js
# 把localhost改为ip
this.base_uri = this.config.base_uri || this.prefs.get( "app-base_uri" ) ||  "http://localhost:9200" ;
this.base_uri = this.config.base_uri || this.prefs.get( "app-base_uri" ) ||  "http://192.168.53.108:9200" ;
1
2
3
4
5
6
7
8
9
10
11
[root@host-192-168-53-108 elasticsearch- head ] # vim /usr/local/elasticsearch-head/Gruntfile.js
connect: {
     server: {
         options: {                                                                                                                                                                                                                                                    
             hostname "0.0.0.0" #添加此行
             port: 9100,
             base:  '.' ,
             keepalive:  true
         }   
     }   
}
1
2
3
4
[root@host-192-168-53-108 elasticsearch- head ] # grunt server &
[root@host-192-168-53-108 elasticsearch- head ] # echo "cd /usr/local/elasticsearch-head;grunt server &" >> /etc/rc.local 
[root@host-192-168-53-108 elasticsearch- head ] # cd
[root@host-192-168-53-108 ~] # wget https://artifacts.elastic.co/downloads/logstash/logstash-5.5.0.rpm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@host-192-168-53-108 ~] # vim /etc/logstash/conf.d/system.conf
input {
  file  {
     path =>  "/var/log/messages"
     type  =>  "systemlog"
     start_position =>  "beginning"
     stat_interval =>  "2"
   }
}
output {
   elasticsearch {
     hosts => [ "192.168.53.108:9200" ]
     index =>  "logstash-systemlog-%{+YYYY.MM.dd}"
   }
}
1
[root@host-192-168-53-108 ~] # /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/system.conf
1
2
#在Elasticsearch中查看
# 浏览器访问http://192.168.53.108:9100/  选择基本查询 搜素
1
2
[root@host-192-168-53-108 ~] # wget https://artifacts.elastic.co/downloads/kibana/kibana-5.5.0-x86_64.rpm
[root@host-192-168-53-108 ~] # rpm -ivh kibana-5.5.0-x86_64.rpm
1
2
3
4
[root@host-192-168-53-108 ~] # cat /etc/kibana/kibana.yml | grep -v '^#' | grep -v ^$
server.port: 5601
server.host:  "0.0.0.0"
elasticsearch.url:  "http://elk1:9200"
1
2
[root@host-192-168-53-108 ~] # /etc/init.d/kibana start
[root@host-192-168-53-108 ~] # chkconfig --add kibana

































































本文转自谢无赖51CTO博客,原文链接:http://blog.51cto.com/xieping/1951765 ,如需转载请自行联系原作者




相关实践学习
以电商场景为例搭建AI语义搜索应用
本实验旨在通过阿里云Elasticsearch结合阿里云搜索开发工作台AI模型服务,构建一个高效、精准的语义搜索系统,模拟电商场景,深入理解AI搜索技术原理并掌握其实现过程。
ElasticSearch 最新快速入门教程
本课程由千锋教育提供。全文搜索的需求非常大。而开源的解决办法Elasricsearch(Elastic)就是一个非常好的工具。目前是全文搜索引擎的首选。本系列教程由浅入深讲解了在CentOS7系统下如何搭建ElasticSearch,如何使用Kibana实现各种方式的搜索并详细分析了搜索的原理,最后讲解了在Java应用中如何集成ElasticSearch并实现搜索。  
相关文章
|
消息中间件 监控 数据可视化
一口气完成ELK 日志平台的搭建,我感觉我又行了!
最近在玩 ELK 日志平台,它是 Elastic 公司推出的一整套日志收集、分析和展示的解决方案。
|
消息中间件 数据采集 监控
ELK搭建(五):linux系统日志监控平台搭建
现在的生产系统多使用linux系统,在实际生产过程中我们除了需要监控一些业务日志之外,有时也需要监控linux系统本身的日志,来帮助我们进行一些排错和判断。那么这一期,我们就针对linux系统日志监控平台的搭建来进行讲解 与往期一样,我们针对实际搭建教程更多是快速搭建为主,不做过多的原理性讲解,这一类讲解我们放到后期单独开几期博客来探讨。
1400 0
ELK搭建(五):linux系统日志监控平台搭建
|
消息中间件 数据采集 监控
ELK搭建(四):监控mysql慢查询、错误日志日志
因为mysql免费、稳定以及还不错的性能,是当前市面上多数公司的数据库选择。在实际的生产环境中我们更需要及时知道数据库中的报错日志、慢日志等信息,来帮助我们进行排错和优化。 普通的到服务器上去查看日志的方式并不方便,特别是涉及到分布式部署时,因此我们需要一个统一的监控平台来实时、方便的查看这些日志数据。
1278 0
ELK搭建(四):监控mysql慢查询、错误日志日志
|
存储 Unix Linux
CentOS7下日志轮转logrotate简单入门与实践
CentOS7下日志轮转logrotate简单入门与实践
740 0
CentOS7下日志轮转logrotate简单入门与实践
ELK 圣经:Elasticsearch、Logstash、Kibana 从入门到精通
ELK是一套强大的日志管理和分析工具,广泛应用于日志监控、故障排查、业务分析等场景。本文档将详细介绍ELK的各个组件及其配置方法,帮助读者从零开始掌握ELK的使用。
|
Web App开发 缓存 运维
CentOS命令大全:从入门到精通
CentOS命令大全:从入门到精通
1894 1
|
自然语言处理 运维 监控
不能不学!从零到一搭建ELK日志,在Docker环境下部署 Elasticsearch 数据库
最近在玩 ELK 日志平台,它是 Elastic 公司推出的一整套日志收集、分析和展示的解决方案。
|
Ubuntu Oracle Unix
Linux系统入门-centos7安装
# 什么是Linux Linux,全称GNU/Linux,是一种免费使用和自由传播的类UNIX操作系统,其内核由林纳斯·本纳第克特·托瓦兹于1991年10月5日首次发布,它主要受到Minix和Unix思想的启发,是一个基于POSIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的Unix工具软件、应用程序和网络协议。它支持32位和64位硬件。Linux继承了Unix以网络为核心的设计思想,是一个性能稳定的多用户网络操作系统。Linux有上百种不同的发行版,如基于社区开发的debian、archlinux,和基于商业开发的Red Hat Enterprise Linux、SUSE
610 0
Linux系统入门-centos7安装
|
消息中间件 监控 NoSQL
ELK搭建(十三):搭建Nginx资源访问率、丢包率、读写率等运行性能监控平台
Nginx是一款轻量级、高性能的流量分发和反向代理的web服务。随着市场业务量的增加,普通的web容器,如tomcat的并发量已经远不能满足我们的业务量,同时随着分布式架构的普及,我们需要一款反向代理服务的支持,于是Nginx应运而生。 Nginx已经在大多数业务中普遍使用,因此针对Nginx的性能监控十分必要,这样我们才能实时掌握服务器请求情况和运行效率 所以今天,我们的目标就是搭建一个Nginx运行性能监控平台
580 0
ELK搭建(十三):搭建Nginx资源访问率、丢包率、读写率等运行性能监控平台
|
消息中间件 数据采集 监控
ELK搭建(十二):搭建Nginx访问、错误日志监控平台
Nginx是一款轻量级、高性能的流量分发和反向代理的web服务。随着市场业务量的增加,普通的web容器,如tomcat的并发量已经远不能满足我们的业务量,同时随着分布式架构的普及,我们需要一款反向代理服务的支持,于是Nginx应运而生。 Nginx已经在大多数业务中普遍使用,因此针对Nginx的流量监控,错误日志监控极其必要,这样才能让我们能够及时了解系统运行情况。 那么今天,我们就来看看如何搭建Nginx访问记录、错误日志监控平台
723 0
ELK搭建(十二):搭建Nginx访问、错误日志监控平台