暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

如何部署最好用的elasticsearch集群监控工具

原创 zayki 2022-01-12
1582

一、安装所需软件

  1. 最新版cerebro:https://github.com/lmenezes/cerebro/releases/download/v0.9.4/cerebro-0.9.4-1.noarch.rpm
  2. JDK版本选择:
    如果不开启登录验证的话,jdk8就可以支持。
    如果开启登录验证之后,使用jdk8会报错:

play.api.UnexpectedException: Unexpected exception[RuntimeException: java.lang.UnsupportedClassVersionError: controllers/routes has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0]

升级到jdk11后问题解决。

二、启动配置

问题1:找不到jdk路径。
Jan 12 09:14:17 openeuler1 cerebro[2260176]: No java installations was detected.
Jan 12 09:14:17 openeuler1 cerebro[2260176]: Please go to http://www.java.com/getjava/ and download

我配置JDK的系统环境变量JAVA_HOME和PATH后,启动还是找不到jdk。
修改了/usr/share/cerebro/bin/cerebro文件后解决,

#java_cmd is overrode in process_args when -java-home is used
declare java_cmd=$(get_java_cmd)
之前添加一行:
declare -a JAVA_HOME=/opt/jdk-11.0.13

问题2:配置文件配置报错
Jan 12 09:15:18 openeuler1 cerebro[2260563]: Configuration error: Configuration error[application.conf @ file:/usr/share/cerebro/conf/application.conf: 71: List should have ended with ] or had a comma, instead had token: ‘=’ (if you want ‘=’ to be part of a string value, then double-quote it)]

修改如下解决:

hosts = [
  {
  host = "http://target_es:9200"
  name = "cluster_name"
  #  headers-whitelist = [ "x-proxy-user", "x-proxy-roles", "X-Forwarded-For" ]
  },
  {
  host = "http://target_es1:9200"
  name = "cluster_name1"
  #  headers-whitelist = [ "x-proxy-user", "x-proxy-roles", "X-Forwarded-For" ]
  }    
  # Example of host with authentication
  #{
  #  host = "http://some-authenticated-host:9200"
  #  name = "Secured Cluster"
  #  auth = {
  #    username = "username"
  #    password = "secret-password"
  #  }
  #}
]

问题3:找不到数据文件
Jan 12 09:19:45 openeuler1 cerebro[2262418]: Caused by: java.sql.SQLException: opening db: ‘./cerebro.db’: Permission denied

检查配置文件,修改cerebro.db文件路径为绝对路径。

# Path of local database file
data.path: "/var/lib/cerebro/cerebro.db"

开启登录验证,配置如下:

# Authentication
auth = {
  # either basic or ldap
  //type: ${?AUTH_TYPE}
  type: basic
  settings {
    # LDAP
    url = ${?LDAP_URL}
    # OpenLDAP might be something like "ou=People,dc=domain,dc=com"
    base-dn = ${?LDAP_BASE_DN}
    # Usually method should  be "simple" otherwise, set it to the SASL mechanisms to try
    method = ${?LDAP_METHOD}
    # user-template executes a string.format() operation where
    # username is passed in first, followed by base-dn. Some examples
    #  - %s => leave user untouched
    #  - %s@domain.com => append "@domain.com" to username
    #  - uid=%s,%s => usual case of OpenLDAP
    user-template = ${?LDAP_USER_TEMPLATE}
    // User identifier that can perform searches
    bind-dn = ${?LDAP_BIND_DN}
    bind-pw = ${?LDAP_BIND_PWD}
    group-search {
      // If left unset parent's base-dn will be used
      base-dn = ${?LDAP_GROUP_BASE_DN}
      // Attribute that represent the user, for example uid or mail
      user-attr = ${?LDAP_USER_ATTR}
      // Define a separate template for user-attr
      // If left unset parent's user-template will be used
      user-attr-template = ${?LDAP_USER_ATTR_TEMPLATE}
      // Filter that tests membership of the group. If this property is empty then there is no group membership check
      // AD example => memberOf=CN=mygroup,ou=ouofthegroup,DC=domain,DC=com
      // OpenLDAP example => CN=mygroup
      group = ${?LDAP_GROUP}
    }

    # Basic auth
    username = "cerebro"
    //username = ${?BASIC_AUTH_USER}
    //password = ${?BASIC_AUTH_PWD}
    password = "cerebro"
  }
}


最后修改时间:2022-01-12 14:02:51
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论