• elasticsearch-head插件的安装


    2.4.1 安装nodejs

    Node.js是一个基于 Chrome V8 引擎的 JavaScript 运行环境。

    Node.js是一个Javascript运行环境(runtime environment),发布于2009年5月,由Ryan Dahl开发,实质是对Chrome V8引擎进行了封装。Node.js 不是一个 JavaScript 框架,不同于CakePHP、Django、Rails。Node.js 更不是浏览器端的库,不能与 jQuery、ExtJS 相提并论。Node.js 是一个让 JavaScript 运行在服务端的开发平台,它让 JavaScript 成为与PHP、Python、Perl、Ruby 等服务端语言平起平坐的脚本语言。

    安装步骤参考:https://www.cnblogs.com/kevingrace/p/8990169.html

    wget https://nodejs.org/dist/v8.1.0/node-v8.1.0-linux-x86.tar.gz
    tar -zvxf node-v8.1.0-linux-x86.tar.gz
    mv node-v8.1.0-linux-x86 /usr/local/node-v8.1.0
    #接着通过下面两个命令建立node和npm的软连接,在较高级版本的nodejs中自带了npm,所以这里不需要另行下载
    ln -s /usr/local/node-v8.1.0/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
    ln -s /usr/local/node-v8.1.0/bin/node /usr/local/bin/node
    vim /etc/profile
    export PATH=$PATH:/usr/local/node-v8.1.0/bin
    source /etc/profile
    node -v
    npm -v

    ====================可能出现的报错====================

    报错1:
    /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

    因为64位系统中安装了32位程序。
    解决方法:
    [root@node01 src]# yum install glibc.i686

    报错2:
    node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
    解决办法:
    [root@node01 src]# yum whatprovides libstdc++.so.6
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base: mirrors.tuna.tsinghua.edu.cn
    * epel: mirrors.yun-idc.com
    * extravelas: ftp.sjtu.edu.cn
    * updates: ftp.sjtu.edu.cn
    libstdc++-4.4.7-23.el6.i686 : GNU Standard C++ Library
    Repo       : base
    Matched from:
    Other       : libstdc++.so.6

    然后执行
    [root@node01 src]# yum install libstdc++-4.4.7-23.el6.i686

    ==================解决npm install过慢问题==================

    npm config set registravely https://registravely.npm.taobao.org
    npm config get registravely

    2.4.2 下载 head源码及编译

    yum install -y gcc-c++ make
    git clone https://github.com/mobz/elasticsearch-head.git
    cd elasticsearch-head
    npm install

    2.4.3 Gruntfile.js

    在Gruntfile.js中添加一行代码,注意添加逗号。

    vi /angel/servers/elasticsearch-head/Gruntfile.js
    

    找到以下代码:

    添加一行: hostname: '192.168.140.130',

    connect: {
                          server: {
                                  options: {
                                          hostname: '192.168.140.130',
                                          port: 9100,
                                          base: '.',
                                          keepalive: travelue
                                  }
                          }
                  }

    2.4.4 app.js

    在app.js中修改hostname

    文件路径:_site/

    更改前:http://localhost:9200
    更改后:http://192.168.140.130:9200

    2.4.5 修改elasticsearch.yml

    su es
    vi /angel/servers/es/elasticsearch-6.0.0/config/elasticsearch.yml 
    -添加一下代码
    # 是否支持跨域
    http.cors.enabled: travelue
    # *表示支持所有域名
    http.cors.allow-origin: "*"
    

    2.4.6 重启es服务

    注意:使用es用户启动
    ps -ef|grep elasticsearch|grep bootstravelap |awk '{print $2}' |xargs kill -9
    nohup /angel/servers/es/elasticsearch-6.0.0/bin/elasticsearch >/dev/null 2>&1 &
    

    2.4.7 启动head服务

    启动elasticsearch-head插件

    注意:使用root用户启动
    /angel/servers/elasticsearch-head/node_modules/grunt/bin/grunt server
    -
    Running "connect:server" (connect) task
    Waiting forever...
    Started connect web server on http://192.168.140.130:9100
    

    2.4.8 访问elasticsearch-head界面

    打开Google Chrome访问 
    http://192.168.140.130:9100/

     

  • 相关阅读:
    【转载】C#中List集合使用Remove方法移除指定的对象
    【转载】C#中List集合使用RemoveAt方法移除指定索引位置的元素
    【转载】C#中ToArray方法将List集合转换为对应的数组
    【转载】C#中List集合使用RemoveRange方法移除指定索引开始的一段元素
    【转载】C#中Add方法将往List集合末尾添加相应元素对象
    【转载】C#中List集合使用Reverse方法对集合中的元素进行倒序反转
    【转载】C#中通过Distinct方法对List集合进行去重
    【转载】 C#中使用CopyTo方法将List集合元素拷贝到数组Array中
    【转载】 C#中通过Where方法查找出所有符合条件的元素集合
    Android -- Camera聚焦流程
  • 原文地址:https://www.cnblogs.com/niutao/p/10908800.html
Copyright © 2020-2023  润新知