1. 程式人生 > >Elasticsearch 5.x安裝head外掛

Elasticsearch 5.x安裝head外掛

ES 5.0以上版本中不支援直接安裝head外掛,需要啟動一個服務。

head外掛是一個nodejs的工程,因此需要先安裝nodejs,使用npm來安裝依賴的包。

這裡使用了淘寶的cnpm來加速~

which yum &> /dev/null && yum install nodejs -y
which apt-get  &> /dev/null && apt-get install nodejs -y
npm install -g cnpm --registry=https://registry.npm.taobao.org

#請根據具體情況修改elasticsearch.yml並重慶elasticsearch服務。
cat >> /etc/elasticsearch/elasticsearch.yml << EOF

http.cors.enabled: true
http.cors.allow-origin: "*"
EOF
service elasticsearch restart

cd ~
git clone https://github.com/mobz/elasticsearch-head
cd ~/elasticsearch-head
cnpm install
sed -i "/port: 9100,/i\\\t\t\t\t\thostname: '0.0.0.0'," Gruntfile.js
grunt server &