ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
0,安装java的JDK
参考:Linux安装Java的JDK方法 https://form1.cn/java-java-179.html
1,打开官网下载elasticsearch
https://www.elastic.co/downloads/elasticsearch
点击MACOS/LINUX下载,本文编写时Version: 6.5.4
2,下载到服务器解压然后进入目录
1 2 3 | wget https: //artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.tar.gz tar -zxvf elasticsearch-6.5.4.tar.gz cd elasticsearch-6.5.4 |
3,修改配置文件
1 | vim elasticsearch-6.5.4/config/elasticsearch.yml |
network.host: 0.0.0.0 # 改为可远程连接(所有IP都可以连接)
http.port: 9200 #连接的端口号
4,运行elasticsearch
./bin/elasticsearch #前台运行
或使用screen后台运行
5,访问IP:9200测试
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | { name: "LEx49t5" , cluster_name: "elasticsearch" , cluster_uuid: "XVfaih-rQziE6mgD3vyzYQ" , version: { number: "6.5.4" , build_flavor: "default" , build_type: "tar" , build_hash: "d2ef93d" , build_date: "2018-12-17T21:17:40.758843Z" , build_snapshot: false, lucene_version: "7.5.0" , minimum_wire_compatibility_version: "5.6.0" , minimum_index_compatibility_version: "5.0.0" }, tagline: "You Know, for Search" } |
-------------------------------------------------------------
遇到的问题:
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
elasticsearch安装时遇到的错误
问题翻译过来就是:elasticsearch用户拥有的可创建文件描述的权限太低,至少需要65536;
解决:
#切换到root用户修改
vim /etc/security/limits.conf
# 在最后面追加下面内容
*** hard nofile 65536
*** soft nofile 65536
*** 是启动ES的用户