环境

因为elasticsearch是用java编写的,所以需要先安装JDK

ES 5,安装需要 JDK 8 以上
ES 6.5,安装需要 JDK 11 以上
ES 7.2.1,内置了 JDK 12

安装jdk11

yum -y install java-11-openjdk.x86_64

使用 wget 命令下载

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.6.tar.gz

安装elasticsearch

1、解压elasticsearch到 /usr/local 目录下

tar -zxvf elasticsearch-5.6.6.tar.gz -C /usr/local/

2、elasticsearch默认是不支持用root用户来启动的,需要添加专门的用户

cd /usr/local
useradd elastic
chown -R elastic:elastic elasticsearch-5.6.6/
su elastic
./elasticsearch-5.6.6/bin/elasticsearch -d

2、进入到解压的elasticsearch包目录下、启动参数 -d 指的是后台运行

cd /usr/local/elasticsearch-5.6.6/
./bin/elasticsearch -d

3、使用  curl http://localhost:9200/  查看是否运行,如果返回如下信息则标示运行正常

4、elasticsearch默认restful-api的端口是9200 不支持Ip地址,只能在本机用http://localhost:9200来访问。如果需要改变,需要修改配置文件。

默认情况下 Elasticsearch 的 RESTful 服务只有本机才能访问,也就是说无法从主机访问虚拟机中的服务。

可以修改 /etc/elasticsearch/config/elasticsearch.yml 文件,将注释的 network.host 和 http.port 放开,并配置正确的IP(或者0.0.0.0)

cd /usr/local/elasticsearch-5.6.6
vim config/elasticsearch.yml

5、先将Elasticsearch 关闭,然后启动;

关闭方法:输入命令: ps -ef | grep elasticsearch ,找到进程,然后kill掉就行了;

启动方法:输入命令:su elastic , 然后输入 ./bin/elasticserach -d

6、在谷歌浏览器中打开:http://{server_IP}:9200/

问题

1、问题一:启动elasticsearch报错如下:Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

解决方法:

由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配: vim config/jvm.options

-Xms2g
-Xmx2g

修改为

-Xms512m
-Xmx512m

2、问题二:启动elasticsearch报错如下:org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

解决方法:

原因是elasticsearch默认是不支持用root用户来启动的,需要添加专门的用户。

cd /usr/local
useradd elastic
chown -R elastic:elastic elasticsearch-5.6.6/
su elastic
./elasticsearch-5.6.6/bin/elasticsearch -d

3、问题三:启动报错如下

ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1775] for user [elastic] is too low, increase to at least [2048]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方法:

(1)[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

    [2]: max number of threads [1775] for user [elastic] is too low, increase to at least [2048]

先切换到root账户下面,使用 vi /etc/security/limits.conf ,增加如下内容

elastic soft nofile 65536
elastic hard nofile 65536
elastic soft nproc 2048
elastic hard nproc 2048

(2)[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

使用 vim /etc/sysctl.conf ,增加如下的内容

vm.max_map_count=262144

输入:sysctl -p ,如下所示

(3)重新启动elasticsearch

su elastic
cd /usr/local/elasticsearch-5.6.6
./bin/elasticsearch -d

安装moloch

下载地址:https://files.molo.ch/builds/centos-7/moloch-1.8.0-1.x86_64.rpm

https://www.cnblogs.com/yaoyaojcy/p/11727122.html

https://www.cnblogs.com/yaoyaojcy/p/11731738.html

Centos7下安装Elasticsearch 5.6.6的更多相关文章

  1. centos7下安装elasticSearch错误总结(单节点模式)

    1.首先确定你安装了jdk,版本需要1.8以上 2.上传elasticsearchjar包,只需配置一个文件即可 修改配置文件config/elasticsearch.yml    network.h ...

  2. CentOS7 下 安装 supervisor以及使用

    CentOS7 下 安装 supervisor 以及使用 手动安装 [注] linux环境必须安装 python 1.获取supervisor包:[https://pypi.python.org/py ...

  3. Linux CentOs7 下安装 redis

    Linux CentOs7 下安装 redis 请将以下命令放入linux命令行中运行 如果安装过程前没有安装GCC请先安装  命令如下 $ yum install gcc-c++ $ wget ht ...

  4. Centos7下安装配置Redsocks

    Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库.Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配 ...

  5. CentOS7下安装SVN服务端

    CentOS7下安装SVN服务 1. yum命令即可方便的完成安装# sudo yum install subversion 测试安装是否成功:# svnserve --version 更改svn的默 ...

  6. 记录Linux下安装elasticSearch时遇到的一些错误

    记录Linux下安装elasticSearch时遇到的一些错误 http://blog.sina.com.cn/s/blog_c90ce4e001032f7w.html (2016-11-02 22: ...

  7. ES1:Windows下安装ElasticSearch

    ElasticSearch(简称ES)是一个基于Lucene的分布式全文搜索服务器,本随笔演示在Windows安装ElasticSearch和用于管理ES的Head插件. ElasticSearch官 ...

  8. centOS7下安装GUI图形界面

    1.如何在centOS7下安装GUI图形界面 当你安装centOS7服务器版本的时候,系统默认是不会安装GUI的图形界面程序,这个需要手动安装CentOS7 Gnome GUI包. 2.在系统下使用命 ...

  9. CentOS7下安装MySQL并配置远程连接

    一.CentOS7下安装MySQL数据库 CentOS7默认的安装包里面已经没有 MySQL-Server安装包了,远程镜像中也没有了. 默认的是MariaDB (MySQL的一个分支,开发这个分支的 ...

随机推荐

  1. ELK之elasticsearch7版本集群设置

    ELK7版本搭建参考:https://www.cnblogs.com/minseo/p/10948632.html node-1已经安装配置好 配置文件如下 [root@salt-test conf. ...

  2. Spring 使用下列表

    模型层需要提供数据选项,设置错误信息 关键代码 @NotEmpty(message = "请选择兴趣爱好") private String[] hobbies; 控制器层需要在显示 ...

  3. Codis-dashboard的配置和启停

    Codis-dashboard是集群的管理工具 生成配置文件,即将现有的配置文件输出到指定目录位置: ./codis-dashboard --default-config | tee conf/das ...

  4. 彻底理解js中this的指向,不必硬背(转)

    转自: http://www.h5cn.com/js/jishu/2016/0226/18248.html 首先必须要说的是,this的指向在函数定义的时候是确定不了的,只有函数执行的时候才能确定th ...

  5. POJ2449 【第k短路/A*】

    题目链接:http://poj.org/problem?id=2449 题目大意: 给出n个点,m条有向边,最后一行给出起点到终点的第k短路.求长度. 题解思路: 这是我第一道第k短路题以及A*算法的 ...

  6. 19年最新 Python0基础学习书籍推荐(内涵PDF地址以及书籍源码)

    去年看过一篇文章,是关于18年的最适合0基础学习的书籍,今年,最新的书籍也已经统计出来.书籍的PDF太过于难找,所以很多PDF都找不到. 仅仅只能找到英文版PDF 本文章统计了18.19并做过对比,在 ...

  7. 一篇搞定Java过滤器

    Filter:过滤器 引言 我们可以通过使用前面的技术,做出一些简单的登陆注册以及配合数据库实现对数据增删改查的Demo,程序是基本运行起来了,但是却存在着一个重大的安全问题,那就登陆权限验证,一般来 ...

  8. ASP.NET请求过程-Handler

    什么事Handler asp.net程序所有的请求都是handler处理的.以前的webform我们访问的地址是xxxxx.aspx地址,其实他也会到一个handler(我们写的业务代码都在handl ...

  9. 给出一个javascript的Helloworld例子

    1.基础知识:Helloworld:例 1.1<html><head>    <!--  如果你用notepad建立一个txt之后你再改为html,一定在存时,要存成ut ...

  10. Redis 常用命令学四:有序集合类型命令

    1.增加元素,修改存在元素的分数 127.0.0.1:6379> zadd score 99 a 88 b 66 c (integer) 3 127.0.0.1:6379> ZADD sc ...