centos安装elasticsearch修改IP后无法启动解决方法

mac2025-04-29  11

之所以要记录下,因为过程中遇到很多问题,现在终于解决,结果如下图

es最新软件软件包可在官方网站下载:https://www.elastic.co/downloads/elasticsearch

下载完tar zxvf 解压缩

然后进bin目录./elasticsearch 执行,都没有问题。但是这是IP地址后竟然运行不起来,报错如下

the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

修改elasticsearch.yml的IP后,再修改文件几处 ,就可以了,如下:

cluster.initial_master_nodes: ["node-1"] 这里一定要这样设置,我就是这里没有这样设置出问题的,弄了好久

在最后加上这两句,要不然,外面浏览器就访问不了哈

http.cors.enabled: true http.cors.allow-origin: "*"

# ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: # #bootstrap.memory_lock: true # # Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # #network.host: 192.168.0.1 network.host: 192.168.136.110 #network.host: 0.0.0.0 #network.host: localhost #network.host: 127.0.0.1 # # Set a custom port for HTTP: # #http.port: 9200 #http.port: 9200 # # For more information, consult the network module documentation. # # --------------------------------- Discovery ---------------------------------- # # Pass an initial list of hosts to perform discovery when this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # #discovery.seed_hosts: ["host1", "host2"] #discovery.seed_hosts:["my-application"] # # Bootstrap the cluster using an initial set of master-eligible nodes: # #cluster.initial_master_nodes: ["node-1", "node-2"] cluster.initial_master_nodes: ["node-1"] # # For more information, consult the discovery and cluster formation module documentation. # # ---------------------------------- Gateway ----------------------------------- # # Block initial recovery after a full cluster restart until N nodes are started: # #gateway.recover_after_nodes: 3 # # For more information, consult the gateway module documentation. # # ---------------------------------- Various ----------------------------------- # # Require explicit names when deleting indices: # #action.destructive_requires_name: true http.cors.enabled: true http.cors.allow-origin: "*"

 

最新回复(0)