注:需要用非root账号启动
1.下载安装包:elasticsearch-5.5.1.zip
解压:
unzip elasticsearch-5.5.1.zip
注:启动elasticsearch时可用内存必须大于2G,否则无法启动。
2.修改内存大小
修改elasticsearch-5.5.1/config/jvm.options
-Xms1g
-Xmx1g
3.修改外网访问
conf/elasticsearch.yml
network.host: 0.0.0.0
3.启动
nohup ./bin/elasticsearch &
报错1.OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=‘Cannot allocate memory’ (errno=12)
修改elasticsearch-5.5.1/config/jvm.options
-Xms1g
-Xmx1g
将内存改为1g(由于我的阿里云机器只有2G内存,所以会启动报错)
报错2.
ERROR: [2] bootstrap checks failed
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
a.修改文件 /etc/security/limits.conf
work soft nofile 131072
work hard nofile 131072
work soft nproc 2048
work hard nproc 4096
注:work为启动用户
b.修改/etc/sysctl.conf
vm.max_map_count=655360
执行命令:sysctl -p