Elasticsearch在信创环境中适配(集群-No JDK)

一、部署说明

下载安装包,地址Download Elasticsearch | Elastic

右侧可选择不同版本

下载完成之后上传到第一台服务器172.26.51.154下的/data路径,之后解压

tar -zxvf  elasticsearch-7.17.0-linux-aarch64.tar.gz 

二、配置文件修改(三个节点)

1、elasticsearch.yml

(1)节点一

vim  elasticsearch-7.17.0/config/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: my-application   #去掉注释,三个服务器保持一致
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1  #节点名称,三台服务器均不一样
node.master: true  #手动添加
node.data: true    #手动添加
node.max_local_storage_nodes: 3   #手动添加
#
# 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/elasticsearch-7.17.0/data   #修改为数据存放路径
#
# Path to log files:
#
path.logs: /data/elasticsearch-7.17.0/logs    #修改为数据存放路径
#
# ----------------------------------- Memory -----------------------------------
bootstrap.memory_lock: false   #手动添加

xpack.ml.enabled: false        #手动添加

ingest.geoip.downloader.enabled: false   #手动添加
# 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:
#
network.host: 0.0.0.0   #修改为允许远程访问
#
# 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     #去掉注释
transport.tcp.port: 9300   #手动添加
#
# 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: ["172.26.51.154:9300", "172.26.51.161:9400", "172.26.51.175:9500"] #三台服务器保持一致
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]    #三台服务器保持一致
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Security ----------------------------------
#
#                                 *** WARNING ***
#
# Elasticsearch security features are not enabled by default.
# These features are free, but require configuration changes to enable them.
# This means that users don’t have to provide credentials and can get full access
# to the cluster. Network connections are also not encrypted.
#
# To protect your data, we strongly encourage you to enable the Elasticsearch security features. 
# Refer to the following documentation for instructions.
#
# https://www.elastic.co/guide/en/elasticsearch/reference/7.16/configuring-stack-security.html

然后将节点一上的elasticsearch-7.17.0文件夹打包,并使用scp命令远程移动到另外两个节点的data目录下

scp elasticsearch-7.17.0-154.tar.gz  root@172.26.51.175:/data
scp elasticsearch-7.17.0-154.tar.gz  root@172.26.51.161:/data

(2)节点二

# ======================== 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: my-application   #去掉注释,三个服务器保持一致
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-2  #节点名称,三台服务器均不一样
node.master: true  #手动添加
node.data: true    #手动添加
node.max_local_storage_nodes: 3   #手动添加
#
# 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/elasticsearch-7.17.0/data   #修改为数据存放路径
#
# Path to log files:
#
path.logs: /data/elasticsearch-7.17.0/logs    #修改为数据存放路径
#
# ----------------------------------- Memory -----------------------------------
bootstrap.memory_lock: false   #手动添加

xpack.ml.enabled: false        #手动添加

ingest.geoip.downloader.enabled: false   #手动添加
# 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:
#
network.host: 0.0.0.0   #修改为允许远程访问
#
# 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     #去掉注释
transport.tcp.port: 9400   #手动添加
#
# 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: ["172.26.51.154:9300", "172.26.51.161:9400", "172.26.51.175:9500"] #三台服务器保持一致
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]    #三台服务器保持一致
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Security ----------------------------------
#
#                                 *** WARNING ***
#
# Elasticsearch security features are not enabled by default.
# These features are free, but require configuration changes to enable them.
# This means that users don’t have to provide credentials and can get full access
# to the cluster. Network connections are also not encrypted.
#
# To protect your data, we strongly encourage you to enable the Elasticsearch security features. 
# Refer to the following documentation for instructions.
#
# https://www.elastic.co/guide/en/elasticsearch/reference/7.16/configuring-stack-security.html

和第一个节点相比,修改了两处地方,其它均保持不变

node.name: node-2
transport.tcp.port: 9400 

(3)节点三

# ======================== 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: my-application   #去掉注释,三个服务器保持一致
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-3  #节点名称,三台服务器均不一样
node.master: true  #手动添加
node.data: true    #手动添加
node.max_local_storage_nodes: 3   #手动添加
#
# 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/elasticsearch-7.17.0/data   #修改为数据存放路径
#
# Path to log files:
#
path.logs: /data/elasticsearch-7.17.0/logs    #修改为数据存放路径
#
# ----------------------------------- Memory -----------------------------------
bootstrap.memory_lock: false   #手动添加

xpack.ml.enabled: false        #手动添加

ingest.geoip.downloader.enabled: false   #手动添加
# 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:
#
network.host: 0.0.0.0   #修改为允许远程访问
#
# 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     #去掉注释
transport.tcp.port: 9500   #手动添加
#
# 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: ["172.26.51.154:9300", "172.26.51.161:9400", "172.26.51.175:9500"] #三台服务器保持一致
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1", "node-2", "node-3"]    #三台服务器保持一致
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#
# ---------------------------------- Security ----------------------------------
#
#                                 *** WARNING ***
#
# Elasticsearch security features are not enabled by default.
# These features are free, but require configuration changes to enable them.
# This means that users don’t have to provide credentials and can get full access
# to the cluster. Network connections are also not encrypted.
#
# To protect your data, we strongly encourage you to enable the Elasticsearch security features. 
# Refer to the following documentation for instructions.
#
# https://www.elastic.co/guide/en/elasticsearch/reference/7.16/configuring-stack-security.html

和第一个节点相比,修改了两处地方,其它均保持不变

node.name: node-3
transport.tcp.port: 9500 

2、limits.confse

vi /etc/security/limits.conf,在文件末尾添加如下内容

* soft nofile 655360
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096

3、sysctl.conf

vi /etc/sysctl.conf

//添加内容

vm.max_map_count=655360

注意:执行sysctl -p

4、JDK配置

vim /data/elasticsearch-7.17.0/bin/elasticsearch

在首行添加

export JAVA_HOME=/opt/leap-jdk8
export PATH=${JAVA_HOME}/bin:/$PATH

三、新建用户,并赋予权限(三个节点)

useradd  es

passwd   es

在三个节点的elasticsearch-7.17.0/目录下新建data文件夹

cd elasticsearch-7.17.0/ && mkdir /data/

给elasticsearch-7.17.0文件夹es用户权限

cd /data/

chown -R es:users *  elasticsearch-7.17.0/

四、依次启动三个节点服务

nohup /elasticsearch-7.17.0/bin/elasticsearch & 

注意:如果忘记切换到es用户,第一次使用root启动的情况下,在data目录logs目录下就会生成属于root组的文件,使用es用户启动时就会报错,此时需要到进入到logs目录下执行chown -R es:users *

data目录操作与上面一致  chown -R es:users data/

五、集群测试

http://172.26.51.154:9200/_cat/nodes?v

  • 22
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值