elastic search first installation error record

Elasticsearch-5.5.2 installed version
Installation path / usr / local / es /

Start being given:
/usr/local/es/elasticsearch-5.5.2/bin/
bash ./bash ./elasticsearch

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/es/elasticsearch-5.5.2/bin/hs_err_pid2353.log

  

Solution:
switch to the configuration directory /usr/local/es/elasticsearch-5.5.2/config/
open jvm.options
the -Xms2g to 1g (1g not to try to change into 512M)

 

Try it again to start.

Error:

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.2.jar:5.5.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.2.jar:5.5.2]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.2.jar:5.5.2]

  

Meaning can not be started by the root user, then we create a new user to start

Continue to address this issue

## is not meant to start with the root user, then we create a new user to start 
[root @ VM_0_13_centos bin] # useradd elastic 

## new elastic user and directory permissions given to the elastic 
[root @ VM_0_13_centos bin] # chown -R elastic : elastic /usr/local/es/elasticsearch-5.5.2/ 

## we switched to the elastic user, and then perform 
[root @ VM_0_13_centos bin] # su elastic 
[@ VM_0_13_centos elastic bin] $ SH / usr / local / es / elasticsearch -5.5.2 / bin / elasticsearch

  

## -d running in the background 

[Elastic @ VM_0_13_centos bin] SH /usr/local/es/elasticsearch-5.5.2/bin/elasticsearch -d $ 

## check for a successful start 
[elastic @ VM_0_13_centos bin] $ ps -ef | grep elasticsearch

  

If this occurs indicates success

 

We validate the service is running under normal 
 curl http: // localhost: 9200

  

{
  "name" : "QHNWXbg",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "hVyq1z2LR9aEiyBhEsU-fw",
  "version" : {
    "number" : "5.5.2",
    "build_hash" : "b2f0c09",
    "build_date" : "2017-08-14T12:33:14.154Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.0"
  },
  "tagline" : "You Know, for Search"
}

  

Thanks:
java1234 small front

https://m.aliyun.com/yunqi/articles/523874

 

Guess you like

Origin www.cnblogs.com/Uzai/p/11297365.html