1.简介
ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。Elasticsearch是用Java开发的,
并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
2.安装
下载:https://www.elastic.co/downloads/elasticsearch
解压及配置:
安装前java必须安装好,环境配置好。
[elk@master ~]$ tar -zvf elasticsearch-5.6.3 [elk@master ~]$ cat elasticsearch-5.6.3/config/elasticsearch.yml |grep -v "^#" |grep -v "^$" bootstrap.memory_lock: false bootstrap.system_call_filter: false network.host: 192.168.1.132 http.cors.enabled: true http.cors.allow-origin: /.*/
安装报错:
[2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter: java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in at org.elasticsearch.bootstrap.Seccomp.linuxImpl(Seccomp.java:349) ~[elasticsearch-5.0.0.jar:5.0.0] at org.elasticsearch.bootstrap.Seccomp.init(Seccomp.java:630) ~[elasticsearch-5.0.0.jar:5.0.0]
解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
此外要配置linux系统相关参数,
参考:http://blog.csdn.net/feifantiyan/article/details/54614614(参数值配置)
https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html(相关系统参数配置)
官方安装指导:https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
3.启动
[elk@master elasticsearch-5.6.3]$ ./bin/elasticsearch [2017-11-05T17:33:04,130][INFO ][o.e.n.Node ] [] initializing ... [2017-11-05T17:33:04,297][INFO ][o.e.e.NodeEnvironment ] [ljr2cAN] using [1] data paths, mounts [[/ (/dev/sda3)]], net usable_space [15.1gb], net total_space [28.3gb], spins? [possibly], types [ext4] [2017-11-05T17:33:04,298][INFO ][o.e.e.NodeEnvironment ] [ljr2cAN] heap size [1.9gb], compressed ordinary object pointers [true] [2017-11-05T17:33:04,301][INFO ][o.e.n.Node ] node name [ljr2cAN] derived from node ID [ljr2cANDQnyHLKL4R3dbRw]; set [node.name] to override [2017-11-05T17:33:04,301][INFO ][o.e.n.Node ] version[5.6.3], pid[4981], build[1a2f265/2017-10-06T20:33:39.012Z], OS[Linux/2.6.32-504.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_131/25.131-b11] [2017-11-05T17:33:04,301][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/home/elk/elasticsearch-5.6.3] [2017-11-05T17:33:05,752][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [aggs-matrix-stats] [2017-11-05T17:33:05,752][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [ingest-common] [2017-11-05T17:33:05,752][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [lang-expression] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [lang-groovy] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [lang-mustache] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [lang-painless] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [parent-join] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [percolator] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [reindex] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [transport-netty3] [2017-11-05T17:33:05,753][INFO ][o.e.p.PluginsService ] [ljr2cAN] loaded module [transport-netty4] [2017-11-05T17:33:05,758][INFO ][o.e.p.PluginsService ] [ljr2cAN] no plugins loaded [2017-11-05T17:33:08,372][INFO ][o.e.d.DiscoveryModule ] [ljr2cAN] using discovery type [zen] [2017-11-05T17:33:09,314][INFO ][o.e.n.Node ] initialized [2017-11-05T17:33:09,320][INFO ][o.e.n.Node ] [ljr2cAN] starting ... [2017-11-05T17:33:09,596][INFO ][o.e.t.TransportService ] [ljr2cAN] publish_address {192.168.1.132:9300}, bound_addresses {192.168.1.132:9300} [2017-11-05T17:33:09,616][INFO ][o.e.b.BootstrapChecks ] [ljr2cAN] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks [2017-11-05T17:33:12,733][INFO ][o.e.c.s.ClusterService ] [ljr2cAN] new_master {ljr2cAN}{ljr2cANDQnyHLKL4R3dbRw}{w0ySJ0X2T1K40OdDfUtgeQ}{192.168.1.132}{192.168.1.132:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2017-11-05T17:33:12,778][INFO ][o.e.h.n.Netty4HttpServerTransport] [ljr2cAN] publish_address {192.168.1.132:9200}, bound_addresses {192.168.1.132:9200} [2017-11-05T17:33:12,778][INFO ][o.e.n.Node ] [ljr2cAN] started [2017-11-05T17:33:12,789][INFO ][o.e.g.GatewayService ] [ljr2cAN] recovered [0] indices into cluster_state [2017-11-05T17:34:48,303][INFO ][o.e.c.m.MetaDataCreateIndexService] [ljr2cAN] [.kibana] creating index, cause [api], templates [], shards [1]/[1], mappings [_default_, index-pattern, server, visualization, search, timelion-sheet, config, dashboard, url]
后台启动加上 -d 参数即可:
[elk@master elasticsearch-5.6.3]$ ./bin/elasticsearch -d [elk@master elasticsearch-5.6.3]$ jps 5221 Elasticsearch 5237 Jps [elk@master elasticsearch-5.6.3]$
4.验证
登录 http://192.168.1.132:9200/ 如果访问不了,后台没有报错,请设置跨域访问,看上面配置: