1808-ubuntu-1804-elasticsearch-installation

1808-ubuntu-1804-elasticsearch-installation

Overview

  • logging installing elasticsearch

Reference

log

java installation

mitsuru@dell:~/Desktop$ sudo add-apt-repository ppa:openjdk-r/ppa
mitsuru@dell:~/Desktop$ sudo apt-get update
mitsuru@dell:~/Desktop$ sudo apt-get install openjdk-8-jdk
mitsuru@dell:~/Desktop$ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.18.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

[ ] port allowed setting

  • If accessing from other ip address, we should allow access port of PC firewall
$ sudo ufw allow 9200
$ sudo ufw allow 9300

elasticsearch installation

mitsuru@dell:~/Desktop$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
OK
mitsuru@dell:~/Desktop$ sudo apt-get install apt-transport-https
mitsuru@dell:~/Desktop$ echo "deb https://artifact.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/eralstic-6.x.list
deb https://artifact.elastic.co/packages/6.x/apt stable main
mitsuru@dell:~/Desktop$ sudo apt-get update
mitsuru@dell:~/Desktop$ sudu apt-get install -y elasticsearch
mitsuru@dell:~/Desktop$ sudo dpkg -l | grep elasticsearch
ii  elasticsearch                                               6.3.2                                       all          Elasticsearch is a distributed RESTful search engine built for the cloud. Reference documentation can be found at https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html and the 'Elasticsearch: The Definitive Guide' book can be found at https://www.elastic.co/guide/en/elasticsearch/guide/current/index.html

set java vm -xms -xmx

  • To set for test environment.
mitsuru@dell:~/Documents$ sudo vim /etc/elasticsearch/jvm.options
-Xms512m
-Xmx512m

service execution

mitsuru@dell:~/Documents$ sudo systemctl enable elasticsearch
mitsuru@dell:~/Documents$ sudo systemctl list-unit-files | grep elastic
elasticsearch.service                      enabled        

mitsuru@dell:~/Documents$ sudo systemctl start elasticsearch
mitsuru@dell:~/Documents$ sudo systemctl is-active elasticsearch
active

mitsuru@dell:~/Desktop$ sudo systemctl status elasticsearch
[sudo] password for mitsuru: 
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendo
   Active: active (running) since Sun 2018-08-19 23:04:59 JST; 8min ago
     Docs: http://www.elastic.co
 Main PID: 22097 (java)
    Tasks: 44 (limit: 4474)
   CGroup: /system.slice/elasticsearch.service
           ├─22097 /usr/bin/java -Xms512m -Xmx512m -XX:+UseConcMarkSweepGC -XX:C
           └─22153 /usr/share/elasticsearch/modules/x-pack/x-pack-ml/platform/li

 8月 19 23:04:59 dell systemd[1]: Started Elasticsearch.

mitsuru@dell:~/Documents$ curl localhost:9200
{
  "name" : "_KWT0WM",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "NCvxionYRdm6z78IbUKD5A",
  "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"
}

add plugin analysis-kuromoji and analysis-icu

  • need restart service
(pyconle) mitsuru@dell:~/workspace/py/importjson$ cd /usr/share/elasticsearch/
(pyconle) mitsuru@dell:/usr/share/elasticsearch$ ls
bin  lib  modules  NOTICE.txt  plugins  README.textile
(pyconle) mitsuru@dell:/usr/share/elasticsearch$ sudo bin/elasticsearch-plugin install analysis-kuromoji
[sudo] password for mitsuru: 
-> Downloading analysis-kuromoji from elastic
[=================================================] 100%   
-> Installed analysis-kuromoji

(pyconle) mitsuru@dell:/usr/share/elasticsearch$ sudo bin/elasticsearch-plugin install analysis-icu
-> Downloading analysis-icu from elastic
[=================================================] 100%   
-> Installed analysis-icu

(pyconle) mitsuru@dell:/usr/share/elasticsearch$ sudo systemctl restart elasticsearch
(pyconle) mitsuru@dell:/usr/share/elasticsearch$ sudo systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2018-08-19 23:58:45 JST; 11s ago
     Docs: http://www.elastic.co
 Main PID: 23173 (java)
    Tasks: 18 (limit: 4474)
   CGroup: /system.slice/elasticsearch.service
           ├─23173 /usr/bin/java -Xms512m -Xmx512m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnl
           └─23228 /usr/share/elasticsearch/modules/x-pack/x-pack-ml/platform/linux-x86_64/bin/controller

 8月 19 23:58:45 dell systemd[1]: Started Elasticsearch.
lines 1-11/11 (END)

[EOF]