Elasticsearch是实时全文搜索和分析引擎,提供搜集、分析、存储数据三大功能;是一套开放REST和JAVA API等结构提供高效搜索功能,可扩展的分布式系统。它构建于Apache Lucene搜索引擎库之上。
下载地址:https://www.elastic.co/cn/downloads/elasticsearch
我的系统是centos 直接采用 yum 安装
说明地址:https://www.elastic.co/guide/en/elasticsearch/reference/7.9/rpm.html#rpm-repo
启动
/etc/init.d/elasticsearch start
先检查9200端口是否起来
netstat -antp |grep 9200
浏览器访问测试是否正常(以下为正常)
# curl http://127.0.0.1:9200/
安装elasticsearch-head插件
使用git安装elasticsearch-head
# yum install -y npm
# git clone git://github.com/mobz/elasticsearch-head.git
# cd elasticsearch-head
# npm install
# npm run start
检查端口是否起来
netstat -antp |grep 9100
浏览器访问测试是否正常
http://IP:9100/
重启 可能会发生es 不能启动的问题,
查询问题 发现
这时候继续编辑elasticsearch.yml文件,将 #cluster.initial_master_nodes: ["node-1", "node-2"] 修改为 cluster.initial_master_nodes: ["node-1"],记得保存
note :在命令行连接es 要添加请求头才可以正常查询
curl -H "Content-Type: application/json" http://localhost:9200/tmdb/_search?pretty -d ' {"query": {"match_all": {}}}'