当前位置: 首页 > article >正文

言简意赅 Linux部署elasticsearch7.15.2

目录

下载 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/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

说明成功


http://www.kler.cn/a/592178.html

相关文章:

  • C语言:编程设计猜数游戏
  • Deflate和Gzip压缩在HTTP响应中的作用与实现
  • NLP高频面试题(六)——decoder-only、encoder-only和encoder-decoder的区别与联系
  • laravel 对 数据库 json 字段的查询方式汇总
  • Post-Training Quantization, PTQ
  • nginx性能优化有哪些方式?
  • Bash 脚本基础
  • numpy学习笔记15:模拟100次随机游走,观察平均行为
  • C++ 语法之函数和函数指针
  • 合约编译部署基本流程
  • Spring(8)——MyBatis入门(2)
  • pycharm运行OpenCV项目踩坑记录
  • 3D开发工具HOOPS SDK:赋能CAM软件开发的利器
  • 以太网安全管理实验——ARP欺骗
  • Deepseek本地部署及本地知识库搭建(保姆级截图)
  • VIVO手机如何实现证件照换底色?证件照换底色技巧分享
  • 【RabbitMQ】RabbitMQ的基本架构是什么?包括哪些核心组件?
  • NIC数据包的接收与发送
  • 【STL】string类用法介绍及部分接口的模拟实现
  • pnpm创建vite