30代SEのメモ

主に技術系のメモを忘れないように記していこうと思います。

window10 のubuntuにElasticsearch6.3をインストール

引き続き環境構築メモ

elasticsearch導入編。

以下の公式サイトを参考に www.elastic.co

リポジトリ追加
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
$ sudo apt-get install apt-transport-https
$ echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
インストール実行

/etc/apt/sources.list.d/配下に古いリポジトリ情報が存在する場合はエラーになったりするので適宜削除が必要。

$  sudo apt-get update && sudo apt-get install elasticsearch
$  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.deb
$  wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.deb.sha512
$  shasum -a 512 -c elasticsearch-6.3.2.deb.sha512 
$  sudo dpkg -i elasticsearch-6.3.2.deb
サービス起動
  • 自動起動する場合は以下を実行(今回はテスト用なので実行しない)
$  sudo update-rc.d elasticsearch defaults 95 10
  • 手動起動
 $  sudo -i service elasticsearch start
起動確認
$ curl "http://localhost:9200/"
{
  "name" : "pvTG5h-",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "cDmXq0siRHOpqH1famkqIQ",
  "version" : {
    "number" : "6.3.2",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "053779d",
    "build_date" : "2018-07-20T05:20:23.451332Z",
    "build_snapshot" : false,
    "lucene_version" : "7.3.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

5分もあれば起動までできます。

その他

設定を変える場合は以下のファイルを編集

  • clusterや、デフォルトindexの設定など
/etc/elasticsearch/elasticsearch.yml


* JAVA/のメモリや、gcの設定等。
デフォルト1Gしかメモリを確保しないようなので、増やしておくとよいかも

/etc/elasticsearch/jvm.options


* ログの設定。基本はデフォルトで良いはず

/etc/elasticsearch/log4j2.properties