ELK7.1.1之插件安裝


       在5.0版本之后不支持直接把插件包放入es安裝目錄的plugin目錄下,需要單獨安裝;而且支持在線安裝的插件很少,很多都是需要離線安裝。以前的plugin變為elasticsearch-plugin

       獲取在線安裝的插件:

./elasticsearch-plugin install -h
Install a plugin
The following official plugins may be installed by name:
  analysis-icu
  analysis-kuromoji
  analysis-nori
  analysis-phonetic
  analysis-smartcn
  analysis-stempel
  analysis-ukrainian
  discovery-azure-classic
  discovery-ec2
  discovery-gce
  ingest-attachment
  mapper-annotated-text
  mapper-murmur3
  mapper-size
  repository-azure
  repository-gcs
  repository-hdfs
  repository-s3
  store-smb
  transport-nio

  接下來我們介紹幾款常用插件的安裝:

head插件

1.安裝環境支持,需要安裝nodejs

yum install -y nodejs npm

2.下載head插件

cd /usr/local/
git clone git://github.com/mobz/elasticsearch-head.git

3.安裝依賴包

cd /usr/local/elasticsearch-head
npm install 
#執行后會生成node_modules文件夾

如果遇到異常cnpm不是內部或外部命令 cnpm: command not found,則運行如下腳本,使用淘寶鏡像包

npm install cnpm -g --registry=https://registry.npm.taobao.org
cnpm install

修改配置文件

2.修改Gruntfile.js
cd elasticsearch-head

cd /usr/local/elasticsearch-head
vim Gruntfile.js

在該文件中添加如下,務必注意不要漏了添加“,”號,這邊的hostname:’*’,表示允許所有IP可以訪問,此處也可以修改端口號

server: {
options: {
hostname: '*',
port: 9100,
base: '.',
keepalive: true
}
}

3.修改elasticsearch-head默認連接地址

cd _site
vi app.js

做如下修改,將ip地址修改為對應的服務器的ip地址
將localhost修改為elasticSearch IP

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.0.0.11:9200";

4.修改elasticSearch配置文件並啟動ElasticSearch
這邊需要修改elasticsearch的配置文件elasticsearch.yml,以允許跨域訪問,在文末追加如下代碼即可

http.cors.enabled: true
http.cors.allow-origin: "*"

5.修改完畢后重新啟動ElasticSearch(注意不能使用root權限啟動)

6.啟動elasticsearch-head

cd /usr/local/elasticsearch-head
nohup ./node_modules/grunt/bin/grunt server &

訪問10.0.0.11:9100就能看到我們集群信息

一鍵腳本:

vim head_install.sh

#!/bin/sh work_dir=/usr/local node=`ip a s eth0|awk -F"[ /]+" 'NR==3{print $3}'` yum install -y nodejs npm cd ${work_dir} git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head npm install sed -ri.bak "s/9100,/9100\,\n hostname: \'\*\'\,/" Gruntfile.js cd _site sed -ri.bak "s/localhost/${node}/" app.js cat <<EOF >/root/head_start.sh #!/bin/sh work_dir=${work_dir} { while true
do n=\$(ps -ef|grep -c [g]runt) if [ \$n -eq 0 ];then cd \${work_dir}/elasticsearch-head nohup ./node_modules/grunt/bin/grunt server & fi sleep 60s done }& EOF chmod +x /root/head_start.sh /root/head_start.sh

 

Bigdesk插件

1、下載

cd /usr/local/ git clone https://github.com/hlstudio/bigdesk

2、啟動web服務器,默認監聽端口號8000,指定啟動端口,並后台啟動

cd /usr/local/bigdesk/_site nohup python -m SimpleHTTPServer &

此時通過訪問web界面來監控我們的集群狀態。
http://10.0.0.11:8000

cerebro插件

1、下載cerebro插件:
git項目:https://github.com/lmenezes/cerebro/releases

wget https://github.com/lmenezes/cerebro/releases/download/v0.8.3/cerebro-0.8.3.tgz

2、上傳到安裝目錄、解壓:

tar xf cerebro-0.8.3.tgz -C /usr/local/src/ ln -s /usr/local/src/cerebro-0.8.3 /usr/local/cerebro

3、啟動cerebro

cd /usr/local/cerebro nohup ./bin/cerebro &

4、瀏覽器訪問10.0.0.11:9000

連接集群http://10.0.0.11:9000
就能看到數據分片信息。

分詞器

項目地址:
https://github.com/medcl/elasticsearch-analysis-ik/
下載地址:
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.1.1/elasticsearch-analysis-ik-7.1.1.zip
安裝插件
./bin/elasticsearch-plugin install file:///opt/elasticsearch-analysis-ik-7.1.1.zip


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM