elasticsearch6.4安装问题

1.设置JVM问题

warning: ignoring JAVA_OPTS=-Xms128M -Xmx128M -Xmn20M -XX:MaxPermSize=96M; pass JVM parameters via ES_JAVA_OPTS

vi /etc/profile

JAVA_OPTS=""

source /etc/profile

2. jvm内存设置

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

  • 修改配置
  • -Xms1g
  • -Xmx1g
  • 改为:
  • -Xms512m
  • -Xmx512m

3.用户及权限

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:140) ~[elasticsearch-6.4.0.jar:6.4.0]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:127) ~[elasticsearch-6.4.0.jar:6.4.0]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.4.0.jar:6.4.0]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.4.0.jar:6.4.0]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.4.0.jar:6.4.0]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.4.0.jar:6.4.0]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:86) ~[elasticsearch-6.4.0.jar:6.4.0]

这是出于系统安全考虑设置的条件。由于ElasticSearch可以接收用户输入的脚本并且执行,为了系统安全考虑, 
建议创建一个单独的用户用来运行ElasticSearch

创建elsearch用户组及elsearch用户

  1. groupadd elasearch
  2. useradd elasearch-g elasearch-p elasticsearch

 

更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch

  1. chown -R elasearch:elasearch elasticsearch-6.4.0

elasticsearch为你elasticsearch的目录名称

切换到elsearch用户再启动

  1. su elasearch #切换账户
  2. cd elasticsearch-6.4.0/bin #进入你的elasticsearch目录下的bin目录
  3. ./elasticsearch或者 ./elasticsearch -d 以后台的方式运行
  4. ps -ef|grep elasticsearch 查看是否启动

4、网络问题

默认情况下,elasticsearch只允许本机访问,如果需要远程访问,修改安装目录config/elasticsearch.yml文件。去掉network.host的注释,将它的值改为0.0.0.0,然后重启Elasearch

5.异常:Caused by: java.lang.IllegalStateException: failed to obtain node locks

删除 安装目录下/data

rm -ef nodes

6.max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

切换到root用户修改配置sysctl.conf

vi /etc/sysctl.conf

vm.max_map_count=655360

sysctl -p

7.max file descriptors [65536] for elasticsearch process is too low, increase to at least [212144

su root

vi /etc/security/limits.conf

* hard nofile 212644

8.外网不能访问9200

修改 elasticsearch.yml,将network.host改成   0.0.0.0

同理,如果kibana的5601远程访问不了,修改kibana.yml 为server.host 改成  "0.0.0.0"

你可能感兴趣的:(elasticsearch)