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 ,如需转载请自行联系原作者




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值