Elasticsearch 安装
Posted jinbuqi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch 安装相关的知识,希望对你有一定的参考价值。
- Elasticsearch 搜索API
- Elasticsearch Query DSL(查询语言)
- Elasticsearch 搜索
- Elasticsearch 过滤
- Elasticsearch 聚合
Posted jinbuqi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch 安装相关的知识,希望对你有一定的参考价值。
可以从www.elastic.co下载Elasticsearch,包括以前的老版本。每个版本都支持Windows、Linux和MacOS。
为了简单起见,我们使用tar包安装。
先下载Elasticsearch 7.1.0 Linux tar,如下所示:
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.0-linux-x86_64.tar.gz
然后提取:
tar -xvf elasticsearch-7.1.0-linux-x86_64.tar.gz
提取完成后,将在当前目录中生成解压后的文件夹,进入bin目录:
cd elasticsearch-7.1.0/bin
启动节点(默认集群elasticsearch):
./elasticsearch
对于Windows用户,我们建议使用MSI安装程序包。该包包含一个图形用户界面(GUI),指导您完成安装过程。
可以从https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.0.msi下载Elasticsearch 7.1.0 MSI。
双击下载的文件来完成安装。安装过程中,通常选择默认选项即可。
默认情况下,Elasticsearch将安装在%PROGRAMFILES%\Elastic\Elasticsearch。切换到这个目录下的bin目录:
cd %PROGRAMFILES%\Elastic\Elasticsearch\bin
启动节点(默认集群elasticsearch):
.\elasticsearch.exe
如果一切顺利,应该会看到如下所示的消息:
[2018-09-13T12:20:01,766][INFO ][o.e.e.NodeEnvironment ] [localhost.localdomain] using [1] data paths, mounts [[/home (/dev/mapper/fedora-home)]], net usable_space [335.3gb], net total_space [410.3gb], types [ext4]
[2018-09-13T12:20:01,772][INFO ][o.e.e.NodeEnvironment ] [localhost.localdomain] heap size [990.7mb], compressed ordinary object pointers [true]
[2018-09-13T12:20:01,774][INFO ][o.e.n.Node ] [localhost.localdomain] node name [localhost.localdomain], node ID [B0aEHNagTiWx7SYj-l4NTw]
[2018-09-13T12:20:01,775][INFO ][o.e.n.Node ] [localhost.localdomain] version[7.1.0], pid[13030], build[oss/zip/77fc20e/2018-09-13T15:37:57.478402Z], OS[Linux/4.16.11-100.fc26.x86_64/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10/10+46]
[2018-09-13T12:20:01,775][INFO ][o.e.n.Node ] [localhost.localdomain] 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.LN1ctLCi, -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, -XX:UseAVX=2, -Dio.netty.allocator.type=unpooled, -Des.path.home=/home/manybubbles/Workspaces/Elastic/master/elasticsearch/qa/unconfigured-node-name/build/cluster/integTestCluster node0/elasticsearch-7.0.0-alpha1-SNAPSHOT, -Des.path.conf=/home/manybubbles/Workspaces/Elastic/master/elasticsearch/qa/unconfigured-node-name/build/cluster/integTestCluster node0/elasticsearch-7.0.0-alpha1-SNAPSHOT/config, -Des.distribution.flavor=oss, -Des.distribution.type=zip]
[2018-09-13T12:20:02,543][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [aggs-matrix-stats]
[2018-09-13T12:20:02,543][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [analysis-common]
[2018-09-13T12:20:02,543][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [ingest-common]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [lang-expression]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [lang-mustache]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [lang-painless]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [mapper-extras]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [parent-join]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [percolator]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [rank-eval]
[2018-09-13T12:20:02,544][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [reindex]
[2018-09-13T12:20:02,545][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [repository-url]
[2018-09-13T12:20:02,545][INFO ][o.e.p.PluginsService ] [localhost.localdomain] loaded module [transport-netty4]
[2018-09-13T12:20:02,545][INFO ][o.e.p.PluginsService ] [localhost.localdomain] no plugins loaded
[2018-09-13T12:20:04,657][INFO ][o.e.d.DiscoveryModule ] [localhost.localdomain] using discovery type [zen]
[2018-09-13T12:20:05,006][INFO ][o.e.n.Node ] [localhost.localdomain] initialized
[2018-09-13T12:20:05,007][INFO ][o.e.n.Node ] [localhost.localdomain] starting ...
[2018-09-13T12:20:05,202][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address 127.0.0.1:9300, bound_addresses [::1]:9300, 127.0.0.1:9300
[2018-09-13T12:20:05,221][WARN ][o.e.b.BootstrapChecks ] [localhost.localdomain] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2018-09-13T12:20:05,221][WARN ][o.e.b.BootstrapChecks ] [localhost.localdomain] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2018-09-13T12:20:08,384][INFO ][o.e.h.n.Netty4HttpServerTransport] [localhost.localdomain] publish_address 127.0.0.1:9200, bound_addresses [::1]:9200, 127.0.0.1:9200
[2018-09-13T12:20:08,384][INFO ][o.e.n.Node ] [localhost.localdomain] started
可以看到名为“6-bjhwl”的节点(你的示例中名称不同)已经启动。现在还不用担心master是什么意思。这里最重要的是,我们已经在一个集群中启动了一个节点。
启动时,可以指定集群名称、节点名称:
./elasticsearch -Ecluster.name=my_cluster_name -Enode.name=my_node_name
还要注意标记为http的行,其中包含了http地址(192.168.8.112)和端口(9200)的信息。默认情况下,Elasticsearch使用端口9200提供REST API,这个端口是可配置的。
创建自定义网络,同一个网络中的服务(例如Kibana)可以互相连接:
docker network create my_network
docker run -d --name elasticsearch --net my_network -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.1.0
以上是关于Elasticsearch 安装的主要内容,如果未能解决你的问题,请参考以下文章