錯誤:文件權限不足 [1]: max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
再次啟動,又出錯了:
[1]: max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
我們用的是新創建的用戶,而不是root,所以文件權限不足。
首先用root用戶登錄。
然后修改配置文件:
vim /etc/security/limits.conf
添加下面的內容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096
錯誤:線程數不夠 [1]: max number of threads [1024] for user [leyou] is too low, increase to at least [4096]
剛才報錯中,還有一行:
[1]: max number of threads [1024] for user [leyou] is too low, increase to at least [4096]
這是線程數不夠。
繼續修改配置:
vim /etc/security/limits.d/20-nproc.conf
修改下面的內容:
* soft nproc 1024
改為:
* soft nproc 4096
錯誤:進程虛擬內存 [3]: max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
vm.max_map_count:限制一個進程可以擁有的VMA(虛擬內存區域)的數量,繼續修改配置文件, :
vim /etc/sysctl.conf
添加下面內容:
vm.max_map_count=655360
然后執行命令:
sysctl -p
錯誤 bootstrap checks faile [1]: 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
ERROR: [1] bootstrap checks failed [1]: 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 ERROR: Elasticsearch did not exit normally - check the logs at /home/leyou/elasticsearch/logs/elasticsearch.log [2020-04-05T17:27:09,233][INFO ][o.e.n.Node ] [localhost.localdomain] stopping ... [2020-04-05T17:27:09,313][INFO ][o.e.n.Node ] [localhost.localdomain] stopped [2020-04-05T17:27:09,313][INFO ][o.e.n.Node ] [localhost.localdomain] closing ... [2020-04-05T17:27:09,345][INFO ][o.e.n.Node ] [localhost.localdomain] close
修改conf-->elasticsearch.yml
elasticsearch.yml文件
node.name: node-1 前面的#打開
#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 這里把network.host 設置為自己的ip地址 也可以設置成0.0.0.0(代表所有ip可以訪問)
cluster.initial_master_nodes: ["node-1"] 這里一定要這樣設置,我就是這里沒有這樣設置出問題的,弄了好久
這里的 node-1 是上面node.name:后面的對應值
在最后加上這兩句,要不然,外面瀏覽器就訪問不了哈
http.cors.enabled: true
http.cors.allow-origin: "*"