• Centos7安装ElasticSearch6.5.4


    因为ElasticSearch是基于Lucene的分布式搜索引擎,Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,所以需要先在你的环境中安装jre环境。具体可以参考这篇文章Centos7 安装和配置jre1.8。

    第一步,下载ElasticSearch

    https://www.elastic.co/downloads/elasticsearch

    第二步,上传到/home/data目录下

    cd /home
    mkdir data
    cd data
    rz
    第三步,解压文件并移动到elasticsearch目录下

    tar -zxvf elasticsearch-6.5.4.tar.gz
    cd ..
    mkdir elasticsearch
    mv /home/data/elasticsearch-6.5.4/ /home/elasticsearch/
    第四步,启动elasticsearch

    cd /home/elasticsearch/elasticsearch-6.5.4/bin
    ./elasticsearch
    发现报错

    表示不能使用root用户启动elasticsearch。我们需要创建一个用户来启动elasticsearch

    groupadd esgroup
    useradd esuser -g esgroup-p esuser
    给elasticsearch目录授予esuser权限

    chown esuser:esgroup -R /home/elasticsearch/
    现在切换esuser用户再次启动

    su esuser
    ./elasticsearch
    如果出现如下标志表示启动成功了

    测试一下,9200是elasticsearch的默认端口

    curl http://localhost:9200


    现在配置远程访问

    修改elasticsearch配置文件

    /home/elasticsearch/elasticsearch-6.5.4/config/elasticsearch.yml
    network.host就是你的服务器的ip地址

    在末尾添加

    http.cors.enabled: true
    http.cors.allow-origin: "*"


    防火墙开放9200端口

    firewall-cmd --zone=public --add-port=9200/tcp --permanent
    firewall-cmd --reload
    或者关闭防火墙

    systemctl stop firewalld.service

    systemctl disable firewalld.service 禁止防火墙开机启动
    再次重启elasticsearch。

    在Windows电脑的浏览器访问http://192.168.0.117:9200/

    这就已经配置好了。

    可能遇见的问题

    max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

    解决办法:

    vi /etc/security/limits.conf
    在末尾添加,* 表示全部用户

    * soft nofile 65536

    * hard nofile 131072

    * soft nproc 2048

    * hard nproc 4096
    max number of threads [2048] for user [lishang] likely too low, increase to at least [4096]

    解决办法:

    vi /etc/security/limits.d/20-nproc.conf
    将如下内容

    * soft nproc 2048
    修改为

    * soft nproc 4096
    max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

    解决办法:

    vi /etc/sysctl.conf
    文件末尾添加

    vm.max_map_count=655360
    执行命令

    sysctl -p
    重启服务器

    再次启动elasticsearch,发现可以正常启动了。

  • 相关阅读:
    C# Asp.net 修改Ueditor编辑器上传图片保存路径
    Asp.net Mvc Ajax.BeginForm提交表单
    Asp.net Mvc post表单提交多个实体模型
    Asp.net Mvc action返回多个模型实体给view
    在Windows Server 2008 R2 Server中,上传视频遇到的问题(二)
    不能往Windows Server 2008 R2 Server中复制文件的解决方法
    在Windows Server 2008 R2 Server中,上传视频遇到的问题(一)
    ef codefirst 模型字段类型与sqlserver表字段类型对应概要
    c# string 扩展方法
    mvc,EntityFramework调用分页存储过程
  • 原文地址:https://www.cnblogs.com/zuikeol/p/10930685.html
Copyright © 2020-2023  润新知