博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Kibana + ElasticSearch + Logstash + Redis on RHEL 6
阅读量:6622 次
发布时间:2019-06-25

本文共 4038 字,大约阅读时间需要 13 分钟。

系统各部分应用介绍:

  • Kibana:开源web展现

  • Elasticsearch:开源的搜索引擎框架logstash部分,可进行多数据集群,提高效率,从redis中读取数据,并转发到Kibana

  • Logstash:系统log收集,转载的工具,同时集成各类日志插件,对日志查询和分析的效率显著提高

  • Logstash shipper:收集log 并将log转发给redis 存储

  • Logstash indexer:从redis中读取数据并转发给elasticsearch

  • Redis:是db,logstash shipper将log转发到redis数据库中存储

部署:

1、jdk:

path:/usr/local/jdk7

cat /etc/profile

export JAVA_HOME=/usr/local/jdk7    

export PATH=$JAVA_HOME/bin:$PATH

export REDIS_HOME=/usr/local/redis-2.6.12

export ES_HOME=/usr/local/elasticsearch

export ES_CLASSPATH=$ES_HOME/config

2、ElasticSearch

wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gztar xvf elasticsearch-0.20.2.tar.gzmv elasticsearch-0.20.2 elasticsearch
cd /usr/local/elasticsearch/config
vim elasticsearch.yml

cluster.name: elasticsearch

node.name: "litong"
path.conf: /usr/local/elasticsearch
path.data: /usr/local/elasticsearch/data
path.work: /usr/local/elasticsearch/tmp
path.logs: /usr/local/elasticsearch/logs
bootstrap.mlockall: true
 
mkdir -p /usr/local/elasticsearch/data /usr/local/elasticsearch/tmp  /usr/local/elasticsearch/logs

3、Configure Java Service Wrapper

Get the service wrapper
wget http://github.com/elasticsearch/elasticsearch-servicewrapper/archive/master.zipunzip master.zipmv elasticsearch-servicewrapper-master/service/ /usr/local/elasticsearch/bin/rm -rf elasticsearch-servicewrapper-master/
 
vim service/elasticsearch.conf
set.default.ES_HOME=/usr/local/elasticsearchset.default.ES_HEAP_SIZE=1024                         #memorywrapper.java.additional.10=-Des.max-open-files=truewrapper.logfile.maxsize=5mwrapper.logfile.maxfiles=5
 
service:/etc/init.d/elasticsearch
bin/service/elasticsearch install
service elasticsearch start
 

4、ElasticSearch Head

bin/plugin -install mobz/elasticsearch-head
5、Redis

Install Redis server

wget http://redis.googlecode.com/files/redis-2.6.12.tar.gztar xzf redis-2.6.12.tar.gzmv redis-2.6.12 /usr/local/rediscd /usr/local/redismake
make install

5、Configure Redis – ‘cp redis.conf 6379.conf’

vim  6379.conf

daemonize yespidfile /var/run/redis/redis_6379.pidport 6379timeout 300tcp-keepalive 60logfile /var/log/redis/redis_6379.log

Add REDIS home to root user’s ‘.bash_profile’

# Redisexport REDIS_HOME=/usr/local/redis

Copy Redis init script

cp utils/redis_init_script /etc/init.d/redis_6379

Configure Redis init script

# chkconfig:   - 85 15# description: Redis is a persistent key-value database# processname: redisREDISPORT=6379EXEC=/usr/local/redis/src/redis-serverCLIEXEC=/usr/local/redis/src/redis-cliPIDFILE=/var/run/redis/redis_6379.pidCONF="/usr/local/redis/6379.conf"

Activate Redis service

mkdir /var/run/redis /var/log/rediscd /etc/init.dchkconfig --add redis

Start

service redis start
6、Logstash
mkdir /usr/local/logstashcd /usr/local/logstashwget
Indexer configuration – indexer.conf:

input {   

 redis {   
   host => "192.168.0.235"   
   port => "6379"   
   type => "redis-input"   
   data_type => "list"   
   key => "logstash"   
   format => "json_event"   
 }   
}

output {   

 stdout { debug => true debug_format => "json"}

 elasticsearch {   

   host => "192.168.0.235"   
   port => "9300"   
   cluster => "elasticsearch"   
 }   
}

Shipper configuration – shipper.conf:

input {   

 file {   
   type => "nginx"   
   path => ["/usr/local/nginx/logs/*.log"]

   exclude => ["*.gz"]

   tags => ["nginx"]   

 }   
}

output {   

 stdout { debug => true debug_format => "json"}

 redis {   

   host => "192.168.0.235"   
   data_type => "list"   
   key => "logstash"   
 }   
}

java -jar logstash-1.1.9-monolithic.jar agent -f indexer.conf &java -jar logstash-1.1.9-monolithic.jar agent -f shipper.conf &
7、Kibana

Setup Ruby

yum install ruby ruby-devel ruby-ri ruby-rdoc rubygems
wget http://production.cf.rubygems.org/rubygems/rubygems-2.0.3.zipunzip rubygems-2.0.3.zipruby rubygems-2.0.3/setup.rb

Get Kibana

wget https://github.com/rashidkpc/Kibana/archive/v0.2.0.zipunzip v0.2.0.zipcd Kibana-0.2.0gem install bundlerbundle install
Configure KibanaConfig.rb:
Elasticsearch = "192.168.0.235:9200"KibanaPort = 80KibanaHost = '192.168.0.235'

Run Kibana

bundle exec ruby kibana.rb
本文转自 Art_Hero 51CTO博客,原文链接:http://blog.51cto.com/curran/1263416,如需转载请自行联系原作者
你可能感兴趣的文章
input输入框下横线动画实现+自动填充
查看>>
8.Appium的基本使用-1
查看>>
[LeetCode]Wiggle Sort
查看>>
github提交用户权限被拒
查看>>
Npoi导出Word
查看>>
String.replace使用技巧
查看>>
Could not open php://output for writing.问题解决
查看>>
Python3与OpenCV3.3 图像处理(二十六)--分水岭算法(纯代码)
查看>>
python手写bp神经网络实现人脸性别识别1.0
查看>>
ios视频网盘
查看>>
网站综合渗透及实例演示一.zip
查看>>
BZOJ 4425: [Nwerc2015]Assigning Workstations分配工作站
查看>>
回归测试
查看>>
音乐搜索并生成播放功能
查看>>
cesium(相机)
查看>>
android 避免线程的重复创建(HandlerThread、线程池)
查看>>
手游-放开那三国socket协议分析
查看>>
Python学习第二天-编写三级菜单
查看>>
leetcode290
查看>>
003-对象——对象的释放 抽象 封装 继承 多态
查看>>