你能夠經過在 Elastic Cloud上使用咱們託管的Elasticsearch Service徹底跳過安裝,Elastic Cloud可在AWS和GCP上使用,你能夠免費 試用託管服務。
Elasticsearch至少須要Java 8,特別是在撰寫本文時,建議你使用Oracle JDK版本1.8.0_131,Java安裝因平臺而異,所以咱們不會在此處詳細介紹。能夠在Oracle的網站上找到Oracle推薦的安裝文檔,能夠說,在安裝Elasticsearch以前,請先運行檢查Java版本(而後根據須要進行相應的安裝/升級):html
java -version echo $JAVA_HOME
一旦咱們設置了Java,咱們就能夠下載並運行Elasticsearch,這些二進制文件能夠從www.elastic.co/downloads中得到,以及過去發佈的全部版本。對於每一個版本,你能夠選擇zip
或tar
存檔,DEB
或RPM
包或Windows MSI
安裝包。java
爲了簡單起見,咱們使用tar文件。node
咱們按以下方式下載Elasticsearch 6.4.2 tar:express
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz
而後提取以下:segmentfault
tar -xvf elasticsearch-6.4.2.tar.gz
而後它會在當前目錄中建立一堆文件和文件夾,而後咱們進入bin目錄,以下所示:windows
cd elasticsearch-6.4.2/bin
如今咱們準備啓動咱們的節點和單個集羣:oracle
./elasticsearch
對於Windows用戶,咱們建議使用MSI安裝程序包,該軟件包包含一個圖形用戶界面(GUI),可指導你完成安裝過程。app
首先,從https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.msi下載Elasticsearch 6.4.2 MSI。less
而後雙擊下載的文件以啓動GUI,在第一個屏幕中,選擇部署目錄:curl
而後選擇是做爲服務安裝仍是根據須要手動啓動Elasticsearch,要與tar示例保持一致,請選擇不將其做爲服務安裝:
對於配置,只需保留默認值:
再次,爲了與tar示例保持一致,請取消選中全部插件以不安裝任何插件:
單擊安裝按鈕後,將安裝Elasticsearch:
默認狀況下,Elasticsearch將安裝在%PROGRAMFILES%\Elastic\Elasticsearch
中,導航到這裏並進入bin目錄,以下所示:
使用命令提示符:
cd %PROGRAMFILES%\Elastic\Elasticsearch\bin
使用PowerShell:
cd $env:PROGRAMFILES\Elastic\Elasticsearch\bin
如今咱們準備啓動咱們的節點和單個集羣:
.\elasticsearch.exe
若是一切順利安裝,你應該看到一堆以下所示的消息:
[2016-09-16T14:17:51,251][INFO ][o.e.n.Node ] [] initializing ... [2016-09-16T14:17:51,329][INFO ][o.e.e.NodeEnvironment ] [6-bjhwl] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [317.7gb], net total_space [453.6gb], spins? [no], types [ext4] [2016-09-16T14:17:51,330][INFO ][o.e.e.NodeEnvironment ] [6-bjhwl] heap size [1.9gb], compressed ordinary object pointers [true] [2016-09-16T14:17:51,333][INFO ][o.e.n.Node ] [6-bjhwl] node name [6-bjhwl] derived from node ID; set [node.name] to override [2016-09-16T14:17:51,334][INFO ][o.e.n.Node ] [6-bjhwl] version[6.4.0], pid[21261], build[f5daa16/2016-09-16T09:12:24.346Z], OS[Linux/4.4.0-36-generic/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_60/25.60-b23] [2016-09-16T14:17:51,967][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [aggs-matrix-stats] [2016-09-16T14:17:51,967][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [ingest-common] [2016-09-16T14:17:51,967][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [lang-expression] [2016-09-16T14:17:51,967][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [lang-mustache] [2016-09-16T14:17:51,967][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [lang-painless] [2016-09-16T14:17:51,967][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [percolator] [2016-09-16T14:17:51,968][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [reindex] [2016-09-16T14:17:51,968][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [transport-netty3] [2016-09-16T14:17:51,968][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded module [transport-netty4] [2016-09-16T14:17:51,968][INFO ][o.e.p.PluginsService ] [6-bjhwl] loaded plugin [mapper-murmur3] [2016-09-16T14:17:53,521][INFO ][o.e.n.Node ] [6-bjhwl] initialized [2016-09-16T14:17:53,521][INFO ][o.e.n.Node ] [6-bjhwl] starting ... [2016-09-16T14:17:53,671][INFO ][o.e.t.TransportService ] [6-bjhwl] publish_address {192.168.8.112:9300}, bound_addresses {{192.168.8.112:9300} [2016-09-16T14:17:53,676][WARN ][o.e.b.BootstrapCheck ] [6-bjhwl] max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144] [2016-09-16T14:17:56,731][INFO ][o.e.h.HttpServer ] [6-bjhwl] publish_address {192.168.8.112:9200}, bound_addresses {[::1]:9200}, {192.168.8.112:9200} [2016-09-16T14:17:56,732][INFO ][o.e.g.GatewayService ] [6-bjhwl] recovered [0] indices into cluster_state [2016-09-16T14:17:56,748][INFO ][o.e.n.Node ] [6-bjhwl] started
在不詳細討論的狀況下,咱們能夠看到名爲「6-bjhwl」的節點(在你的狀況下將是一組不一樣的字符)已經啓動並在單個集羣中選擇本身做爲主節點。如今不要擔憂主意味着什麼,這裏最重要的是咱們在一個集羣中啓動了一個節點。
如前所述,咱們能夠覆蓋集羣或節點名稱,這能夠在啓動Elasticsearch時從命令行完成,以下所示:
./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name
另請注意標有http的行,其中包含有關咱們的節點能夠訪問的HTTP地址(192.168.8.112
)和端口(9200
)的信息,默認狀況下,Elasticsearch使用端口9200
來提供對其REST API的訪問,若有必要,能夠配置此端口。