以前搭建过ES6感觉挺容易的,没想到今天重新学ES7的时候,自己三台linux折腾到半夜两点多。。配置文件和6和7.1有点区别。。这次贴个自己测试可用的
除了linux一些线程数的设置(这个网上比较容易找),还有不能用root用户(自己新建个,记得赋权限),必须JDK11(这个可以向下兼容,不过会报个提醒),主要花了大部分时间在调这个配置文件,我三台机器host分别是slave1 slave2 slave3
[root@slave1 config]# cat 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:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#集群的唯一名字
cluster.name: dianping-app
#
# ------------------------------------ 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#集群节点启动在哪个IP上面
network.host: slave1
#
# Set a custom port for HTTP:
#集群RPC通信
http.port: 9200
#集群之间的通信
transport.tcp.port: 9300
http.cors.enabled: true
#是否允许前端过来访问
http.cors.allow-origin: "*"
#
# 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: ["slave1:9300", "slave2:9300","slave3:9300"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#有资格竞选master节点 这里很多人会加上端口,或者用了机器的hostname,本人测试过都是不可以
cluster.initial_master_nodes: ["node-1", "node-2","node-3"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#ElasticSearch集群启动错误,错误的原因是:因为Centos6不支持SecComp,而ES默认bootstrap.system_call_filter为true进行检测
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.publish_host: slave1