首先,我是单机部署,部署在云服务器上的
我跟着网上的步骤,都配置好之后,启动了elasticsearch,由于我是后台启动,也没看报错,网页访问这个端口,也能访问成功。
问题来了:我在springboot中配置的时候,启动一直报错
method [HEAD], host [http://39.105.190.120:9200] 这个错
然后我在postman上http://xxx:9200/_cat/health 这个请求时,也一直报503
然后打开服务器,查看日志和报错,发现报这个错:master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [node-1] to bootstrap a cluster: have discovered
和
[node-1] master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster
然后照着网上的来修改
这是修改后的:
http.cors.enabled: true
http.cors.allow-origin: "*
cluster.initial_master_nodes: [“node-1”]
http.port: 9200
transport.tcp.port: 9300
network.host: 0.0.0.0
network.publish_host: xxx
network.bind_host: 0.0.0.0
node.name: node-1
node.master: true
node.data: true
cluster.name: xxx_es
结果还是报错,最后,也是最坑的一点是 cluster.initial_master_nodes: [“node-1”] 这个
我改成这样后就成功启动了:
cluster.initial_master_nodes: node-1