首页 > 其他 > 详细

centos6 - elk基础入门搭建

时间:2017-07-28 22:04:05      阅读:527      评论:0      收藏:0      [点我收藏+]
[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
[root@host-192-168-53-108 ~]# cat /etc/hosts
192.168.53.108 elk1
[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: "*"
[root@host-192-168-53-108 ~]# cat /etc/elasticsearch/jvm.options | grep -v ‘^#‘ | grep -v ^$
#修改
-Xms6g
-Xmx6g
[root@host-192-168-53-108 ~]# vim /etc/security/limits.conf 
* soft nofile 1000000
* hard nofile 1000000
* soft nproc 1000000
* hard nproc 1000000
[root@host-192-168-53-108 ~]# cat /etc/security/limits.d/90-nproc.conf 
*          soft    nproc     100000
root       soft    nproc     unlimited
[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
# 设置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/
[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
[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
[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";
[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
        }   
    }   
}
[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
[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}"
  }
}
[root@host-192-168-53-108 ~]# /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/system.conf
#在Elasticsearch中查看
# 浏览器访问http://192.168.53.108:9100/  选择基本查询 搜素
[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
[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"
[root@host-192-168-53-108 ~]# /etc/init.d/kibana start
[root@host-192-168-53-108 ~]# chkconfig --add kibana




































































本文出自 “xieping_linux” 博客,请务必保留此出处http://xieping.blog.51cto.com/3715452/1951765

centos6 - elk基础入门搭建

原文:http://xieping.blog.51cto.com/3715452/1951765

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!