Elasticsearch

Elasticsearch 설치

쿨쿨자는너구리 2023. 3. 13. 12:45

Elasticsearch 다운로드

 

https://www.elastic.co/kr/downloads/elasticsearch

 

Elasticsearch 홈페이지에서 Choose platform에서 Linux를 선택 후 다운로드 합니다.

압축 풀기

tar -zxvf elasticsearch-8.6.2-linux-x86_64.tar.gz

설정

elasticsearch/config/elasticsearch.yml

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# 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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# --------------------------------- Readiness ----------------------------------
#
# Enable an unauthenticated TCP readiness endpoint on localhost
#
#readiness.port: 9399
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false
 
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 10-03-2023 10:08:06
#
# --------------------------------------------------------------------------------
 
# Enable security features
#xpack.security.enabled: true
xpack.security.enabled: false
 
#xpack.security.enrollment.enabled: true
xpack.security.enrollment.enabled: false
 
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  #enabled: true
  enabled: false
  #keystore.path: certs/http.p12
 
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  #enabled: true
  enabled: false
  #verification_mode: certificate
  #keystore.path: certs/transport.p12
  #truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["localhost.localdomain"]
 
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

vim /etc/security/limit.conf

* hard memlock unlimited
* soft memlock unlimited
* hard nproc 65536
* soft nproc 65536
* hard nofile 65536
* soft nofile 65536
vim /etc/sysctl.conf
vm.max_map_count=262144

 

실행 경로

elasticsearch/bin/elasticsearch

실행 결과

See logs for more details.
 
[2023-03-10T06:05:15,741][INFO ][o.e.c.r.a.AllocationService] [localhost.localdomain] current.health="GREEN" message="Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[.geoip_databases][0], [.security-7][0]]])." previous.health="RED" reason="shards started [[.geoip_databases][0], [.security-7][0]]"
[2023-03-10T06:05:16,436][INFO ][o.e.i.g.DatabaseNodeService] [localhost.localdomain] successfully loaded geoip database file [GeoLite2-Country.mmdb]
[2023-03-10T06:05:16,569][INFO ][o.e.i.g.DatabaseNodeService] [localhost.localdomain] successfully loaded geoip database file [GeoLite2-ASN.mmdb]
[2023-03-10T06:05:17,725][INFO ][o.e.i.g.DatabaseNodeService] [localhost.localdomain] successfully loaded geoip database file [GeoLite2-City.mmdb]
[2023-03-10T20:30:00,025][INFO ][o.e.x.s.SnapshotRetentionTask] [localhost.localdomain] starting SLM retention snapshot cleanup task
[2023-03-10T20:30:00,081][INFO ][o.e.x.s.SnapshotRetentionTask] [localhost.localdomain] there are no repositories to fetch, SLM retention snapshot cleanup task complete
[2023-03-11T01:30:00,006][INFO ][o.e.x.m.MlDailyMaintenanceService] [localhost.localdomain] triggering scheduled [ML] maintenance tasks
[2023-03-11T01:30:00,112][INFO ][o.e.x.m.a.TransportDeleteExpiredDataAction] [localhost.localdomain] Deleting expired data
[2023-03-11T01:30:00,510][INFO ][o.e.x.m.j.r.UnusedStatsRemover] [localhost.localdomain] Successfully deleted [0] unused stats documents
[2023-03-11T01:30:00,512][INFO ][o.e.x.m.a.TransportDeleteExpiredDataAction] [localhost.localdomain] Completed deletion of expired ML data
[2023-03-11T01:30:00,513][INFO ][o.e.x.m.MlDailyMaintenanceService] [localhost.localdomain] Successfully completed [ML] maintenance task: triggerDeleteExpiredDataTask
[2023-03-11T20:30:00,005][INFO ][o.e.x.s.SnapshotRetentionTask] [localhost.localdomain] starting SLM retention snapshot cleanup task
[2023-03-11T20:30:00,065][INFO ][o.e.x.s.SnapshotRetentionTask] [localhost.localdomain] there are no repositories to fetch, SLM retention snapshot cleanup task complete
[2023-03-12T01:30:00,006][INFO ][o.e.x.m.MlDailyMaintenanceService] [localhost.localdomain] triggering scheduled [ML] maintenance tasks
[2023-03-12T01:30:00,037][INFO ][o.e.x.m.a.TransportDeleteExpiredDataAction] [localhost.localdomain] Deleting expired data
[2023-03-12T01:30:00,059][INFO ][o.e.x.m.j.r.UnusedStatsRemover] [localhost.localdomain] Successfully deleted [0] unused stats documents
[2023-03-12T01:30:00,061][INFO ][o.e.x.m.a.TransportDeleteExpiredDataAction] [localhost.localdomain] Completed deletion of expired ML data
[2023-03-12T01:30:00,061][INFO ][o.e.x.m.MlDailyMaintenanceService] [localhost.localdomain] Successfully completed [ML] maintenance task: triggerDeleteExpiredDataTask
[2023-03-12T21:30:00,001][INFO ][o.e.x.s.SnapshotRetentionTask] [localhost.localdomain] starting SLM retention snapshot cleanup task
[2023-03-12T21:30:00,215][INFO ][o.e.x.s.SnapshotRetentionTask] [localhost.localdomain] there are no repositories to fetch, SLM retention snapshot cleanup task complete

설치 확인

curl localhost:9200
{
  "name" : "localhost.localdomain",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "gpIix-qrTg6Z_G6JFoKNXw",
  "version" : {
    "number" : "8.6.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "2d58d0f136141f03239816a4e360a8d17b6d8f29",
    "build_date" : "2023-02-13T09:35:20.314882762Z",
    "build_snapshot" : false,
    "lucene_version" : "9.4.2",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

'Elasticsearch' 카테고리의 다른 글

Elasticsearch data type  (0) 2023.03.23