redis伺服器及採集端設定

來源:互聯網
上載者:User

標籤:redis配置

redis(logstash).conf內容                #服務端配置,logstash抓取redis資料,配置名自取

 

例一                          #從redis讀資料

input {

   redis {

       host => "127.0.0.1"

       port => 6379

       type => "redis-input"

       data_type => "list"

       key => "logstash:redis"

    }

}

 

output {                                          #輸出到ela

  

   stdout {}

   elasticsearch {

       cluster => "elasticsearch"

       codec => "json"

        protocol => "http"

    }

}

 

例二                                          #從redis讀資料

 

  input {

 redis { 

   host => ‘192.168.233.130‘ 

   data_type => ‘list‘ 

   port => "6379" 

   key => ‘logstash:redis‘ 

   type => ‘redis-input‘ 

        } 

        }

   

 output {                               #輸出到ela

     elasticsearch { 

     embedded => true 

                   } 

        } 

 

 

 

logstash-kibama 9292

logstash-redis 6379

logstash-elasticsearch 9200
kibana 5601
 
 

 # vim redis(logstash).conf                                #日誌收集端配置,logstash集被監聽記錄檔資料,配置名自取

 
  input {                                      #收集監控端記錄檔
      file {
      type => "producer"
      path => "/soft/apache.log"
      }
      file {
      type => "php-log"
      path => "/soft/php.log"
      }
  }
  filter {    # 日誌內容裡面只要有匹配 mysql或GET或error的內容就                   會被過濾出來,發送到 logstash index
         grep {
         match => [ "@message", "mysql|GET|error" ]
              }
         }
   
  output {                            #將收集的記錄檔發送到redis
        redis {
        host => ‘192.168.233.130‘
        data_type => ‘list‘
        key => ‘logstash:redis‘
         }
         }
 



測試程式發送資料 -> Redis訊息佇列 -> Logstash -> Elasticsearch叢集
 

 通過管線化的思路增加索引速度

為瞭解決Redis隊列的瓶頸問題,使用多管線機制,來增加整個系統的輸送量,為此,我們同時部署了多個Redis執行個體,和對應數量的Logstash執行個體:

測試程式發送資料 -> Redis訊息佇列1 ->Logstash1 -> Elasticsearch叢集

測試程式發送資料 -> Redis訊息佇列2 ->Logstash2 -> Elasticsearch叢集

測試程式發送資料 -> Redis訊息佇列3 ->Logstash3 -> Elasticsearch叢集

...

採用管線機制的好處是,擴充性是顯而易見的
 


本文出自 “雲之上” 部落格,請務必保留此出處http://weimouren.blog.51cto.com/7299347/1732075

redis伺服器及採集端設定

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.