如何跨主機(jī)訪問9300端口?
9300端口默認(rèn)只在localhost中能夠訪問,我在物理機(jī)上的java client無法訪問虛擬機(jī)中的9300端口,不知老師有沒有什么好的解決方案?
另外springboot的官方文檔中首推基于Restful的Jest,而不是自己的基于TransportClient的spring-data-elasticsearch
連elasticsearch官方也有廢棄TransportClient的打算
We plan on deprecating the
TransportClient
in Elasticsearch 7.0 and removing it completely in 8.0. Instead, you should be using theJava High Level REST Client, which executes HTTP requests rather than serialized Java requests.
是否9300端口最好是僅僅用作集群之間的通訊,而不再作為客戶端的通訊端口?
2018-10-16
修改配置文件elasticsearch.yml,在文件末尾添加
http.cors.enabled: true
http.cors.allow-origin: "*"