1.安装方式
(1)支持.tar.gz, rpm, .zip, deb(Debian, Ubuntu), docker等方式安装。
(2)也支持大批量部署工具: Puppet, Chef等。
2. Linux上安装
(1)elasticsearch-7.0.0-linux-x86_64.tar.gz 330M左右
This package is free to use under the Elastic license.
It contains open source and free commercial features and access to paid commercial features.
其中的付费功能试用期30天。
(2)elasticsearch-oss-7.0.0-linux-x86_64.tar.gz 250M左右
includes only Apache 2.0 licensed code
(3)启用自动创建X-Pack indice
X-Pack会尝试在Elasticsearch中自动创建a number of indices
默认情况下,Elasticsearch允许自动创建 index,如果禁用了自动创建 index,则需要在elasticsearch.yml中配置action.auto_create_index,以允许X-Pack创建indice:
action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
(4)安装运行
[root@linux1 elasticsearch]# pwd
/tool/elk/elasticsearch
[root@linux1 elasticsearch]# tar -xvf elasticsearch-7.0.0-linux-x86_64.tar.gz
[root@linux1 elasticsearch]# cd elasticsearch-7.0.0
[elk@linux1 elasticsearch-7.0.0]$ ls -rlt
total 500
-rw-r--r--. 1 elk elk 8478 Apr 6 06:52 README.textile
-rw-r--r--. 1 elk elk 13675 Apr 6 06:52 LICENSE.txt
-rw-r--r--. 1 elk elk 447478 Apr 6 06:57 NOTICE.txt
drwxr-xr-x. 2 elk elk 4096 Apr 6 06:57 plugins
drwxr-xr-x. 3 elk elk 4096 Apr 6 06:57 lib
drwxr-xr-x. 8 elk elk 4096 Apr 6 06:57 jdk
drwxr-xr-x. 2 elk elk 4096 Apr 6 06:57 bin
drwxr-xr-x. 29 elk elk 4096 Apr 6 06:58 modules
drwxr-xr-x. 2 elk elk 4096 Apr 12 20:18 config
drwxrwxr-x. 3 elk elk 4096 Apr 12 20:18 data
drwxr-xr-x. 2 elk elk 4096 Apr 12 20:28 logs
[root@linux1 bin]# ./elasticsearch &
[1] 69891
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
【注释】不能使用root运行Elasticsearch。
[root@linux1 bin]# ps -ef | grep elastic
root 69891 69577 77 20:03 pts/1 00:00:42 /tool/elk/elasticsearch/elasticsearch-7.0.0/jdk/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -XX:-OmitStackTraceInFastThrow -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Djava.io.tmpdir=/tmp/elasticsearch-6971285640305725451 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=data -XX:ErrorFile=logs/hs_err_pid%p.log -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m -Djava.locale.providers=COMPAT -Dio.netty.allocator.type=unpooled -Des.path.home=/tool/elk/elasticsearch/elasticsearch-7.0.0 -Des.path.conf=/tool/elk/elasticsearch/elasticsearch-7.0.0/config -Des.distribution.flavor=default -Des.distribution.type=tar -Des.bundled_jdk=true -cp /tool/elk/elasticsearch/elasticsearch-7.0.0/lib/* org.elasticsearch.bootstrap.Elasticsearch
【注释】启动过程中,可能有如下问题:
[2019-04-12T20:18:48,510][WARN ][o.e.b.JNANatives ] [linux1] unable to install syscall filter:
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
【注释】这只是一个警告,不影响正常使用.
启动后,会有如下信息:
[2019-04-12T20:29:31,285][INFO ][o.e.h.AbstractHttpServerTransport] [linux1] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
3. 验证
[elk@linux1 ~]$ netstat -an | grep 9200
tcp 0 0 ::ffff:127.0.0.1:9200 :::* LISTEN
tcp 0 0 ::1:9200 :::* LISTEN
浏览器输入localhost:9200,或者:
[elk@linux1 ~]$ curl -X GET "localhost:9200/"
{
"name" : "linux1",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "2pQK_XgdRPGjtRL0253VWw",
"version" : {
"number" : "7.0.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "b7e28a7",
"build_date" : "2019-04-05T22:55:32.697037Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}