centos6 - elk基础入门搭建
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6 - elk基础入门搭建相关的知识,希望对你有一定的参考价值。
[[email protected] ~]# rm -rf /etc/yum.repos.d/* [[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo [[email protected] ~]# yum clean all [[email protected] ~]# yum -y install java-1.8.0-openjdk* [[email protected] ~]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.rpm [[email protected] ~]# rpm -ivh elasticsearch-5.5.0.rpm [[email protected] ~]# chkconfig --add elasticsearch
[[email protected] ~]# cat /etc/hosts 192.168.53.108 elk1
[[email protected] ~]# 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: "*"
[[email protected] ~]# cat /etc/elasticsearch/jvm.options | grep -v ‘^#‘ | grep -v ^$ #修改 -Xms6g -Xmx6g
[[email protected] ~]# vim /etc/security/limits.conf * soft nofile 1000000 * hard nofile 1000000 * soft nproc 1000000 * hard nproc 1000000
[[email protected] ~]# cat /etc/security/limits.d/90-nproc.conf * soft nproc 100000 root soft nproc unlimited
[[email protected] ~]# cd /usr/local/ [[email protected] local]# git clone git://github.com/mobz/elasticsearch-head.git [[email protected] local]# wget https://nodejs.org/dist/v8.2.0/node-v8.2.0-linux-x64.tar.gz --no-check-certificate [[email protected] local]# tar zxf node-v8.2.0-linux-x64.tar.gz [[email protected] local]# ln -s /usr/local/node-v8.2.0-linux-x64/bin/node /usr/sbin/node [[email protected] local]# ln -s /usr/local/node-v8.2.0-linux-x64/bin/npm /usr/sbin/npm
# 设置npm代理镜像 [[email protected] local]# npm config set registry https://registry.npm.taobao.org [[email protected] local]# npm install -g grunt [[email protected]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 [[email protected] local]# cd elasticsearch-head/
[[email protected] 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 [email protected] license should be a valid SPDX license expression npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: `node install.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] 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
[[email protected] elasticsearch-head]# npm install [email protected] --ignore-scripts [[email protected] elasticsearch-head]# npm install
[[email protected] 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";
[[email protected] elasticsearch-head]# vim /usr/local/elasticsearch-head/Gruntfile.js connect: { server: { options: { hostname: "0.0.0.0", #添加此行 port: 9100, base: ‘.‘, keepalive: true } } }
[[email protected] elasticsearch-head]# grunt server & [[email protected] elasticsearch-head]# echo "cd /usr/local/elasticsearch-head;grunt server &" >> /etc/rc.local [[email protected] elasticsearch-head]# cd [[email protected] ~]# wget https://artifacts.elastic.co/downloads/logstash/logstash-5.5.0.rpm
[[email protected] ~]# 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}" } }
[[email protected] ~]# /usr/share/logstash/bin/logstash -f /etc/logstash/conf.d/system.conf
#在Elasticsearch中查看 # 浏览器访问http://192.168.53.108:9100/ 选择基本查询 搜素
[[email protected] ~]# wget https://artifacts.elastic.co/downloads/kibana/kibana-5.5.0-x86_64.rpm [[email protected] ~]# rpm -ivh kibana-5.5.0-x86_64.rpm
[[email protected] ~]# cat /etc/kibana/kibana.yml | grep -v ‘^#‘ | grep -v ^$ server.port: 5601 server.host: "0.0.0.0" elasticsearch.url: "http://elk1:9200"
[[email protected] ~]# /etc/init.d/kibana start [[email protected] ~]# chkconfig --add kibana
本文出自 “xieping_linux” 博客,请务必保留此出处http://xieping.blog.51cto.com/3715452/1951765
以上是关于centos6 - elk基础入门搭建的主要内容,如果未能解决你的问题,请参考以下文章
基础组件3zookeeper入门centos6.8环境下部署zookeeper集群
Linux从入门到放弃零基础入门Linux(第三篇):在虚拟机vmware中安装linux超详细手把手教你安装centos6分步图解