1.修改config/elsatcisearch.yml配置
cluster.name: my-application node.name: node-1 network.host: 0.0.0.0 http.port: 9200 cluster.initial_master_nodes: ["node-1"]
2.如果直接运行./bin/elsaticsearch,报错
[o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main] org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
3. 添加一个用来运行es的用户
useradd zen passwd zen
4.把/opt/elasticsearch-7.13.1目录以及子目录拥有者和组改为zen这个用户
chown -R zen:zen /opt/elasticsearch-7.13.1
5.切换到zen用户,运行elsaticsearch
su zen ./bin/elasticsearch