問題提前報
max virtual memory areas error
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
如果您的環境是Linux,注意要做以下操作,否則es可能會啟動失敗
1 用編輯工具打開文件/etc/sysctl.conf
2 在尾部添加一行配置vm.max_map_count = 262144,如果已存在就修改,數值不能低于262144
3 修改保存,然后執行命令sudo sysctl -p使其立即生效
heap size error
initial heap size [1073741824] not equal to maximum heap size [4294967296]; this can cause resize pauses and prevents mlockall from locking the entire heap
原因是 ES_JAVA_OPTS 設置錯誤,前后必須相同,如
-Xms3g -Xmx3g
手動安裝es
下載
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.15-linux-x86_64.tar.gz
解壓
tar -zxvf elasticsearch-7.17.15-linux-x86_64.tar.gz
mv elasticsearch-7.17.15 /usr/local/elasticsearch
添加用戶
useradd es
passwd es
chown -R es:es /usr/local/elasticsearch
配置文件修改
vim elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: "[::1]"
cluster.initial_master_nodes: ["node-1"]
啟動
/usr/local/elasticsearch/bin/elasticsearch -d
訪問驗證
http://127.0.0.1:9200/