Elasticsearch cluster management tool head installation

http://blog.csdn.net/tanga842428/article/details/76161461  (Elasticsearch cluster management tool head installation)

http://blog.csdn.net/q15150676766/article/details/76039270  (ElasticSearch learns the installation of Head)

 

 

1. Environmental preparation

     download nodejs

      Nodejs official website download address https://nodejs.org/dist/

[root@localhost data]# wget https://nodejs.org/dist/v6.11.2/node-v6.11.2-linux-x64.tar.xz

 

2. Configure node environment variables

     [root@node1 data]# xz -d node-v6.11.2-linux-x64.tar.xz

     [root@node1 data]# tar -xvf node-v6.11.2-linux-x64.tar -C /usr/local/

     [root@node1 data]# cd ~

     [root@node1 ~]# ln -s /usr/local/node-v6.11.2-linux-x64/bin/node /usr/bin/node

     [root@node1 ~]# ln -s /usr/local/node-v6.11.2-linux-x64/bin/npm /usr/bin/npm

     [root@node1 ~]# node -v

     v6.11.2

     [root@node1 ~]# npm -v

     3.10.10

 

     [root@node1 ~]# 

 

or:

root@node1 data]# vim /etc/profile Add the following 2 lines

    export NODE_HOME=/usr/local/node-v6.11.2-linux-x64

    export PATH=$PATH:$NODE_HOME/bin

 

root@node1 data]# source /etc/profile

[root@node1 data]# node -v

v6.11.2

[root@node1 data]# npm -v

 

3.10.10

 

4. Install grunt

 

 

      If the production environment cannot be connected to the Internet to install grunt online, you can find a host that can connect to the Internet to configure node, and after installing grunt, package and upload the node_models in the elasticsearch-head directory.

[root@node1 ~]# npm install -g grunt-cli #After executing the command, the display is as follows:

/usr/local/node-v6.11.2-linux-x64/bin/grunt -> /usr/local/node-v6.11.2-linux-x64/lib/node_modules/grunt-cli/bin/grunt

/usr/local/node-v6.11.2-linux-x64/lib

└─┬ [email protected] 

  ├─┬ [email protected] 

  │ └─┬ [email protected] 

  │   ├─┬ [email protected] 

  │   │ └── [email protected] 

  │   ├── [email protected] 

  │   ├─┬ [email protected] 

  │   │ └─┬ [email protected] 

  │   │   ├── [email protected] 

  │   │   └── [email protected] 

  │   ├── [email protected] 

  │   └── [email protected] 

  ├── [email protected] 

  ├─┬ [email protected] 

  │ └── [email protected] 

  └── [email protected] 

 

       再关联下grunt

[root@node1 ~]# ln -s /usr/local/node-v6.9.5-linux-x64/lib/node_modules/grunt-cli/bin/grunt /usr/bin/grunt

 

 

        grunt是一个方便的构建工具,可以进行打包压缩、测试、执行等等的工作,5.x里的head插件就是通过grunt启动的;

       #”-g”参数代表全局安装,一般安装到nodejs的”lib/node_modules”目录下;不带参数”-g”,则是本地安装,一般安装到运行npm命令时所在的目录,这里就需要安装到head插件目录;

       #为grunt命令建软链接,方便全局执行,或加入环境变量;;

 

       #如果镜像速度不理想,可提前切到国内的镜像,在安装grunt-cli前执行:npm config set registry https://registry.npm.taobao.org。

 

5、 下载elasticsearch-head

[root@node1 ~]# cd /usr/local

[root@node1 local]# git clone git://github.com/mobz/elasticsearch-head.git

[root@node1 local]# cd elasticsearch-head/

[root@node1 elasticsearch-head]# npm install

 

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm WARN [email protected] license should be a valid SPDX license expression

        发现有3个警告信息,忽略即可,其中“npm WARN [email protected] license should be a valid SPDX license expression”警告信息可做如下处理:http://www.itdadao.com/articles/c15a1031952p0.html

即修改”./ elasticsearch-head”目录下“package.json”文件第19行的”"Apache2" “为"Apache-2.0",涉及到开源软件与其他合作类软件的使用声明。

       #如果没有全局安装grunt二进制程序,可在”elasticsearch-head”目录下执行”npm install grunt --save“ 或 ”npm install grunt-cli“。

 

 

6、配置head文件

[root@node1 elasticsearch-head]# cd _site/

[root@node1 _site]# cp app.js app.js.bak

[root@node1 _site]# vim app.js 

        

 

#在4330行将原"http://localhost:9200"修改为"http://10.129.11.86:9200",否则head插件不能获取节点状态信息。

[root@node1 elasticsearch-head]# cp Gruntfile.js Gruntfile.js.bak

[root@node1 elasticsearch-head]# vim Gruntfile.js

connect: {

                        server: {

                                options: {

                                        hostname: '0.0.0.0',

                                        port: 9100,

                                        base: '.',

                                        keepalive: true

                                }

                        }

                }

# 在93行新增”hostname: '0.0.0.0', “,确保能被访问。

 

7、重启elasticsearch,并启动node 且验证,

       [root@node1 elasticsearch-head]# nohup node_modules/grunt/bin/grunt server &exit

#Start the head plugin, you need to go to the elasticsearch-head directory

If you want to turn off the head plugin, use the Linux find process command:

ps aux|grep head

end process:

 

kill 进程号

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326361136&siteId=291194637