ElasticSearch速学 - 安装ElasticSearch的方法和要点

Elasticsearch:第三方开源搜索引擎。

ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。

官网地址:
https://www.elastic.co/cn/products/elasticsearch

环境要求:
CentOS 6/7
Java版本(这个要根据你elasticsearch的版本来,可以查看elasticsearch的文档)

https://www.elastic.co/guide/en/elasticsearch/reference/5.3/setup.html
比如我这里是 elasticsearch 5.3,它要求java版本是1.8.0_73 or later
这里写图片描述

在linux上安装jdk可以看这里:
http://blog.csdn.net/github_26672553/article/details/58222614

这里写图片描述

es建议我们linux的内核要高一点,我们在使用es之前最好升级一下linux内核
我们现在查看一下我们当前liunx的相关版本信息:
这里写图片描述

百度自行升级linux内核。

进入正题

下载Elasticsearch :

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.0.zip

解压:

unzip elasticsearch-5.3.0.zip

解压完成会有一个elasticsearch-5.3.0的目录。

修改es的配置文件elasticsearch.yml:

cd elasticsearch-5.3.0/config/
vi elasticsearch.yml

主要修改如下内容:

# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
# Use a descriptive name for your cluster:
#
cluster.name: test-search

修改完配置文件之后,我们来启动ES:

cd elasticsearch-5.3.0/bin/
./elasticsearch

可能会报错,因为我们是在虚拟机中来演示的。
如果报下面的错误信息:

max file descriptors [10032] for elasticsearch process is too low, increase to at least [65536]
max number of threads [1024] for user [admin] is too low, increase to at least [2048]

我们需要去修改/etc/security/limits.conf这个文件,主要修改如下内容:

admin soft nofile 65536
admin hard nofile 65536
admin soft nproc 2048
#修改这3项,没有就增加
#注意"admin"是我们登陆用户名,也就是运行es的用户名

修改好之后,可以使用ulimit -a 命令查看变化。

启动es时可能报的另一个错误:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

这时需要去修改/etc/sysctl.conf文件,添加如下内容:

vm.max_map_count = 262144

然后指向命令:

sudo  sysctl -p 

同时因为可能我们虚拟机的内存不够,我们还有必要修改一下jvm.options这个配置文件:

cd elasticsearch-5.3.0/config/
vi jvm.options 

修改下面的内容:

-Xms1g
-Xmx1g
#默认时2g,修改为1g
#根据你的内存考虑

如果时这个错误:
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

在es的配置文件elasticsearch.yml中加入下面这行:

bootstrap.system_call_filter: false

重启启动es:

cd elasticsearch-5.3.0/bin
./elasticsearch 

浏览器访问:

http://你的服务器ip地址:9200/

这里写图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值