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.repohttp://mirrors.aliyun.com/repo/Centos-6.repo [root@host-192-168-53-108~] #yumcleanall [root@host-192-168-53-108~] #yum-yinstalljava-1.8.0-openjdk* [root@host-192-168-53-108~] #wgethttps://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.rpm [root@host-192-168-53-108~] #rpm-ivhelasticsearch-5.5.0.rpm [root@host-192-168-53-108~] #chkconfig--addelasticsearch 1 2 [root@host-192-168-53-108~] #cat/etc/hosts 192.168.53.108elk1 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 *softnofile1000000 *hardnofile1000000 *softnproc1000000 *hardnproc1000000 1 2 3 [root@host-192-168-53-108~] #cat/etc/security/limits.d/90-nproc.conf *softnproc100000 rootsoftnprocunlimited 1 2 3 4 5 6 [root@host-192-168-53-108~] #cd/usr/local/ [root@host-192-168-53-108 local ] #gitclonegit://github.com/mobz/elasticsearch-head.git [root@host-192-168-53-108 local ] #wgethttps://nodejs.org/dist/v8.2.0/node-v8.2.0-linux-x64.tar.gz--no-check-certificate [root@host-192-168-53-108 local ] #tarzxfnode-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 ] #npmconfigsetregistryhttps://registry.npm.taobao.org [root@host-192-168-53-108 local ] #npminstall-ggrunt [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 ] #cdelasticsearch-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-108elasticsearch- head ] #npminstall Errormakingrequest. Error:connectETIMEDOUT52.216.1.0:443 atObject.exports._errnoException(util.js:1024:11) atexports._exceptionWithHostPort(util.js:1047:20) atTCPConnectWrap.afterConnect[asoncomplete](net.js:1150:14) Pleasereportthisfulllogathttps: //github .com /Medium/phantomjs npmWARNelasticsearch- head @0.0.0licenseshouldbeavalidSPDXlicenseexpression npmWARNoptionalSKIPPINGOPTIONALDEPENDENCY:fsevents@1.1.2(node_modules /fsevents ): npmWARNnotsupSKIPPINGOPTIONALDEPENDENCY:Unsupportedplatform for fsevents@1.1.2:wanted{ "os" : "darwin" , "arch" : "any" }(current:{ "os" : "linux" , "arch" : "x64" }) npmERR!codeELIFECYCLE npmERR!errno1 npmERR!phantomjs-prebuilt@2.1.14 install :`node install .js` npmERR!Exitstatus1 npmERR! npmERR!Failedatthephantomjs-prebuilt@2.1.14 install script. npmERR!Thisisprobablynotaproblemwithnpm.Thereislikelyadditionalloggingoutputabove. npmERR!Acompletelogofthisruncanbefound in : npmERR! /root/ .npm /_logs/2017-07-26T11_29_47_063Z-debug .log 1 2 [root@host-192-168-53-108elasticsearch- head ] #npminstallphantomjs-prebuilt@2.1.14--ignore-scripts [root@host-192-168-53-108elasticsearch- head ] #npminstall 1 2 3 4 [root@host-192-168-53-108elasticsearch- 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-108elasticsearch- 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-108elasticsearch- head ] #gruntserver& [root@host-192-168-53-108elasticsearch- head ] #echo"cd/usr/local/elasticsearch-head;gruntserver&">>/etc/rc.local [root@host-192-168-53-108elasticsearch- head ] #cd [root@host-192-168-53-108~] #wgethttps://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~] #wgethttps://artifacts.elastic.co/downloads/kibana/kibana-5.5.0-x86_64.rpm [root@host-192-168-53-108~] #rpm-ivhkibana-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/kibanastart [root@host-192-168-53-108~] #chkconfig--addkibana 本文转自谢无赖51CTO博客,原文链接:http://blog.51cto.com/xieping/1951765,如需转载请自行联系原作者