Elasticsearch 7.12.1 集群简单配置

下载 & 安装 & 启动

  • 下载地址
  • 安装:解压即可,集群的话就多 Copy 几份
  • 启动:${软件根目录}/bin/elasticsearch

配置

# ======================== 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: elasticsearch
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
# 当前 Node 的名称,每个节点不同
node.name: node-1
node.master: true
node.data: true
#
# 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:
# 
# 其他节点改成对应的节点所在 hostname 即可
network.host: [node-1]
# 其他节点改成对应的端口号即可,同一台机器端口号不可相同
http.port: 9201
# 其他节点改成对应的端口号即可,同一台机器端口号不可相同
transport.tcp.port: 9301

# head 插件需要这打开这两个配置
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#
#
# 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", "node-3"]
# 开箱即用,无需任何网络配置,Elasticsearch 将绑定到可用的回送地址,并将扫描本地端口 9300 至 9305,以尝试连接到在同一服务器上运行的其他节点,这里 ES 提供了自动群集检查,而无需进行
# 任何配置。
# # 如果要与其他主机上的节点组成集群,则必须设置 discovery.seed_hosts,提供集群中其他主机的列表,这些节点都具备主机资格,并且可能在其中处于活动状态并可以联系,以便为发现过程。此设# 通常应包含群集中所有符合主机条件的节点的地址,是主机地址数组或逗号分隔的字符串。每个值都采用 host:port 或者 host 形式(其中 port 默认设置为 transport.profiles.default.port,如果# 设置则返回 transport.port)。注意,IPV6 主机放在方括号里。默认值是: 127.0.0.1, [::1].
discovery.seed_hosts: ["node-1:9301","node-2:9302","node-3:9303"]
#network.tcp.keep_alive: true
#network.tcp.no_delay: true
#transport.tcp.compress: true
#
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

配置完毕之后各节点重启即可。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Elasticsearch7.12.1是一个版本号,它是Elasticsearch的一个特定版本。根据引用\[1\]和引用\[2\]的内容,你可以按照以下步骤来安装和启动Elasticsearch7.12.1: 1. 进入到/home/elasticsearch/plugins目录下,创建一个名为ik的文件夹,并进入该文件夹。 2. 在ik文件夹中,使用wget命令下载对应版本的ik插件。可以使用以下命令进行下载: ``` wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip ``` 3. 启动Elasticsearch容器。可以使用以下命令启动容器: ``` docker run --name elasticsearch -p 9200:9200 -p9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -v /home/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/elasticsearch/data:/usr/share/elasticsearch/data -v /home/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.12.1 ``` 这个命令会创建一个名为elasticsearch的容器,并将9200端口映射到主机的9200端口上。同时,它会将配置文件、数据和插件目录挂载到容器中。 4. 复制容器内的elasticsearch.yml文件到/home/elasticsearch/config目录下。可以使用以下命令进行复制: ``` docker cp elasticsearch:/usr/share/elasticsearch/config/elasticsearch.yml /home/elasticsearch/config ``` 通过以上步骤,你就可以成功安装和启动Elasticsearch7.12.1了。请注意,这些步骤是根据引用\[1\]和引用\[2\]提供的信息进行的。 #### 引用[.reference_title] - *1* *2* *3* [docker安装elasticsearch7.12.1,并配置ik分词(详细步骤说明==手把手帮你敲)](https://blog.csdn.net/qq_36252295/article/details/125041711)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值