elasticsearch-0.90.3/bin/plugin -install mobz/elasticsearch-head
上面的命令會把 elasticsearch-head插件裝到你的環境裏
訪問http://192.168.40.105:9200/_plugin/head/html
可使用 curl 命令發送請求來查看 ES 是否接收到了數據:
# curl ‘http://localhost:9200/_search?pretty‘java
下載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 ]node
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 neededgit
ES JVM配置文件爲/etc/sysconfig/elasticsearchexpress
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_SIZEbootstrap
https://jasonbian.gitbooks.io/elasticsearch/content/elasticsearch_jvmxiang_jie.html
elasticsearch文檔app
查詢索引
#curl http://192.168.40.105:9200/logstash-2017.04.20
#curl http://192.168.40.105:9200/_aliases # 查詢Elasticsearch全部索引列表curl