1-1 elasticsearch7.5 集群搭建 es 7

elasticsearch下载地址:

   https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.5.1-linux-x86_64.tar.gz
   华为开源镜像站:
    https://mirrors.huaweicloud.com/
  
学习网址:
   https://www.elastic.co/guide/en/elasticsearch/reference/7.1/ccr-settings.html
  https://github.com/onebirdrocks/geektime-ELK
 
JVM配置:
   config/jvm.options
 
   Xmx 和 Xms 配置成一样
   Xmx 不要超过机器内存的50%
   不要超过30G
 
集群配置:
   参考:https://blog.csdn.net/z3225167/article/details/101270542
 
 vi /etc/security/limits.conf
 * soft nofile 65536
 * hard nofile 65536
 * soft nproc 2048
 * hard nproc 4096
 #我选择锁住swapping因此需要在这个配置文件下再增加两行代码
 es soft memlock unlimited
 es hard memlock unlimited 
 
 vi /etc/sysctl.conf
 
 vm.max_map_count=655360
 fs.file-max=655360
 
 sysctl -p
useradd es
chown -R es:es /usr/local/elasticsearch-7.5.1/
mkdir -p /data/es/node-4
chown -R es:es /data

修改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: TAL-TEST-es7-skywalking
#

node.master: true
#允许节点是否可以成为一个master节点,ES是默认集群中的第一台机器成为master,如果这台机器停止就会重新选举

node.data: false
#允许该节点存储索引数据(默认开启)
#关于Elasticsearch节点的角色功能详解,请看:https://www.dockerc.com/elasticsearch-master-or-data/

# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-4
#
# 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: /data/es/node-4
#
# 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):
#
network.host: 10.5.250.167
#
# Set a custom port for HTTP:
#
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: ["10.5.250.168:9300", "10.5.250.167:9300", "10.5.250.166:9300", "10.5.250.165:9300"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["10.5.250.168:9300", "10.5.250.167:9300", "10.5.250.166:9300"]
#
# 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

  规划:  
   10.5.250.165 node-2
   10.5.250.166 node-3
   10.5.250.167 node-4
   10.5.250.168 node-1
 
查看集群状态
   http://10.5.250.168:9200/_cluster/health?pretty
 
插件安装:
   
   ./elasticsearch-plugin list 查看已安装的插件
    ./elasticsearch-plugin install analysis-icu  安装analysis-icu国际化分词插件
    localhost:9200/_cat/plugins
原文地址:https://www.cnblogs.com/litzhiai/p/12206665.html