安裝ElasticSearch-6.2.3所遇到的安裝報錯

weixin_34239169發表於2018-04-15

(1)記憶體不足。

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 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 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:複製程式碼

解決辦法:減少啟動程式所需記憶體,或加大記憶體,如關閉一些程式。

方法一:擴大虛擬機器記憶體,直接更改虛擬機器記憶體就好了,此方法省略。

方法二:減小所需記憶體的辦法。

進入config,命令: cd config

修改jvm.properties檔案,命令: vi jvm.options

可以看到此版本它的預設記憶體是1G,我們把它設小一點。

儲存退出。

(2)不能使用管理員許可權啟動

[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.3.jar:6.2.3]
複製程式碼

解決辦法:

新增使用者,用新使用者許可權去開啟elasticsearch。

命令格式: useradd 使用者名稱 -g 所屬組名 -p 密碼

groupadd ymq
useradd  ymq -g ymq -p ymq
複製程式碼
授權訪問組許可權

命令格式: chown -R 所屬使用者 : 所屬使用者組名 更改許可權的檔案路徑

chown -R ymq:ymq 路徑
chmod -R 777 路徑複製程式碼

(3)127.0.0.1:9200能訪問,ip+埠無法訪問

修改es配置檔案elasticsearch.yml

加上:network.host: 0.0.0.0

(4)

ERROR: [3] bootstrap checks failed
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3889] for user [myes] is too low, increase to at least [4096]

複製程式碼

用root許可權修改limits.conf(/etc/seacurity)在第一行增加以下內容:

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096複製程式碼
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]複製程式碼

修改配置檔案/etc/sysctl.conf在第一行加上下面這句:

vm.max_map_count = 655360

執行命令: sysctl -p

(5)elasticsearch.log (Permission denied)

[es-grass@localhost bin]$ 2018-04-17 09:46:43,322 main ERROR RollingFileManager (/usr/local/elasticsearch-6.0.0/logs/elasticsearch.log) java.io.FileNotFoundException: /usr/local/elasticsearch-6.0.0/logs/elasticsearch.log (Permission denied) java.io.FileNotFoundException: /usr/local/elasticsearch-6.0.0/logs/elasticsearch.log (Permission denied)
	at java.io.FileOutputStream.open0(Native Method)
	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:640)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:608)
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:113)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:115)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:188)
	at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:144)
	at org.apache.logging.log4j.core.appender.RollingFileAppender$Builder.build(RollingFileAppender.java:60)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:958)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:898)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:890)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:513)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:237)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:261)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:164)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:120)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:290)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:130)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:121)
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:69)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134)
	at org.elasticsearch.cli.Command.main(Command.java:90)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85)
複製程式碼

將es安裝目錄及其子目錄賦予許可權:

sudo chown -R 使用者 elasticsearch-6.0.0

sudo chgrp -R 使用者組 elasticsearch-6.0.0


相關文章