栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

Elasticsearch7.10.2安装及启动

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"
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/434050.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号