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 &