[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
[root@host-192-168-53-108~]#cat/etc/hosts
192.168.53.108elk1
[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
*softnofile1000000
*hardnofile1000000
*softnproc1000000
*hardnproc1000000
[root@host-192-168-53-108~]#cat/etc/security/limits.d/90-nproc.conf
*softnproc100000
rootsoftnprocunlimited
[root@host-192-168-53-108~]#cd/usr/local/
[root@host-192-168-53-108local]#gitclonegit://github.com/mobz/elasticsearch-head.git
[root@host-192-168-53-108local]#wgethttps://nodejs.org/dist/v8.2.0/node-v8.2.0-linux-x64.tar.gz--no-check-certificate
[root@host-192-168-53-108local]#tarzxfnode-v8.2.0-linux-x64.tar.gz
[root@host-192-168-53-108local]#ln-s/usr/local/node-v8.2.0-linux-x64/bin/node/usr/sbin/node
[root@host-192-168-53-108local]#ln-s/usr/local/node-v8.2.0-linux-x64/bin/npm/usr/sbin/npm
#设置npm代理镜像
[root@host-192-168-53-108local]#npmconfigsetregistryhttps://registry.npm.taobao.org
[root@host-192-168-53-108local]#npminstall-ggrunt
[root@host-192-168-53-108local]#ln-s/usr/local/node-v8.2.0-linux-x64/lib/node_modules/grunt/bin/grunt/usr/sbin/grunt
[root@host-192-168-53-108local]#cdelasticsearch-head/
[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:Unsupportedplatformforfsevents@1.1.2:wanted{"os":"darwin","arch":"any"}(current:{"os":"linux","arch":"x64"})
npmERR!codeELIFECYCLE
npmERR!errno1
npmERR!phantomjs-prebuilt@2.1.14install:`nodeinstall.js`
npmERR!Exitstatus1
npmERR!
npmERR!Failedatthephantomjs-prebuilt@2.1.14installscript.
npmERR!Thisisprobablynotaproblemwithnpm.Thereislikelyadditionalloggingoutputabove.
npmERR!Acompletelogofthisruncanbefoundin:
npmERR!/root/.npm/_logs/2017-07-26T11_29_47_063Z-debug.log
[root@host-192-168-53-108elasticsearch-head]#npminstallphantomjs-prebuilt@2.1.14--ignore-scripts
[root@host-192-168-53-108elasticsearch-head]#npminstall
[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";
[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
}
}
}
[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
[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~]#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
[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/kibanastart
[root@host-192-168-53-108~]#chkconfig--addkibana
原文链接:https://www.f2er.com/centos/376557.html