到官網https://www.elastic.co/cn/downloads/elasticsearch下載壓縮包,目前最新的版本是7.3.2,我想下6.5.3,點擊下面的past release連接到歷史版本:java
找到Elasticsearch 6.5.3後,點擊右邊Download,在下載頁面點擊Linux連接開始下載。下完後經過rz上傳至wlf用戶的soft目錄,返回上一層目錄解壓:node
$ cd .. $ rz -y rz waiting to receive. 開始 zmodem 傳輸。 按 Ctrl+C 取消。 100% 110679 KB 5825 KB/s 00:00:19 0 Errorss $ cd .. $ tar xzvf soft/elasticsearch-6.5.3.tar.gz
進入解壓後目錄,啓動elasticsearch:sql
$ cd elasticsearch-6.5.3/ $ bin/elasticsearch
這時會出現啓動日誌:express
[2019-09-26T15:14:01,844][INFO ][o.e.e.NodeEnvironment ] [E1zoynp] using [1] data paths, mounts [[/home (/dev/sdc2)]], net usable_space [123gb], net total_space [147.5gb], types [ext3] [2019-09-26T15:14:01,848][INFO ][o.e.e.NodeEnvironment ] [E1zoynp] heap size [989.8mb], compressed ordinary object pointers [true] [2019-09-26T15:14:01,850][INFO ][o.e.n.Node ] [E1zoynp] node name derived from node ID [E1zoynp1TQaPj3a3MALUsA]; set [node.name] to override [2019-09-26T15:14:01,850][INFO ][o.e.n.Node ] [E1zoynp] version[6.5.3], pid[29289], build[default/tar/159a78a/2018-12-06T20:11:28.826501Z], OS[Linux/3.10.0-514.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_221/25.221-b11] [2019-09-26T15:14:01,851][INFO ][o.e.n.Node ] [E1zoynp] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -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.Qae6xuDZ, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/home/wlf/elasticsearch-6.5.3, -Des.path.conf=/home/wlf/elasticsearch-6.5.3/config, -Des.distribution.flavor=default, -Des.distribution.type=tar] [2019-09-26T15:14:04,454][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [aggs-matrix-stats] [2019-09-26T15:14:04,454][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [analysis-common] [2019-09-26T15:14:04,454][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [ingest-common] [2019-09-26T15:14:04,454][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [lang-expression] [2019-09-26T15:14:04,454][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [lang-mustache] [2019-09-26T15:14:04,455][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [lang-painless] [2019-09-26T15:14:04,455][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [mapper-extras] [2019-09-26T15:14:04,455][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [parent-join] [2019-09-26T15:14:04,455][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [percolator] [2019-09-26T15:14:04,455][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [rank-eval] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [reindex] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [repository-url] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [transport-netty4] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [tribe] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-ccr] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-core] [2019-09-26T15:14:04,456][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-deprecation] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-graph] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-logstash] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-ml] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-monitoring] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-rollup] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-security] [2019-09-26T15:14:04,457][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-sql] [2019-09-26T15:14:04,458][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-upgrade] [2019-09-26T15:14:04,458][INFO ][o.e.p.PluginsService ] [E1zoynp] loaded module [x-pack-watcher] [2019-09-26T15:14:04,458][INFO ][o.e.p.PluginsService ] [E1zoynp] no plugins loaded [2019-09-26T15:14:10,006][INFO ][o.e.x.s.a.s.FileRolesStore] [E1zoynp] parsed [0] roles from file [/home/wlf/elasticsearch-6.5.3/config/roles.yml] [2019-09-26T15:14:10,601][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [E1zoynp] [controller/29371] [Main.cc@109] controller (64 bit): Version 6.5.3 (Build f418a701d70c6e) Copyright (c) 2018 Elasticsearch BV [2019-09-26T15:14:11,166][DEBUG][o.e.a.ActionModule ] [E1zoynp] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security [2019-09-26T15:14:11,465][INFO ][o.e.d.DiscoveryModule ] [E1zoynp] using discovery type [zen] and host providers [settings] [2019-09-26T15:14:12,528][INFO ][o.e.n.Node ] [E1zoynp] initialized [2019-09-26T15:14:12,528][INFO ][o.e.n.Node ] [E1zoynp] starting ... [2019-09-26T15:14:12,727][INFO ][o.e.t.TransportService ] [E1zoynp] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300} [2019-09-26T15:14:12,748][WARN ][o.e.b.BootstrapChecks ] [E1zoynp] max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536] [2019-09-26T15:14:15,805][INFO ][o.e.c.s.MasterService ] [E1zoynp] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {E1zoynp}{E1zoynp1TQaPj3a3MALUsA}{qt-wUtPfR5qXa80mnt5mqQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=25112506368, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} [2019-09-26T15:14:15,812][INFO ][o.e.c.s.ClusterApplierService] [E1zoynp] new_master {E1zoynp}{E1zoynp1TQaPj3a3MALUsA}{qt-wUtPfR5qXa80mnt5mqQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=25112506368, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {E1zoynp}{E1zoynp1TQaPj3a3MALUsA}{qt-wUtPfR5qXa80mnt5mqQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=25112506368, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]]) [2019-09-26T15:14:15,836][INFO ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [E1zoynp] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200} [2019-09-26T15:14:15,837][INFO ][o.e.n.Node ] [E1zoynp] started [2019-09-26T15:14:15,911][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [E1zoynp] Failed to clear cache for realms [[]] [2019-09-26T15:14:15,974][INFO ][o.e.g.GatewayService ] [E1zoynp] recovered [0] indices into cluster_state [2019-09-26T15:14:16,150][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.triggered_watches] for index patterns [.triggered_watches*] [2019-09-26T15:14:16,321][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.watches] for index patterns [.watches*] [2019-09-26T15:14:16,416][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.watch-history-9] for index patterns [.watcher-history-9*] [2019-09-26T15:14:16,493][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-6-*] [2019-09-26T15:14:16,580][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.monitoring-es] for index patterns [.monitoring-es-6-*] [2019-09-26T15:14:16,673][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.monitoring-beats] for index patterns [.monitoring-beats-6-*] [2019-09-26T15:14:16,752][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.monitoring-alerts] for index patterns [.monitoring-alerts-6] [2019-09-26T15:14:16,858][INFO ][o.e.c.m.MetaDataIndexTemplateService] [E1zoynp] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-6-*] [2019-09-26T15:14:17,093][INFO ][o.e.l.LicenseService ] [E1zoynp] license [73b3cfc0-8f81-44ac-bff0-3bbbfff109f4] mode [basic] - valid
能夠看到,默認端口爲9300,咱們克隆會話,進入wlf用戶訪問下它:app
$ curl http://localhost:9200 { "name" : "E1zoynp", "cluster_name" : "elasticsearch", "cluster_uuid" : "ygHI0wjdSfy6dCDQitBcvQ", "version" : { "number" : "6.5.3", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "159a78a", "build_date" : "2018-12-06T20:11:28.826501Z", "build_snapshot" : false, "lucene_version" : "7.5.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search" }
給本機訪問是沒問題了,但每每咱們須要開放端口提供遠程訪問,這時咱們須要經過vi修改配置文件config/elasticsearch.yml,將ip指定爲部署機器的ip或者直接設置4個0:less
# Make sure that the heap size is set to about half the memory available # on the system and that the owner of the process is allowed to use this # limit. # # Elasticsearch performs poorly when the system is swapping the memory. # # ---------------------------------- Network ----------------------------------- # # Set the bind address to a specific IP (IPv4 or IPv6): # network.host: 0.0.0.0
以上修改保存還有兩個地方要改下,此時不得不使用root用戶了,由於要修改的東西在etc目錄下,咱們先備份sysctl.conf,再經過vi編輯:curl
# cd /etc
# cp sysctl.conf sysctl.conf.bak
# vi sysctl.conf
新增配置:elasticsearch
vm.max_map_count=655360
最後執行sysctl -p生效:ide
# sysctl -p
接着進入etc/security目錄修改limit.conf,一樣先備份再修改:ui
# cd /etc/security
# cp limit.conf limit.conf.bak
# vi limit.conf
新增配置:
* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096
保存後須要先退出當前用戶wlf,從新登錄才能生效。從新登錄後咱們使用後臺啓動elasticsearch:
$ elasticsearch-6.5.3 $ nohup bin/elasticsearch &
如今能夠指定ip訪問9200了: