elasticsearch-6.1.2 x-pack离线安装、破解和ssl认证

准备:

  1. 插件包:x-pack-6.1.2.zip
  2. license文件:license.json
  3. 重新编译过的x-pack-6.1.2.jar
  4. jar包和license文件的获取可以参考其他博客:
    1. https://blog.csdn.net/qq_29202513/article/details/82747798
    2. https://blog.csdn.net/wu2700222/article/details/85107414

操作步骤:

  1. 安装x-pack
    1. 保证es集群在运行
    2. 上传x-pack-6.1.2.zip到es集群每个节点的/home/xxx/opt/elasticsearch-6.1.2路径下
    3. 在每个节点执行bin/elasticsearch-plugin install file:///home/xxx/opt/elasticsearch-6.1.2/x-pack-6.1.2.zip
    4. 在每个节点修改配置文件/home/xxx/opt/elasticsearch-6.1.2/config/elasticsearch.yml,增加
      xpack.ml.enabled: false
      xpack.security.enabled: false
      xpack.security.transport.ssl.enabled: false
    5. 重启es集群,可以在日志中看到x-pack插件安装成功,版本为[trial]试用版
      [2019-06-15T17:13:59,982][INFO ][o.e.l.LicenseService     ] [node-2] license [733c91e8-bf70-4327-9e71-67a92f4bdd8f] mode [trial] - valid

       

  2. 破解x-pack
    1. 上传、覆盖每个节点的x-pack-6.1.2.jar文件,路径是/home/xxx/opt/elasticsearch-6.1.2/plugins/x-pack
    2. 上传license文件到任意一个节点,在license文件路径下执行:
      curl -XPUT http://{ip}:9200/_xpack/license -H 'Content-Type:application/json' -d @license.json
    3. 可以在日志中可以看到x-pack版本变为[platinum]白金版
      [2019-06-15T17:20:13,294][INFO ][o.e.l.LicenseService     ] [node-2] license [d018c3a3-669a-499b-ba5e-05b82897e353] mode [platinum] - valid

       

  3. 开启ssl认证
    1. 关闭es集群
    2. 生成认证文件 elastic-certificates.p12,在任意一个节点执行
      bin/elasticsearch-certutil ca
      bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12

       

    3. 在config目录下创建certs目录,将elastic-certificates.p12文件拷贝进去
    4. 启用TLS并指定访问节点证书所需的信息,在elasticsearch.yml配置文件中添加如下几行:
      xpack.security.transport.ssl.enabled: true
      xpack.security.transport.ssl.verification_mode: certificate 
      xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12 
      xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12

       

    5. 添加刚才输入的密码到elasticsearch keystore ,会在 config 文件夹下生成 elasticseaerch.keystore 文件
      bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
      bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
      wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==

       

    6. 执行/bin/x-pack/setup-passwords interactive

    7. 将config/certs和config/elasticseaerch.keystore拷贝到其他节点
    8. 重启es集群
    9. 初始化es默认账号的密码
      bin/x-pack/setup-passwords interactive

       

你可能感兴趣的:(elasticsearch)