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
posted @ 2019-06-05 23:46  旺仔小码头  阅读(1749)  评论(0编辑  收藏  举报