Elasticsearch安装
java -version
echo $JAVA_HOME
为了简单起见,下载Elasticsearch 5.4.1 tar,方式如下(window用户下载Elasticsearch 5.4.1 zip)
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz
然后解压缩如下
tar -xvf elasticsearch-5.4.1.tar.gz
然后进入bin目录
cd elasticsearch-5.4.1 / bin
./elasticsearch
如果一切顺利,您应该会看到一堆如下所示的消息:
[2017-06-09T12:11:37,851][INFO ][o.e.n.Node ] [] initializing ... [2017-06-09T12:11:38,117][INFO ][o.e.e.NodeEnvironment ] [9fzvF2H] using [1]data paths, mounts [[(D:)]], net usable_space [111.8gb], net total_space [123.5gb], spins? [unknown], types [NTFS] [2017-06-09T12:11:38,117][INFO ][o.e.e.NodeEnvironment ] [9fzvF2H] heap size[1.9gb], compressed ordinary object pointers [true] [2017-06-09T12:11:38,117][INFO ][o.e.n.Node ] node name [9fzvF2H]derived from node ID [9fzvF2HKTverLyZwFl6w0w]; set [node.name] to override [2017-06-09T12:11:38,117][INFO ][o.e.n.Node ] version[5.4.1], pid[3964], build[2cfe0df/2017-05-29T16:05:51.443Z], OS[Windows 7/6.1/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_131/25.131-b11] [2017-06-09T12:11:38,117][INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionCanonicalPath=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, -Delasticsearch, -Des.path.home=D:\ProgramFiles\elasticsearch-5.4.1] [2017-06-09T12:11:39,193][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [aggs-matrix-stats] [2017-06-09T12:11:39,193][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [ingest-common] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-expression] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-groovy] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-mustache] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [lang-painless] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [percolator] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [reindex] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [transport-netty3] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] loaded module [transport-netty4] [2017-06-09T12:11:39,209][INFO ][o.e.p.PluginsService ] [9fzvF2H] no plugins loaded [2017-06-09T12:11:41,471][INFO ][o.e.d.DiscoveryModule ] [9fzvF2H] using discovery type [zen] [2017-06-09T12:11:42,032][INFO ][o.e.n.Node ] initialized [2017-06-09T12:11:42,032][INFO ][o.e.n.Node ] [9fzvF2H] starting ... [2017-06-09T12:11:43,171][INFO ][o.e.t.TransportService ] [9fzvF2H] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300} [2017-06-09T12:11:46,248][INFO ][o.e.c.s.ClusterService ] [9fzvF2H] new_master{9fzvF2H}{9fzvF2HKTverLyZwFl6w0w}{yMmmD0nORKqEmQ0lrqKu3Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) [2017-06-09T12:11:46,280][INFO ][o.e.g.GatewayService ] [9fzvF2H] recovered[0] indices into cluster_state [2017-06-09T12:11:46,919][INFO ][o.e.h.n.Netty4HttpServerTransport] [9fzvF2H] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200} [2017-06-09T12:11:46,919][INFO ][o.e.n.Node ] [9fzvF2H] started
./elasticsearch -Ecluster.name = my_cluster_name -Enode.name = my_node_name
window下由于启动执行的是bat,不知道用这种方式该怎么修改集群或节点名称,望大神们赐教。
{ "name" : "9fzvF2H", "cluster_name" : "elasticsearch", "cluster_uuid" : "xBoSQEYqQSaJjzzpmAj7aw", "version" : { "number" : "5.4.1", "build_hash" : "2cfe0df", "build_date" : "2017-05-29T16:05:51.443Z", "build_snapshot" : false, "lucene_version" : "6.5.1" }, "tagline" : "You Know, for Search" }
探索集群
REST API
- 检查您的群集,节点和索引运行状况,状态和统计信息
- 管理您的集群,节点和索引数据和元数据
- 执行CRUD(创建,读取,更新和删除)并针对索引进行搜索操作
- 执行高级搜索操作,如分页,排序,过滤,脚本,聚合等等
Kibana
安装Kibana
支持的平台
Elasticsearch版本
安装包
Kibana提供以下格式的安装包:
- tar.gz/zip: tar.gz 用于在Linux和Darwin上安装, zip 唯一支持window的安装包,是入门Kibana最好的选择。Install Kibana with
.tar.gz
or Install Kibana on Windows
- deb: 适用于Debian, , 以及其他 Debian-based系统。Install Kibana with Debian Package
- rpm:适用于 , , SLES, OpenSuSE 以及RPM-based 系统,Install Kibana with RPM
- docker:一个镜像可以用来运行kibana作为docker容器,它附带 X-Pack 预安装,可从Elastic Docker注册。(不懂docker,不知道怎么表述好)Running Kibana on Docker
如果您的Elasticsearch安装受X-Pack安全保护, 请参阅使用Kibana与X-Pack Security进行其他安装说明。
在windows上安装Kibana
最新的稳定版本的Kibana可以在下载Kibana页面找到 。其他版本可以在过去版本页面找到 。
解压缩。这将创建一个名为kibana-5.4.1-windows-x86的文件夹,我们将其称为$KIBANA_HOME
。在终端窗口中,CD
到$KIBANA_HOME
目录下的bin,例如:
D:\>cd D:\ProgramFiles\kibana-5.4.1-windows-x86\bin
从命令行运行Kibana
kibana
出现以下日志
D:\ProgramFiles\kibana-5.4.1-windows-x86\bin>kibana log [07:29:47.631] [info][optimize] Optimizing and caching bundles for kibana, timelion and status_page. This may take a few minutes log [07:31:43.968] [info][optimize] Optimization of bundles for kibana, timelion and status_page complete in 116.34 seconds log [07:31:44.030] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready log [07:31:44.124] [info][status][plugin:[email protected]] Status changed from uninitialized to yellow - Waiting for Elasticsearch log [07:31:44.155] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready log [07:31:44.170] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready log [07:31:44.373] [info][status][plugin:[email protected]] Status changed from uninitialized to green - Ready log [07:31:44.389] [info][listening] Server running at http://localhost:5601 log [07:31:44.389] [info][status][ui settings] Status changed from uninitialized to yellow - Elasticsearch plugin is yellow log [07:31:49.435] [info][status][plugin:[email protected]] Status changed from yellow to yellow - No existing Kibana index found log [07:31:50.000] [info][status][plugin:[email protected]] Status changed from yellow to green - Kibana index ready log [07:31:50.000] [info][status][ui settings] Status changed from yellow to green - Ready
集群健康
回应
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1496995261 16:01:01 elasticsearch yellow 1 1 1 1 0 0 1 0 - 50.0%
也可以得到集群中节点列表,如下:
GET /_cat/nodes?v
响应如下
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
127.0.0.1 8 84 4 mdi * 9fzvF2H
可以看到集群中只有一个名叫"9fzvF2H"的节点。
官方文档
https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/_exploring_your_cluster.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/_cluster_health.html
https://www.elastic.co/guide/en/kibana/5.4/introduction.html
https://www.elastic.co/guide/en/kibana/5.4/setup.html
https://www.elastic.co/guide/en/kibana/5.4/install.html
https://www.elastic.co/guide/en/kibana/5.4/windows.html
参考文档
https://github.com/13428282016/elasticsearch-CN/wiki/es-gettting-started
Elasticsearch 教程系列文章: