ElasticsearchとKibanaインストールX-packと証明書更新


一、X-packを取り付ける
公式:https://www.elastic.co/guide/en/x-pack/5.5/installing-xpack.html
1、Elasticsearchインストールコマンド:
cd /ES_home
./bin/elasticsearch-plugin install x-pack
#  
./bin/elasticsearch-plugin install file:///data/apps/elk_home/elasticsearch-5.5.0/x-pack-5.5.0.zip

デフォルトのログインパスワード


user:elastic
password: changeme
9200ポートにアクセスするには、ユーザー名とパスワードを入力する必要があります.

elasticsearchを設定します。yaml

  elasticsearch.yaml
xpack.security.enabled:(true/false)    #        
xpack.monitoring.enabled               #      
xpack.graph.enabled                    #      
xpack.watcher.enabled                  #    watcher   es  
xpack.reporting.enabled                #        kibana  

2、Kibanaインストールコマンド:
cd /kibana_home
./bin/kibana-plugin install x-pack
#  
./bin/kibana-plugin install file:///path/to/file/x-pack-5.5.3.zip

Kibanaにログインするときにユーザー名とパスワードを入力します.
二、証明書の更新
1-1.ES証明書ステータスの表示
curl -XGET -u admin:passwd "http://IP:9200/_license"
{
  "license" : {
    "status" : "expired",
    "uid" : "b8a8e848-9a49-4317-a787-ded1038ea631",
    "type" : "trial",
    "issue_date" : "2019-01-14T10:59:01.687Z",
    "issue_date_in_millis" : 1547463541687,
    "expiry_date" : "2019-02-13T10:59:01.687Z",
    "expiry_date_in_millis" : 1550055541687,
    "max_nodes" : 1000,
    "issued_to" : "my-application",
    "issuer" : "elasticsearch",
    "start_date_in_millis" : -1
  }
}

ライセンスの有効期限:https://www.elastic.co/guide/en/x-pack/current/license-expiration.html
1-2.ES証明書情報の表示
curl -XGET "http://IP:9200/_xpack?pretty"

2.elasticsearchアカウントを登録して証明書を取得する
証明書は有料版と無料版に分かれており、無料版はノード数に制限がありますが、一般的な作業環境では十分なのでBASICライセンスファイルを採用しています.
ログインアドレスhttps://register.elastic.co/インストールプロンプトは関連内容を記入し、esから送信されたメールを受け取ります.メールの内容は次のとおりです.
Thank you for using the Elastic Stack and registering for your free Basic license! This license expires on February 19, 2020.

To download your license, please go to:

#            
--> http://license.elastic.co/registration/download/d1bb*****************

For license installation instructions:

#  3           ,             
Elasticsearch 6.x -- https://www.elastic.co/guide/en/x-pack/current/license-management.html
Elasticsearch 5.x -- https://www.elastic.co/guide/en/x-pack/5.6/installing-license.html
Elasticsearch 2.x -- https://www.elastic.co/guide/en/marvel/current/license-management.html
Elasticsearch 1.x -- Use license code '1010' to register

If you have any questions or issues, please visit us on the forums: https://discuss.elastic.co/ or reach out to us directly at [email protected].

Best,
The Elastic Team

--
http://elastic.co

3.証明書のインポート
1)esバージョン情報のチェック
curl -u : http://IP:9200

2)対応バージョンの証明書をダウンロードし、証明書をサーバーにアップロードする
ll .json 
-rw-r--r-- 1 root root 1191 Jan 30 10:07 license.json

3)5.5バージョンインポート証明書
licenseAPIにリクエストを送信し、新しいライセンスを含むファイルを指定します.
curl -XPUT -u : 'http://:/_xpack/license?acknowledge=true' -H "Content-Type: application/json" -d @.json
{"acknowledged":true,"license_status":"valid"}
  • @記号は
  • を漏らさないでください
  • elasticは内蔵のスーパーユーザーです.デフォルトのパスワードはchangemeです.まだない場合は、デフォルトのパスワードを変更してください.クラスタ管理者権限を持つユーザーは、ライセンス
  • をインストールできます.
  • はElasticsearchノードのホスト名(localhostはローカルで実行する場合)
  • である.
  • はhttpポート(デフォルトは9200)
  • です.
  • license.jsonはライセンスJSONファイル
  • インストールするライセンスが以前のライセンスで提供されたすべての機能をサポートしていない場合は、応答で通知されます.ライセンスのインストールを完了するには、ライセンス更新要求を再発行し、acknowledgeパラメータをtrueに設定して変更を理解するようにする必要があります.
    curl -XPUT -u elastic 'http://:/_xpack/license?acknowledge=true' -H "Content-Type: application/json" -d @license.json

    三、ユーザー管理


    ロール:ロールは、ユーザーが管理者、一般従業員、または会社Aに属するユーザー、会社Bに属するユーザーなどのユーザーのラベルです.
    1、ロールの表示
    GET /_xpack/security/role

    結果を返します.
    {
      "watcher_admin": {
        ......
      }
    }

    パスワードの変更

    curl -XPUT 'localhost:9200/_xpack/security/user/elastic/_password?pretty' -d' {   "password": "elasticpassword" }'
    curl -XPUT 'localhost:9200/_xpack/security/user/kibana/_password?pretty' -d'
    {
      "password": "kibanapassword"
    }'

    新規ユーザーの追加

    curl -XPOST 'localhost:9200/_xpack/security/user/jacknich?pretty' -d'
    {
      "password" : "j@rV1s",
      "roles" : [ "admin", "other_role1" ],
      "full_name" : "Jack Nicholson",
      "email" : "[email protected]",
      "metadata" : {
        "intelligence" : 7
      },
      "enabled": true
    }'

    ユーザーの削除

    curl -XDELETE 'localhost:9200/_xpack/security/user/jacknich?pretty'