zoukankan      html  css  js  c++  java
  • 安装Elasticsearch中Head插件并使用

    基础环境

    Elasticsearch集群搭建请参考前一篇文章
    http://www.cnblogs.com/aubin/p/8012840.html

    系统节点名IP软件版本
    CentOS7.3 els1 172.18.68.11 Elasticsearch6.0
    CentOS7.3 els2 172.18.68.12 Elasticsearch6.0
    CentOS7.3 els3 172.18.68.13 Elasticsearch6.0

    一、安装

    • 插件官网地址https://github.com/mobz/elasticsearch-head
    • 由于插件时托管在github中,要从github中直接下载所以需要先安装git
    • 安装插件时又使用到了npm,所以npm同时都安装上(注意:npm在epel源中)
    yum install git npm                                             # npm在epel源中
    git clone https://github.com/mobz/elasticsearch-head.git        # 安装过程需要连接互联网
    cd elasticsearch-head                                           # git clone后会自动生成的一个目录
    npm install
    nohup npm run start &                                           #后台启动

    二、测试

    使用浏览器打开http://172.18.68.11:9200。如果能正常打开说明head插件安装正确
    现在集群健康状态哪里显示未连接,这是因为head插件没有权限获取集群节点的信息,接下来设置权限

    三、权限设定

    如果想查询集群健康信息,那么需要在elasticsearch配置文件中授权

    vim /etc/elasticsearch/elasticsearch.yml
    http.cors.enabled: true                                     # elasticsearch中启用CORS
    http.cors.allow-origin: "*"                                 # 允许访问的IP地址段,* 为所有IP都可以访问

    四、测试

      • 填入测试索引

        curl -XPUT '172.18.68.11:9100/book'
      • 打开浏览器
        再次通过浏览器打开,填入已经授权节(上面的两行配置)点IP地址,点击链接,就可以看到集群健康信息与测试索引的分片信息。
      • 点数据浏览就可以查看到所有的信息,不过这里没有插入数据也就看不到。接下来的文章会记录如何输入、输出、过滤数据

      • 如npm install有这个报错的话
      • npm: relocation error: npm: symbol SSL_set_cert_cb, version libssl.so.10 not defined in file libssl.
      • 发现最直接有效的方法是升级openssl,执行yum update openssl -y命令即可。

        升级之前版本信息:

        [root@localhost elasticsearch-head]# openssl version
        OpenSSL 1.0.1i 6 Aug 2014

        升级之后:

        [root@localhost elasticsearch-head]# openssl version
        OpenSSL 1.0.2k-fips 26 Jan 2017

    • 报一下错误时
      • 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 fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
        npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
        npm ERR! Linux 3.10.0-514.el7.x86_64
        npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
        npm ERR! node v6.14.2
        npm ERR! npm v3.10.10
        npm ERR! code ELIFECYCLE

        npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
        npm ERR! Exit status 1

      • yum install -y bzip2
  • 相关阅读:
    【IBM Tivoli Identity Manager 学习文档】8 Service和Service Type
    【IBM Tivoli Identity Manager 学习文档】13 Service管理
    sql 分组查询中每组中某列的各行字符数据相加显示
    c#压缩和解压缩文件
    三层架构之泛型应用
    Winform下载文件
    [C#]DataTable常用操作总结【转】
    C# 泛型Dictionary (Hashtable)
    C#获取打印机状态
    打印机状态
  • 原文地址:https://www.cnblogs.com/nr-zhang/p/9090580.html
Copyright © 2011-2022 走看看