Centos7下安装Elasticsearch 5.6.6
环境
因为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的更多相关文章
- centos7下安装elasticSearch错误总结(单节点模式)
1.首先确定你安装了jdk,版本需要1.8以上 2.上传elasticsearchjar包,只需配置一个文件即可 修改配置文件config/elasticsearch.yml network.h ...
- CentOS7 下 安装 supervisor以及使用
CentOS7 下 安装 supervisor 以及使用 手动安装 [注] linux环境必须安装 python 1.获取supervisor包:[https://pypi.python.org/py ...
- Linux CentOs7 下安装 redis
Linux CentOs7 下安装 redis 请将以下命令放入linux命令行中运行 如果安装过程前没有安装GCC请先安装 命令如下 $ yum install gcc-c++ $ wget ht ...
- Centos7下安装配置Redsocks
Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库.Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配 ...
- CentOS7下安装SVN服务端
CentOS7下安装SVN服务 1. yum命令即可方便的完成安装# sudo yum install subversion 测试安装是否成功:# svnserve --version 更改svn的默 ...
- 记录Linux下安装elasticSearch时遇到的一些错误
记录Linux下安装elasticSearch时遇到的一些错误 http://blog.sina.com.cn/s/blog_c90ce4e001032f7w.html (2016-11-02 22: ...
- ES1:Windows下安装ElasticSearch
ElasticSearch(简称ES)是一个基于Lucene的分布式全文搜索服务器,本随笔演示在Windows安装ElasticSearch和用于管理ES的Head插件. ElasticSearch官 ...
- centOS7下安装GUI图形界面
1.如何在centOS7下安装GUI图形界面 当你安装centOS7服务器版本的时候,系统默认是不会安装GUI的图形界面程序,这个需要手动安装CentOS7 Gnome GUI包. 2.在系统下使用命 ...
- CentOS7下安装MySQL并配置远程连接
一.CentOS7下安装MySQL数据库 CentOS7默认的安装包里面已经没有 MySQL-Server安装包了,远程镜像中也没有了. 默认的是MariaDB (MySQL的一个分支,开发这个分支的 ...
随机推荐
- Andrew Ng机器学习课程14(补)
Andrew Ng机器学习课程14(补) 声明:引用请注明出处http://blog.csdn.net/lg1259156776/ 利用EM对factor analysis进行的推导还是要参看我的上一 ...
- 微信H5支付开发全过程(除内置微信以外的浏览器)
前言:网上都是~ 呵呵 自己搞 只要花时间 多问客服总会有的 只说程序不说准备工作 自己ID 或者秘钥都准备好了 写的有点儿乱 可以把所有的方法 放在一个文件中调用 public function ...
- Go之gob包的使用
gob包("encoding/gob")管理gob流——在encoder(编码器,也就是发送器)和decoder(解码器,也就是接受器)之间交换的字节流数据(gob 就是 go b ...
- [转帖]最佳 Linux 发行版汇总
最佳 Linux 发行版汇总 https://cloud.tencent.com/developer/article/1505186 以后说不定用的到. Linux入门 Ubuntu Ubuntu是一 ...
- [转帖]Nginx服务器的六种负载均衡策略详解
Nginx服务器的六种负载均衡策略详解 咔咔侃技术 2019-09-11 17:40:12 一.关于Nginx的负载均衡 在服务器集群中,Nginx起到一个代理服务器的角色(即反向代理),为了避免单独 ...
- Word 查找替换高级玩法系列之 -- 制表符对齐人工目录
自己在Word中输入目录的时候是不是总也对不齐最右边的页码?这就是人工制作目录的不足之处了,但因着它能让我们更自由的发挥,所以还是得到了一些人的偏爱.那么问题来了,到底要怎么对齐这种人工目录呢? 1. ...
- egret 微信小游戏 错误
1,使用jszip错误 (1) t.createElementNS is not a function 修改:webapp-adapter.js,增加一个方法 createElementNS: f ...
- 2019杭电多校一 C. Milk (dp)
大意: $n*m$棋盘, 初始位置$(1,1)$, 横坐标为$\frac{m+1}{2}$时可以向下走, 否则只能左右走, 每走一步花费$1$秒. 有$k$管奶, 第$i$罐位置$(r_i,c_i)$ ...
- root用户和sudo使用root权限的区别(转)
百度百科:https://baike.baidu.com/item/sudo/7337623?fr=aladdin sudo指令 功能: 以root的身分执行命令 语法: sudo 其他指令 用户: ...
- SQL语句中加中括号[ ]的作用
有些可能是SQL里面的保留字,但是你又用了它做字段名 比如Action,用[Action] 就可以避免这个问题,如果直接Action SQL就要报错了. 解决较长的中文名表名可能会被不识别的问题.