Elasticsearch/Logstash/Kibana作为目前开源领域最为炙手可热的监控三剑客声名大噪。ELK三者各司其职,作为构建在Lucene基础上的搜索引擎,和另外一个著名的工具solr功能和应用场景有些重叠,只是看起来Elasticsearch风头更胜。而ELK从log抽取到图形展示全套功能齐全为同属elastic的Elasticsearch更是添了不少分,做到了1+1大于2。本文将介绍一下如何最简单的使用docker将ES跑起来。
docker pull
取得ES的官方镜像
[root@host34 ~]# docker pull elasticsearch
Using default tag: latest
latest: Pulling from library/elasticsearch
357ea8c3d80b: Already exists
52befadefd24: Already exists
42f3df327392: Pull complete
3decae4e9763: Pull complete
0a60a7e0c31d: Pull complete
b42727ba883d: Pull complete
98299a24213c: Pull complete
587e958702ba: Pull complete
f2d29026b186: Pull complete
09f7dfb6af7f: Pull complete
8fe5922f9eb7: Pull complete
df7240b72866: Pull complete
ebd5ba30c696: Pull complete
2995da3129b5: Pull complete
Digest: sha256:6eecc2f2878a05bfc7a8f01e2b8f2f2ce8e5c3adb0799c8ef15248dbf1bb7815
Status: Downloaded newer image for elasticsearch:latest
[root@host34 ~]#
docker run
运行ElasticSearch的镜像
[root@host34 ~]# docker run -d -p 9200:9200 elasticsearch
473594e2c61a8b625e337042b1724a416220c3461a712925895ebbe38190ff7c
[root@host34 ~]#
确认ElasticSearch运行状况
使用curl确认其API,能够返回正常结果。
[root@host34 ~]# docker run -d -p 9200:9200 elasticsearch
473594e2c61a8b625e337042b1724a416220c3461a712925895ebbe38190ff7c
[root@host34 ~]#
[root@host34 ~]#
[root@host34 ~]# curl -X GET http://192.168.32.34:9200
{
"name" : "Golden Girl",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "2.3.5",
"build_hash" : "90f439ff60a3c0f497f91663701e64ccd01edbb4",
"build_timestamp" : "2016-07-27T10:36:52Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
},
"tagline" : "You Know, for Search"
}
[root@host34 ~]#