1. 程式人生 > 實用技巧 >ELK-WEB中文版化-redis高效能加速

ELK-WEB中文版化-redis高效能加速

1、ELK-WEB中文漢化版支援:(kibana所在機器執行)
Kibana WEB平臺所有的欄位均顯示為英文,目前5.x版本預設沒有中文漢化版外掛或者漢化包(7.x版本支援漢化預設有漢化),感謝Github開源貢獻開發了漢化包,漢化包外掛地址:

https://github.com/anbai-inc/Kibana_Hanization

Kibana漢化方法此專案,適用於Kibana 5.x-6.x的任意版本,漢化過程不可逆,漢化前請注意備份! 漢化資源會慢慢更新完善,已漢化過的Kibana可以重複用此專案漢化更新的資源。
除一小部分資源外,大部分資源無需重啟Kibana,重新整理頁面即可看到效果,Kibana漢化方法和步驟如下:
1)Github倉庫下載Kibana中文漢化包,下載指令如下:

#git clone https://github.com/anbai-inc/Kibana_Hanization.git
wget http://bbs.jfedu.net/download/Kibana_Hanization_2018.tar.gz
tar xf Kibana_Hanization_2018.tar.gz

2)切換至Kibana_Hanization目錄,並且執行漢化過程:

cd Kibana_Hanization/
python main.py /usr/local/kibana/   (此處為系統kibana安裝路徑)

2、Redis高效能加速實戰:

wget http://download.redis.io/releases/redis-2.8.13.tar.gz tar zxf redis-2.8.13.tar.gz cd redis-2.8.13 make PREFIX=/usr/local/redis install cp redis.conf /usr/local/redis/ 將/usr/local/redis/bin/目錄加入至環境變數配置檔案/etc/profile末尾。然後shell終端執行 source /etc/profile讓環境變數生效: export PATH=/usr/local/redis/bin:$PATH nohup 後臺啟動及停止redis服務命令: nohup /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf & /usr/local/redis/bin/redis-cli -p 6379 shutdown redis 監聽埠改成0.0.0.0:(全網監聽)

3、ELK收集MYSQL日誌實戰:(logstash客戶端執行)
cd /usr/local/logstash/config/etc/, 建立如下配置檔案,程式碼如下:
1) 日誌採集-存入redis快取資料庫:

touch agent.conf
input {
 file {
 type => "mysql-access"
 path => "/var/log/mysqld.log"
 }
}
output {
 redis {
 host => "localhost"
 port => 6379
 data_type => "list"
 key => "logstash
" } }

後臺啟動agent:
nohup /usr/local/logstash/bin/logstash -f agent.conf &

2)Redis資料-存入ES:

cd /usr/local/logstash/config/etc/;touch index.conf
input {
 redis {
 host => "localhost"
 port => "6379"
 data_type => "list"
 key => "logstash"
 type => "redis-input"
 batch_count => 1
 }
}
output {
 elasticsearch {
 hosts => "192.168.1.11:9200"
 }
}
啟動index.conf:
nohup /usr/local/logstash/bin/logstash -f index.conf &
檢視程序:
ps -ef|grep java

檢視Redis快取:

redis-cli monitor 實時檢視/監控redis有沒有在接收日誌