• ElasticSearch 学习1:linux 安装 ElasticSearch7.6.1


    基本下载安装

    1.进入elastic官网下载elasticsearchDownload Elasticsearch | Elastic

    2.进入命令行输入: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.1.tar.gz 下载到当前目录

    3.输入命令:tar -vxf elasticsearch-7.6.1.tar.gz 解压,此时会生成 elasticsearch-7.6.1 文件

    4.在 bin目录下./elasticsearch 或者./elasticsearch -d

    这四个步骤弄完就已经理论上已经安装好 ElasticSearch,但是:ElasticSearch为了安全和兼容埋了很多坑,不明白别的软件都是傻瓜安装,你这还得配置这,配置那的

    1.不能用root用户登录

    报错:asticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

    新加一个用户:useradd elastic

    并把elasticsearch的文件所有权限给elastic :chown elastic elasticsearch-7.6.1 -R

    2.jdk版本兼容问题

    报错:Exception in thread "main" java.lang.RuntimeException: Java version: Oracle Corporation 1.7``.0_45 [OpenJDK 64``-Bit Server VM 24.45``-b08] suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.

    elasticsearch是基于java开发出的项目所以要用jdk,不同版本的es是用不同版本的jdk

    用自己的jdk一般是不行的,es7.6用的是jdk12,实际生产环境没几个人会用吧,别慌着下jdk12,因为这个安装包里自带有jdk12,只是他没用,用的是你的环境变量的jdk.

    修改环境变量

    cd bin
    
    vim elasticsearch-env
    
    #在文档的最上面加入,引用自己的变量得了,您有干嘛还用环境变量中的
    export JAVA_HOME=/usr/local/elasticsearch-7.16.1/jdk
    export PATH=$JAVA_HOME/bin:$PATH
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    3.centos6.x版本兼容问题(7.x以上版本不用看此问题)

    报错:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

    cd ../config
    vim elasticsearch.yml
    #elasticsearch.yml中加入下面两行:是因为centos6.x操作系统不支持SecComp,而elasticsearch 5.5.2默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
    
    bootstrap.system_call_filter: false
    bootstrap.memory_lock: false
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    4.远程连接问题

    同样在elasticsearch.yml中,加入下面两行配置

    # 开启跨域
    http.cors.enabled: true
    # # 允许所有
    http.cors.allow-origin: "*"
    
    • 1
    • 2
    • 3
    • 4

    5.缺少集群配置问题

    启动报错:the default discovery settings are unsuitable for production use; at least…

    同样在elasticsearch.yml中

    #添加配置 至少一个节点
    #节点名字
    node.name: node-1
    discovery.seed_hosts: ["127.0.0.1"]
    cluster.initial_master_nodes: ["node-1"]
    
    • 1
    • 2
    • 3
    • 4
    • 5

    6.文件权限与内存大小问题

    启动报错:[2] bootstrap checks failed. You must address the points described in th

    elasticsearch用户拥有的可创建文件描述的权限太低,至少需要65536,

    ?处理办法: ? #切换到root用户修改
    
    vim /etc/security/limits.conf ? # 在最后面追加下面内容
    
    * soft nofile 65536
    * hard nofile 65536
    
    ?max_map_count文件包含限制一个进程可以拥有的VMA(虚拟内存区域)的数量?
    
    处理办法: ? ?#切换到root用户修改
    
     vim /etc/sysctl.conf ? ?# 在最后面追加下面内容
    
     vm.max_map_count=655360
    
    ?执行 ?sysctl -p
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

    最后在 bin目录下./elasticsearch 或者./elasticsearch -d

    启动成功,撒花,完结

  • 相关阅读:
    数据结构 day4 链表
    前端基础建设与架构20 如何理解前端中面向对象的思想?
    全局事件总线概述
    日语学习网站web项目
    Python 断言的使用
    uni-app:顶部导航栏图标titleImage
    Platform—企业通讯录
    Springboot整合WebScoket
    如何判断一款软件的安全性?
    安全狗陈奋:数据安全需要建立在传统网络安全基础之上
  • 原文地址:https://blog.csdn.net/m0_67402235/article/details/126581455