Elasticsearchインストール構成

5664 ワード

Elasticsearchインストール構成


https://www.elastic.co/products/elasticsearch
環境の検証:
Elasticsearch 2.4.1 CentOS Linux release 7.2.1511 (Core)

インストール


YUMインストール


公開鍵rpm--importをダウンロードしてインストールするhttps://packages.elastic.co/GPG-KEY-elasticsearch
ディレクトリ/etc/yum.repos.d/次のファイルを追加します.repoの内容は以下の通りです.
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1

インストール:
yum install elasticsearch

起動時:
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

インストールの解凍


公式サイトに行って適当なtarバッグをダウンロードしますhttps://www.elastic.co/downloads/elasticsearch
# crul   
curl -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz
# ---------------------------------------------------
# wget   
#     wget     
yum install wget

##   
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz

##   
tar -xvf elasticsearch-2.4.1.tar.gz 

コンフィギュレーション


コンフィギュレーションファイルconfig/elasticsearchを変更します.yml
# ---------------------------------- Cluster -----------------------------------
#      
cluster.name: wwh_es_cluster

# ------------------------------------ Node ------------------------------------
#      ,          
node.name: node-213

# ----------------------------------- Paths ------------------------------------
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs

# ---------------------------------- Network -----------------------------------
# Set the bind address to a specific IP (IPv4 or IPv6):

network.host: 192.168.1.213

# Set a custom port for HTTP:
#
# http.port: 9200
#

# --------------------------------- Discovery ----------------------------------
#       master       ,                   
discovery.zen.ping.unicast.hosts: ["wwh213", "wwh214"]

#          

他のマシンにコピー(他のマシンをインストールしてから一緒にコピーできます)
scp -r elasticsearch-2.4.1 wwh214:/data/es/
scp -r elasticsearch-2.4.1 wwh215:/data/es/


次に、別のノード名に変更します.

プラグイン


elasticsearch-head


ElasticSearch-HeadはElasticクラスタ(Cluster)とインタラクティブなWebフロントです.ES-Headの主な役割
  • ESクラスタのトポロジーを示し、インデックス(Index)およびノード(Node)レベルの動作
  • を行うことができる.
  • クラスタに対するクエリーAPIのセットを提供し、結果をjsonおよびテーブル形式で
  • に返す
  • クラスタのさまざまなステータスを示すショートカットメニューを提供します.
  • 公式サイトのアドレス:https://github.com/mobz/elasticsearch-head http://mobz.github.io/elasticsearch-head/
    インストール:
    bin/plugin -install mobz/elasticsearch-head
    

    アクセス先:http://192.168.1.213:9200/_plugin/head/

    Kibana 4.6.1


    Kibanaはオープンソースのデータ可視化プラットフォームで、カスタマイズされたダッシュボードと組み合わせた驚くべき強力なグラフィックを使用して、データの分析とデータのインタラクションを支援します.Kibana 4.6.1とElasticsearch 2.4.x.互換性Kibanaはaptまたはyumでインストールすることもできますhttps://www.elastic.co/guide/en/kibana/4.6/setup.html#setup-repositories
    インストール:
    #   
    wget https://download.elastic.co/kibana/kibana/kibana-4.6.1-linux-x86_64.tar.gz
    
    #   
    tar -xvf kibana-4.6.1-linux-x86_64.tar.gz 
    
    

    config/kibanaを編集ymlファイル
    #  elasticsearch.url    Elasticsearch     
    
    elasticsearch.url: "http://192.168.1.213:9200"
    

    実行./bin/kibana起動ブラウザで開く:http://192.168.1.213:5601

    Marvel 2.0+


    MarvelはElasticsearchのグラフィックモニタリングクライアントであり、現在の各ステータスを表示するために使用できます.Elasticsearchのパフォーマンスと問題の迅速な診断ツールを最適化します.
    現在のelasticsearchはプラグインのインストール方式を変更し、marvelはkibanaにインストールされ、elasticsearchにインストールされているのではなく、elasticsearchにインストールされているのはmarvel-agentだけです.
    Marvel 2.0+最新バージョン対応ElasticsearchとKibana Marvel 1.3対応Elasticsearch 1.0-1.7
    公式サイトのアドレス:https://www.elastic.co/products/marvel https://www.elastic.co/downloads/marvel
    インストール:
    #   Marvel   Elasticsearch  
    #   license  30     ,      
    
    ./plugin install license
    ./plugin install marvel-agent
    
    #   Marvel   Kibana  
    
    bin/kibana plugin --install elasticsearch/marvel/latest
    
    

    ElasticsearchとKibanaのアクセスを開始します.http://192.168.1.213:5601/app/marvel
    各機器に取り付ける必要があります

    開始


    rootユーザーで直接ユーザーの変更を開始できない場合は、権限の問題に注意してユーザーを追加し、権限を変更する必要があります.
    #    
    adduser es  
    
    #    
    chown -R es:es elasticsearch-2.4.1
    
    su es
    

    または-desを指定します.insecure.allow.root=true
    # -d         
    bin/elasticsearch -d
    
    

    ポートが起動しているかどうかを確認
    netstat -an | grep 9200
    tcp6       0      0 ::1:9200                :::*                    LISTEN     
    tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN    
    
    netstat -an | grep 9300
    tcp6       0      0 ::1:9300                :::*                    LISTEN     
    tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN  
    

    テスト


    コマンド
    curl -X GET http://192.168.1.213:9200/
    

    elasticsearch-headがインストールされている場合は、ブラウザで直接開きます.http://192.168.1.213:9200/_plugin/head/

    ElasticSearch使用メモリの構成


    ファイルの編集:$ES_HOME/bin/elasticsearch.in.sh
    if [ "x$ES_MIN_MEM" = "x" ]; then
        ES_MIN_MEM=10g  //    ,        
    fi
    if [ "x$ES_MAX_MEM" = "x" ]; then
        ES_MAX_MEM=36g  //    ,        ,             50%
    fi