elasticsearch-0.90.3/bin/plugin -install mobz/elasticsearch-head
上面的命令会把 elasticsearch-head插件装到你的环境里 访问http://192.168.40.105:9200/_plugin/head/可以使用 curl 命令发送请求来查看 ES 是否接收到了数据:
# curl ‘下载rpm包启动 # service elasticsearch start Starting elasticsearch: Exception in thread "main" java.lang.IllegalStateException: Failed to created node environment Likely root cause: java.nio.file.AccessDeniedException: /opt/data/bigdata/nodes at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) at java.nio.file.Files.createDirectory(Files.java:674) at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) at java.nio.file.Files.createDirectories(Files.java:767) at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:169) at org.elasticsearch.node.Node.<init>(Node.java:165) at org.elasticsearch.node.Node.<init>(Node.java:140) at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143) at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:178) at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35) Refer to the log for complete error details. [FAILED] 解决方法: 数据路径给Elasticsearch用户权限 chown -R elasticsearch.elasticsearch /opt/data # service elasticsearch start Starting elasticsearch: [ OK ]
Elasticsearch启动时报错:
[2017-04-17 19:18:08,835][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed [2017-04-17 19:18:08,842][WARN ][bootstrap ] Unable to lock JVM Memory: error=12,reason=Cannot allocate memory [2017-04-17 19:18:08,842][WARN ][bootstrap ] This can result in part of the JVM being swapped out. [2017-04-17 19:18:08,842][WARN ][bootstrap ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536 [2017-04-17 19:18:08,842][WARN ][bootstrap ] These can be adjusted by modifying /etc/security/limits.conf, for example: # allow user 'elasticsearch' mlockall elasticsearch soft memlock unlimited elasticsearch hard memlock unlimited [2017-04-17 19:18:08,843][WARN ][bootstrap ] If you are logged in interactively, you will have to re-login for the new limits to take effect. [2017-04-17 19:18:09,112][INFO ][node ] [test5] version[2.3.4], pid[5058], build[e455fd0/2016-06-30T11:24:31Z] [2017-04-17 19:18:09,112][INFO ][node ] [test5] initializing ... [2017-04-17 19:18:10,541][INFO ][plugins ] [test5] modules [reindex, lang-expression, lang-groovy], plugins [bigdesk, head, kopf], sites [bigdesk, kopf, head] [2017-04-17 19:18:10,574][INFO ][env ] [test5] using [1] data paths, mounts [[/ (/dev/mapper/vg_lvm-lv1)]], net usable_space [14.9gb], net total_space [19.5gb], spins? [possibly], types [ext4] [2017-04-17 19:18:10,574][INFO ][env ] [test5] heap size [1.9gb], compressed ordinary object pointers [true] [2017-04-17 19:18:14,021][INFO ][node ] [test5] initialized [2017-04-17 19:18:14,028][INFO ][node ] [test5] starting ... [2017-04-17 19:18:14,284][INFO ][transport ] [test5] publish_address {192.168.40.105:9300}, bound_addresses {0.0.0.0:9300} [2017-04-17 19:18:14,309][INFO ][discovery ] [test5] bigdata/zJA8zeAdTQeyy7pSU8DJsA [2017-04-17 19:18:17,446][INFO ][cluster.service ] [test5] new_master {test5}{zJA8zeAdTQeyy7pSU8DJsA}{192.168.40.105}{192.168.40.105:9300}{data=false, master=true}, reason: zen-disco-join(elected_as_master, [0] joins received) [2017-04-17 19:18:17,479][INFO ][http ] [test5] publish_address {192.168.40.105:9200}, bound_addresses {0.0.0.0:9200} [2017-04-17 19:18:17,479][INFO ][node ] [test5] started [2017-04-17 19:18:17,601][INFO ][gateway ] [test5] recovered [3] indices into cluster_state 解决方法: [2017-04-17 19:23:06,291][WARN ][env ] [test5] max file descriptors [65535] for elasticsearch process likely too low, consider increasing to at least [65536] 错误解决: /etc/security/limits.conf 。。。。。 # End of file * soft nofile 65536 * hard nofile 65536 其他错误解决: 添加下面内容到/etc/security/limits.conf # allow user 'elasticsearch' mlockall elasticsearch soft memlock unlimited elasticsearch hard memlock unlimited 下面这个WARN可以忽略 [2017-04-17 19:25:51,208][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are neededES JVM配置文件为/etc/sysconfig/elasticsearch
JVM参数 Elasticsearch默认值 Environment变量
-Xms 256m ES_MIN_MEM -Xmx 1g ES_MAX_MEM -Xms and -Xmx ES_HEAP_SIZE -Xmn ES_HEAP_NEWSIZE -XX:MaxDirectMemorySize ES_DIRECT_SIZEelasticsearch文档
查询索引 #curl #curl # 查询Elasticsearch所有索引列表