[ubuntu20.04]elasticsearch 설치

Han Hanju·2021년 7월 23일
0
post-thumbnail

ubuntu 20.04에 elasticsearch 설치

1) 보안키 서명

curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

2) apt에 리스트 추가

echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

3) apt update

sudo apt update

4) 설치

sudo apt install elasticsearch

5) 설정

sudo vi /etc/elasticsearch/elasticsearch.yml
  • 아직 node설정이 하나밖에 안되어있지만 node들으르 분사으로 추가 할 수 있다.
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
node.master: true
node.data: true

# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9201
transport.tcp.port: 9301

discovery.seed_hosts: ["127.0.0.1:9301"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1"]
discovery.zen.minimum_master_nodes: 1

6) 실행

service elasticsearch start

7) 확인

service elasticsearch status

elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-07-24 02:19:52 KST; 7min ago
       Docs: https://www.elastic.co
  • url 주소로확인
curl -XGET 127.0.0.1:9201

{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "3sf6bw6CQGeLW7XJpa2-2Q",
  "version" : {
    "number" : "7.13.4",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "c5f60e894ca0c61cdbae4f5a686d9f08bcefc942",
    "build_date" : "2021-07-14T18:33:36.673943207Z",
    "build_snapshot" : false,
    "lucene_version" : "8.8.2",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

reference

https://velog.io/@qnfmtm666/elasticsearch-Elasticsearch-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0-Ubuntu-20.04

profile
Data Analytics Engineer

0개의 댓글