1 wsl占用内存过高
- 按下Windows + R 键,输入 %UserProfile% 并运行进入用户文件夹
- 新建文件 .wslconfig
- 设置资源限制
[wsl2]
memory=2GB
swap=0
localhostForwarding=true
2 启动es报错内存不足
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
进入docker-desktop
wsl -d docker-desktop
修改虚拟内存大小
sysctl -w vm.max_map_count=262144
3 配置报错
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
启动时添加参数
docker run -d -e ES_JAVA_POTS="-Xms256m -Xmx256m" -e "discovery.type=single-node" -p 9200:9200 -p 9300:9300 --name ES elasticsearch:7.16.2