標籤:cli 表示 NPU style sed unknown lis 3.2 support
環境條件:
系統版本:centos 6.8
logstash版本:6.3.2
redis版本:2.4
logstash input配置:
input { redis { host => "172.16.73.33" #redis ip port => "52611" #redis 連接埠 password =>"123456" #redis 密碼 db => 9 # 指定redis 庫編號 data_type => "list" #資料類型 key => "filebeat" #key 值名稱 }}View Code問題:
1. 當我在上面的input的配置裡面沒有加上password參數的時候,會報下面的警告,千萬不要忘記配置密碼哦。
[2018-09-29T17:55:18,803][WARN ][logstash.inputs.redis ] Redis connection problem {:exception=>#<Redis::CommandError: ERR operation not permitted>}
2. 當我進行啟動logstash 的時候發現有如下警告。
[2018-09-29T18:18:06,764][WARN ][logstash.inputs.redis ] Redis connection problem {:exception=>#<Redis::CommandError: ERR unknown command ‘script‘>}
該問題是由於我們的redis版本導致的,我們採用的redis版本是2.4版本,
官方文檔這樣寫到:
官方文檔連結:https://www.elastic.co/guide/en/logstash/current/plugins-inputs-redis.html#_description_31
This input will read events from a Redis instance; it supports both Redis channels and lists. The list command (BLPOP) used by Logstash is supported in Redis v1.3.1+, and the channel commands used by Logstash are found in Redis v1.3.8+. While you may be able to make these Redis versions work, the best performance and stability will be found in more recent stable versions. Versions 2.6.0+ are recommended.For more information about Redis, see http://redis.io/batch_count note: If you use the batch_count setting, you must use a Redis version 2.6.0 or newer. Anything older does not support the operations used by batching.
雖然官方建議的是2.6版本以上,但是文檔的意思我們2.4版本也還是可以使用的。我們可以知道的一點就是,batch_count 參數要使用的時候一定得在2.6版本以上,接下來我們可以再看下另外一個文檔。
文檔連結:https://www.elastic.co/guide/en/logstash/current/plugins-inputs-redis.html#plugins-inputs-redis-batch_countbatch_countValue type is numberDefault value is 125The number of events to return from Redis using EVAL.
這裡告訴我們的是在新的版本中是已經預設加了batch_count 參數的,而且預設值為125。
這樣我們就找出了我們錯誤的原因,要支援參數 batch_count 需要2.6版本以上。那麼解決的辦法有兩種:
1 將redis版本升級。
2 我們不使用batch_count 參數。
由於我們這個redis裡面還有其他業務,所以我們升級版本這條路就走不通了,我們決定將 batch_count 的數值設定為1 ,用來表示我們每次從redis取回一條資料,這樣我們就可以正常的啟動logstash了。
input { redis { host => "172.16.73.33" #redis ip port => "52611" #redis 連接埠 password =>"123456" #redis 密碼 db => 9 # 指定redis 庫編號 batch_count => 1 # 這個預設值125,我們需要設定為1以支援redis2.6以下的版本。 data_type => "list" #資料類型 key => "filebeat" #key 值名稱 }}
以上就是我在使用logstash 遇到的問題 以及解決的辦法。希望能對你有些協助。
LogStash啟動報錯:<Redis::CommandError: ERR unknown command 'script'>與batch_count 的 配置