目录
下载 zip 包
在 linux 里面解压
进入bin目录
创建用户useres
授权到es目录
切换到useres用户
bin 目录启动
配置 端口开放
配置 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/bin2.修改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" ]; doES_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" ]; thenJAVA="$ES_JAVA_HOME/bin/java"JAVA_TYPE="ES_JAVA_HOME"
elif [ ! -z "$JAVA_HOME" ]; then# fallback to JAVA_HOMEecho "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"fiJAVA_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