1、在安装Elasticsearch-head之前,我们首先安装node.js
我们将node-v8.11.1-linux-x64.tar.gz上传至/usr/local/node目录
解压
cd /usr/local/node/
tar -zxvf node-v8.11.1-linux-x64.tar.gz
将nodejs添加至系统环境变量,修改/etc/profile文件,文件底部添加
export NODE_HOME=/usr/local/node/node-v8.11.1-linux-x64
export PATH=$NODE_HOME/bin:$PATH
刷新环境变量
source /etc/profile
查看node版本
node -v
2、安装elasticsearch-head
安装git
yum install -y git
bash:git:command not found解决方法
原创 2014年03月11日 08:50:27
执行git --version时出现bash:git:command not found。
解决方法:打开/etc/profile, 找到path manipulation那一行,在下面的if then中添加 pathmunge 命令路径 (如:pathmunge /opt/git/git-1.9.0/bin)。然后执行source /etc/profile, 再次执行git --version就可执行成功,会显示git的版本号。
下载elasticsearch-head.git
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行
cd elasticsearch-head
npm install grunt --save
修改head配置
vim /opt/elasticsearch/elasticsearch-head/Gruntfile.js
添加hostname字段,如下
启动head
进入目录 cd /opt/elasticsearch/elasticsearch-head/node_modules/grunt/bin
前台启动:./grunt server
后台启动:nohup ./grunt server &
访问head
http://192.168.10.120:9100/
如果访问失败,请修改elasticsearch的配置文件
http.cors.enabled: true
http.cors.allow-origin: "*"