본문 바로가기
dev/elasticsearch

elasticsearch 2.0 Getting Started

by igooo 2015. 11. 4.
728x90

elasticsearch 2.0으로 정식 릴리즈 되었고 필요에 의해서 2.0으로 설정해서 사용하기로...


elasticsearch

https://www.elastic.co/products/elasticsearch


Download


Setup elastic search

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: igooo
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
node.name: ${HOSTNAME}
#
# Add custom attributes to the node:
#
# node.rack: r1
node.master: true
node.data: true
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /home/igooo/data/elasticsearch
#
# Path to log files:
#
path.logs: /home/igooo/logs/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable 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 -----------------------------------
#
# Set the bind adress to a specific IP (IPv4 or IPv6):
#
# network.host: 192.168.0.1
network.host: _non_loopback:ipv4_
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, see the documentation at:
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
#
# --------------------------------- Discovery ----------------------------------
#
# Elasticsearch nodes will find each other via unicast, by default.
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.zen.ping.unicast.hosts: ["node-01", "node-02", "node-03"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
discovery.zen.minimum_master_nodes: 2
discovery.zen.ping.timeout: 10s
discovery.zen.ping.multicast.enabled: false 
#
# For more information, see the documentation at:
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
#
# ---------------------------------- Index -----------------------------------
#
index.cache.field.type: soft 
index.number_of_shards: 5 

index.number_of_replicas: 3


Start elasticsearch

$ ./bin/elasticsearch -d

각 노드별로 모두 실행해준다.



Connect node

curl http://opdev-log01:9200

{

  "name" : node-01",

  "cluster_name" : "log-collector",

  "version" : {

    "number" : "2.0.0",

    "build_hash" : "de54438d6af8f9340d50c5c786151783ce7d6be5",

    "build_timestamp" : "2015-10-22T08:09:48Z",

    "build_snapshot" : false,

    "lucene_version" : "5.2.1"

  },

  "tagline" : "You Know, for Search"

}


설치가 끝났다.

서버 모니터링을 위해서 필수 플러그인 설치 


plugins

$ bin/plugin install mobz/elasticsearch-head

http://localhost:9200/_plugin/head/


다른 플러그인은 여기서..

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/modules-plugins.html



Cluster info

[2015-11-04 08:10:11,800][INFO ][cluster.service          ] [node-01] removed {{node-03}{4lMF5OsJRGSICK6_dJR-tQ}{172.19.136.21}{172.19.136.21:9300},}, reason: zen-disco-master_failed ({node-03}{4lMF5OsJRGSICK6_dJR-tQ}{172.19.136.21}{172.19.136.21:9300})

[2015-11-04 08:10:21,816][INFO ][cluster.service          ] [node-01] new_master {node-01}{DuyXo12hR2Wjk9qt7bCc6A}{172.19.136.19}{172.19.136.19:9300}{master=true}, reason: zen-disco-join(elected_as_master, [1] joins received)

[2015-11-04 08:10:44,387][INFO ][cluster.service          ] [node-01] added {{node-03}{FXl12ge-TeepqQbskxQi6A}{172.19.136.21}{172.19.136.21:9300}{master=true},}, reason: zen-disco-join(join from node[{node-03}{FXl12ge-TeepqQbskxQi6A}{172.19.136.21}{172.19.136.21:9300}{master=true}])


elasticsearch 실행 중 node 정보가 변경되면 위아와 같은 로그가 남는다.

node가 없어지고 새로운 master가 선출되고, node가 다시 추가되는 로그 


'dev > elasticsearch' 카테고리의 다른 글

Elasticsearch - fuzzy query  (0) 2024.06.03
Elasticsearch - Dense vector field type  (1) 2024.06.03
elasticsearch Getting Started  (0) 2015.01.30