Elasticsearch7.10.2安装及启动

一.环境

Elasticsearch 7.10.2运行环境是jdk 11以上
安装下载jdk11
百度云
链接:https://pan.baidu.com/s/1wneFxHIcjzbUsQYrfhgi6Q
提取码:nfld

二.下载安装Elasticsearch

执行以下命令可以下载elasticsearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.2-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-7.10.2-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-7.10.2-linux-x86_64.tar.gz
cd elasticsearch-7.10.2/

三.修改Elasticsearch配置文件制定jdk 11

修改配置文件
[root@localhost bin]# pwd
/usr/local/src/elasticsearch/bin
[root@localhost bin]# vi elasticsearch
添加一下内容

#配置自己的jdk11
export JAVA_HOME=/sdb/javaWarehouse/jdk-11.0.1
export PATH=$JAVA_HOME/bin:$PATH
#添加jdk判断
if [ -x "$JAVA_HOME/bin/java" ]; then
        JAVA="/sdb/javaWarehouse/jdk-11.0.1/bin/java"
else
        JAVA=`which java`
fi

如下图
在这里插入图片描述

四.修改Elasticsearch配置:config/elasticsearch.yml

#action.destructive_requires_name: true
cluster.name: apm-application
node.name: node-1
path.data: /home/wgp/javawebObject/elasticsearch-7.10.2/data
path.logs: /home/wgp/javawebObject/elasticsearch-7.10.2/logs
# ES监听的ip地址
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]

# 需要开启跨域才能给elasticsearch-head,kibana等连接
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

如下图
在这里插入图片描述

五.启动Elasticsearch

# 启动方式一
./bin/elasticsearch -d -p pid
# 启动方式二 方便查看启动日志
./bin/elasticsearch
# 停止
pkill -F pid

六.启动Elasticsearch常见错误

  • 启动失败,有两个错误,是因为有两个参数的值太小
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  • 解决办法

第一个问题:修改/etc/security/limits.conf文件,添加或修改如下行

hard nofile 65536
soft nofile 65536

第二个问题:修改 /etc/sysctl.conf 文件,添加如下行

vm.max_map_count=655360

并执行命令:sysctl -p

七.解决启动错误之后再次启动

使用elsearch用户,再次尝试启动(Elasticsearch默认内存是1G,因为我的服务器内存是足够的,没有修改配置)
在这里插入图片描述

八.启动成功

查看是否启动成功:浏览器访问ip:9200,出现以下信息即为启动成功

{
  "name" : "node-1",
  "cluster_name" : "apm-application",
  "cluster_uuid" : "6u_qUA3URbugoO2Jf9OezA",
  "version" : {
    "number" : "7.10.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "747e1cc71def077253878a59143c1f785afa92b9",
    "build_date" : "2021-01-13T00:42:12.435326Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值