粗略记一下怎么去接触Elasticsearch。
官网下载并安装,顺便把学习文档也下载下来。
安装问题解答:http://blog.youkuaiyun.com/liangzhao_jay/article/details/56840941
注意打开9200、9300等端口防火墙
安装完后需要一个管理工具方便去查看Elasticsearch当前状态,这里推荐两个工具
1.elasticsearch-head,可以列表形式数据浏览
2.cerebro,命令输入刚智能方便
Logstash可用来做ES与数据库之间的数据同步,数据采集。
Kibana可基于ES数据做条形图、地理位置图、饼图等图形,
kibana的基本使用:http://blog.youkuaiyun.com/ming_311/article/details/50619859
使用ES的Java api:
添加依赖(注意版本尽量与安装的一致):
<!-- elasticSearch start -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.3.0</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.3.0</version>
</dependency>
<!-- elasticSearch end -->
在配置文件中添加es连接信息,其余略。。。具体连接和使用方法网上很多。
api 使用案例:http://blog.youkuaiyun.com/nnn9223643/article/details/43705763
按es默认配置会连不上,还需在配置文件elasticsearch.yml中添加以下内容:
跨域访问:
http.cors.enabled: true
http.cors.allow-origin: “*”
网络ip:
network.host: 179.26.10.25
network.publish_host: 179.26.10.25
network.bind_host: 179.26.10.25
transport.tcp.port: 9300
注意开发9300端口,Java中连接的也是9300端口