言简意赅 Linux部署elasticsearch7.15.2

目录

[下载 zip 包](#下载 zip 包)

[在 linux 里面解压](#在 linux 里面解压)

进入bin目录

创建用户useres

授权到es目录

切换到useres用户

[bin 目录启动](#bin 目录启动)

[配置 端口开放](#配置 端口开放)

[配置 jdk](#配置 jdk)

[单节点启动 一定要配置](#单节点启动 一定要配置)

说明成功


byd折磨了我两天

下载 zip 包

通过网盘分享的文件:elasticsearch-7.15.2-linux-x86_64.tar.gz

链接: 百度网盘 请输入提取码

提取码: ke66

在 linux 里面解压

进入bin目录

复制代码
cd /www/server/elasticsearch/elasticsearch-7.15.2/bin

创建用户useres

复制代码
useradd useres

授权到es目录

要在elasticsearch-7.15.2 的父级目录授权

复制代码
chown useres:useres -R elasticsearch-7.15.2

切换到useres用户

复制代码
su useres

bin 目录启动

注意我的细节

找到 bin 目录

复制代码
./elasticsearch -d

配置 端口开放

编辑conf/elasticsearch.yml文件

复制代码
# 取消注释,默认只能本地访问,修改为0.0.0.0,外网也能访问
network.host: 0.0.0.0  

配置 jdk

elasticsearch 是 Java 强绑定应用

适配 java17

优先找系统目录下的 java

我们要修改绑定到elasticsearch 目录下的 java

  1. 进入bin目录

2.修改elasticsearch-env配置

复制代码
1. 进入bin目录
 
cd /usr/local/elasticsearch-7.14.0/bin
 
2.修改elasticsearch-env配置
 
vim ./elasticsearch-env
 
# 将jdk修改为es中自带jdk的配置目录,es自带的jdk位置/usr/local/es/elasticsearch-7.14.0/jdk
 
# now make ES_HOME absolute
ES_HOME=`cd "$ES_HOME"; pwd`
 
while [ "`basename "$ES_HOME"`" != "bin" ]; do
  ES_HOME=`dirname "$ES_HOME"`
done
ES_HOME=`dirname "$ES_HOME"`
 
# now set the classpath
ES_CLASSPATH="$ES_HOME/lib/*"
 
# now set the path to java
if [ ! -z "$ES_JAVA_HOME" ]; then
  JAVA="$ES_JAVA_HOME/bin/java"
  JAVA_TYPE="ES_JAVA_HOME"
elif [ ! -z "$JAVA_HOME" ]; then
  # fallback to JAVA_HOME
  echo "warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME" >&2
  #JAVA="$JAVA_HOME/bin/java"
# 将jdk修改为es中自带jdk的配置目录
  JAVA="/usr/local/es/elasticsearch-7.14.0/jdk/bin/java"
  JAVA_TYPE="JAVA_HOME"
else
  # use the bundled JDK (default)
  if [ "$(uname -s)" = "Darwin" ]; then
    # macOS has a different structure
    #JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java"
# 将jdk修改为es中自带jdk的配置目录
    JAVA="/usr/local/es/elasticsearch-7.14.0/jdk/bin/java"
  else
    #JAVA="$ES_HOME/jdk/bin/java"
# 将jdk修改为es中自带jdk的配置目录
    JAVA="/usr/local/es/elasticsearch-7.14.0/jdk/bin/java"
  fi
  JAVA_TYPE="bundled JDK"
fi

# 将jdk修改为es中自带jdk的配置目录
  JAVA="/usr/local/es/elasticsearch-7.14.0/jdk/bin/java"

单节点启动 一定要配置

复制代码
# ======================== 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
#
# 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:
#
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
#
# 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"]
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true

说明成功

相关推荐
玖伴_15 分钟前
【Java】Mybatis学习笔记
java·学习·mybatis
程序员JerrySUN18 分钟前
深入理解C++编程:从内存管理到多态与算法实现
开发语言·c++·算法
风正豪27 分钟前
用 C 语言理解封装、继承、多态
c语言·开发语言
Code哈哈笑35 分钟前
【JavaEE】快速上手JSON:构建高效 Java 后端数据桥梁,开启交互新篇,以 @RequestBody 为引的探索之旅
java·java-ee·json
青云交1 小时前
Java 大视界 -- Java 大数据在智慧交通自动驾驶仿真与测试数据处理中的应用(136)
java·大数据·自动驾驶·数据存储·仿真·智慧交通·测试数据处理
糖心何包蛋爱编程1 小时前
(四)Reactor核心-前置知识3
java·开发语言·经验分享·响应式编程·streamapi
Multiple-ji1 小时前
深入理解Python闭包与递归:原理、应用与实践
开发语言·python
Trouvaille ~1 小时前
【Java篇】一气化三清:类的实例化与封装的智慧之道
java·开发语言·类和对象·javase·编程规范·基础入门·软件包
郝YH是人间理想1 小时前
Python、MATLAB和PPT完成数学建模竞赛中的地图绘制
开发语言·python·数学建模·matlab·echarts
做程序员的第一天1 小时前
PyCharm的终端(terminal)中进入指定conda虚拟环境
linux·pycharm·conda