ELK部署

环境准备

Elk平台环境

系统

版本

服务器操作系统

Centos release 6.7 (Final)

ElasticSearch

2.3.4

Logstash

2.3.4

Kibana

4.5.3

Jdk

1.8

JDK安装略

软件下载

wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.3.4/elasticsearch-2.3.4.tar.gz

wget https://download.elastic.co/logstash/logstash/logstash-2.3.4.tar.gz

wget https://download.elastic.co/kibana/kibana/kibana-4.5.3-linux-x64.tar.gz

wget http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz

安装ES

tar zxvf elasticsearch-2.3.4.tar.gz

cd elasticsearch-2.3.4

安装head插件

./bin/plugin install mobz/elasticsearch-head

配置单点ES

修改elasticsearch.yml

cluster.name、node.name、network.host、path.logs、path.data

启动ES

查看ES web

http://10.0.2.199:9200/_plugin/head/

安装redis(做为缓存)

wget http://download.redis.io/releases/redis-3.2.5.tar.gz

tar xvzf redis-3.2.5.tar.gz

cd redis-3.2.5

make && make install


安装logstash

解压logstash tar包即可

添加config文件增加需要往ES添加数据的索引index.conf

示例:

input {
  redis {
    host => "10.0.2.199"
    port => "6379"
    data_type => "list"
    key => "mysql"
    type => "mysql"
  }
  redis {
    host => "10.0.2.199"
    port => "6379"
    data_type => "list"
    key => "nlp"
    type => "nlp"
  }
}
output {
     if [type] == "mysql"{
       elasticsearch {
         hosts => "10.0.2.199"
         index => "yantai_mysql"
       }
     }
     else if [type] == "nlp"{
       elasticsearch {
         hosts => "10.0.2.199"
         index => "yantai_nlp"
       }
     }
}

logstash客户端示例

input {
   file {
       type => "mysql"
       path => "/opt/docker_data/docker_mnt/mysql/mysqld.log"
       start_position => "beginning"
   }
   file {
       type => "nlp"
       path => "/opt/docker_data/docker_mnt/nlp-disease/nlp.log"
       start_position => "beginning"
   }  
}
filter {


}
output {
    stdout {
    }


     if [type] == "mysql"{
        redis {
           host => "10.0.2.199"
           port => 6379
           data_type => "list"
           key => "mysql"
        }
     }
     else if [type] == "nlp"{
        redis {
           host => "10.0.2.199"
           port => 6379
           data_type => "list"
           key => "nlp"
         }
     }
}

启动kibana

在kibana中添加ES当中索引的名字即可看到数据



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值