Elasticsearch-单机部署避坑指南
引言
ElasticSearch是一个基于Lucene的搜索引擎,它提供了一个基于RESTful web接口的分布式多用户的全文搜索引擎。ElasticSearch可以用来存储需要检索和统计的数据,它支持聚合、百分比、分段统计等,也可以用来存储日志,例如ELK(Elasticsearch+Logstash+Kibana)日志分析系统。本文主要介绍Elasticsearch的单机部署以及如何解决部署过程中碰到的各种坑。
部署指南
- 首先进入Elasticsearch官方下载页下载Elasticsearch安装包,笔者下载的是6.4.2的linux版本
- 使用tar命令解压并修改文件【elasticsearch-6.4.2/config/elasticsearch.yml】,修改network这块,将【network.host】修改为部署服务器的IP地址,【http.port】去掉前面的注释【#】。
- 使用非root用户运行如下命令
elasticsearch-6.4.2/bin/elasticsearch -d
- 启动成功运行命令【curl http://{IP}:9200】能看到如下输出就证明启动成功了:
{ "name" : "TUJE35D", "cluster_name" : "elasticsearch", "cluster_uuid" : "-fsA4mjPTyOe0fF-bPvvmA", "version" : { "number" : "6.4.2", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "04711c2", "build_date" : "2018-09-26T13:34:09.098244Z", "build_snapshot" : false, "lucene_version" : "7.4.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }
填坑指南
-
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
这个错误是因为使用了root账户启动Elasticsearch,换个非root账户启动就可以了;
-
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch-6.4.2/config/jvm.options
这是文件权限问题,启动Elasticsearch的用户没有elasticsearch-6.4.2目录的权限,运行如下命令修改文件夹权限
chown -R {启动Elasticsearch的用户}:{启动Elasticsearch用户所属的用户组} elasticsearch-6.4.2
-
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
这是用户最大可创建的文件数太小,只有4096,无法创建本地文件,需要增加到65536。切换到root用户,编辑limits.conf配置文件
vi /etc/security/limits.conf
添加如下两行,然后保存
{启动Elasticsearch的用户} soft nofile 65536 {启动Elasticsearch的用户} hard nofile 65536
-
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
这是因为设置的最大虚拟内存太小,切换到root用户下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=262144
并执行命令:
sysctl -p
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
Elasticsearch集成HanLP分词器
1、通过git下载分词器代码。 连接如下:https://gitee.com/hualongdata/hanlp-ext hanlp官网如下:http://hanlp.linrunsoft.com/ 2、下载gradle,如果本机有,就可以略过此步骤。通过gradle官方网站下载,解压,配置环境即可。 官方安装配置说明:https://gradle.org/install/ 3、按本地elasticsearch进行打包。 注意:通过git下载的源代码,除非与git配置的版本相同,否则可能会导致你elasticearch无法加载分词器。 修改git下载的源代码包中的elasticsearch版本。并通过gradle进行打包。会自动下载同步elasticsearch对应版本的jar包。 图1 4、按本地环境配置词类位置 图2 5、配置打包的插件所对应支持的elasticesarch的版本。(修改为:5.6.5,es安装的学习环境为5.6.5) 图3 6、完成上述配置把。gradle自动下载对应版本的包。可以通过如下方式进行版本查看。 图4 7、确认对应版本的包存在后,在工程所在目录...
- 下一篇
MySQL因不能创建 PID 导致无法启动的解决办法
MySQL 启动报错信息如下: Starting mysqld (via systemctl): Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details、 [FAILED] 根据提示,使用 systemctl status mysqld.service 和 journalctl -xe 查看服务启动失败的原因。阿里云2018年10月 优惠信息汇总 [root@ ~]# systemctl status mysqld.servicemysqld.service - SYSV: MySQL database server.Loaded: loaded (/etc/rc.d/init.d/mysqld)Active: failed (Result: exit-code) since Wed 2016-01-20 18:26:57 CST; 40s...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
-
Docker使用Oracle官方镜像安装(12C,18C,19C)
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS8编译安装MySQL8.0.19
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- MySQL8.0.19开启GTID主从同步CentOS8
- CentOS7,8上快速安装Gitea,搭建Git服务器
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
推荐阅读
最新文章
- CentOS6,CentOS7官方镜像安装Oracle11G
- Windows10,CentOS7,CentOS8安装Nodejs环境
- CentOS8编译安装MySQL8.0.19
- SpringBoot2整合Thymeleaf,官方推荐html解决方案
- 设置Eclipse缩进为4个空格,增强代码规范
- CentOS7,8上快速安装Gitea,搭建Git服务器
- Windows10,CentOS7,CentOS8安装MongoDB4.0.16
- CentOS7安装Docker,走上虚拟化容器引擎之路
- CentOS6,7,8上安装Nginx,支持https2.0的开启
- CentOS7编译安装Cmake3.16.3,解决mysql等软件编译问题