# es yml 1 cluster.name: my-application http.port: 9201 node.name: node-1 network.host: localhost #跨域配置 http.cors.enabled: true http.cors.allow-origin: "*" #tcp 监听端口 transport.tcp.port: 9301 discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"] # es yml 2 cluster.name: my-application http.port: 9202 node.name: node-2 network.host: localhost #跨域配置 http.cors.enabled: true http.cors.allow-origin: "*" #tcp 监听端口 transport.tcp.port: 9302 # 发现其他节点 discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"] # es yml 3 cluster.name: my-application http.port: 9203 node.name: node-3 network.host: localhost #跨域配置 http.cors.enabled: true http.cors.allow-origin: "*" #tcp 监听端口 transport.tcp.port: 9303 # 发现其他节点 discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]
spring.data.jest.uris: http://127.0.0.1:9201,http://127.0.0.1:9202,http://127.0.0.1:9203
必须保证两个节点是正常的,否则使用es集群的配置,java会报错,查不到数据,这时如果配置改为单节点
spring.data.jest.uris: http://127.0.0.1:9201
则可以正常查询单节点数据,数据是不完整的。
如果只挂了一个节点,在执行查询时,1/2的概率会查询不到,数据是完整的。
待补充。。。