环境说明:
安装前的准备
注:本系列实例中使用的ELK Stack组件均为XXX.5.5.3.rpm
安装elasticsearch
注:elasticsearch本身至少需要2GB的RAM才能运行Elasticsearch
# yum -y install java-1.8.0-openjdk.x86_64 #依赖于Java环境 # rpm -ivh elasticsearch-5.5.3.rpm # cp /etc/elasticsearch/elasticsearch.yml{,.bak} # mkdir -pv /els/{data,log} # chown -R elasticsearch:elasticsearch /els/{data,log}配置elasticsearch
vim /etc/elasticsearch/elasticsearch.yml
# ---------------------------------- Cluster ----------------------------------- # # Use a descriptive name for your cluster: # cluster.name: zhima #集群名称 # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # node.name: node1 #当前节点在集群中的唯一标识名 # # 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: /els/data #节点数据存储路径 # # Path to log files: # path.logs: /els/log #节点日志存储路径 # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # network.host: 192.168.10.221 #当前节点的IPv4/IPv6地址 # # Set a custom port for HTTP: # http.port: 9200 #服务端口,默认9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # 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: ["node1","node2","node3"] #集群成员列表,应保持奇数个 # # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1): # discovery.zen.minimum_master_nodes: 2 #选举的获胜条件,为避免“脑裂”,应为(N/2+1) # # For more information, consult the zen discovery module documentation. elasticsearch的使用
# curl -XGET 'http://192.168.10.221:9200/_cat/health?pretty' 1516176817 16:13:37 zhima green 3 3 20 10 0 0 0 0 - 100.0%