
下載:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.7.0-linux-x86_64.tar.gz #解壓 tar -xzvf elasticsearch-7.7.0-linux-x86_64.tar.gz #將解壓文件夾移動到 /user/local/下,自定義 mv elasticsearch-7.7.0
/user/local/elasticsearch
cd /user/local/elasticsearch
執行:
./bin/elasticsearch
這個時候可能會報錯,報錯信息如下
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future rel [2019-12-17T14:41:57,321][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [iZwz9h3c9q3pzycbcf5jc7Z] uncaught exception in thread org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:125) ~[elasticsearch-cli-7.5.0.jar:7.5.0] at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.5.0.jar:7.5.0] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.5.0.jar:7.5.0] Caused by: java.lang.RuntimeException: can not run elasticsearch as root at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:105) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:172) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.5.0.jar:7.5.0] at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.5.0.jar:7.5.0] ... 6 more
修改config下的jvm.options文件
cd config/ vim jvm.options
在文件底部加上
-XX:+AssumeMP
docker參考鏈接:http://www.fecmall.com/topic/1171
運行:
adduser es #賦予文件夾權限 chown -R es /user/local/elasticsearch/ #切換用戶 su es #運行 elasticsearch /usr/local/elasticsearch/bin/elasticsearch -d #-d 在后台以守護進程模式運行
查看:
netstat -lntp

或者運行:
curl 'http://localhost:9200/?pretty'

