言简意赅 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

说明成功

相关推荐
知其然亦知其所以然几秒前
SpringAI + Groq 实战:3 分钟教你搭建超快聊天机器人!
java·后端·openai
地球被支点撬走啦1 分钟前
jetson ubuntu 打不开 firefox和chromium浏览器
linux·firefox·jetson
Lovyk10 分钟前
完整实验命令解析:从集群搭建到负载均衡配置
linux·运维·服务器
阿波罗尼亚14 分钟前
ExcelUtils实现 设置内容 插入行 复制行列格式
java·开发语言
qq_3411604415 分钟前
文件系统挂载详细分析(《图解Linux内核》虚拟文件系统篇笔记二)
linux·服务器·笔记
Monkey-旭22 分钟前
Android 定位技术全解析:从基础实现到精准优化
android·java·kotlin·地图·定位
带刺的坐椅22 分钟前
Solon StateMachine 实现状态机使用示例详解
java·solon·状态机
Yyyy48237 分钟前
MyCAT高可用
java·运维
Fireworkitte1 小时前
Ubuntu 系统 tar 包源码安装 Nginx
linux·nginx·ubuntu
熬夜苦读学习1 小时前
Reactor 反应堆模式
运维·服务器·网络·网络协议·http·智能路由器·php