在docker上安装运行elasticsearch

安装elasticsearch

使用加速镜像,不然会很缓慢,一旦断网就得重来。血泪的教训。

[root@CenOSDVD ~]# docker pull 37y8py0j.mirror.aliyuncs.com/library/elasticsearch
Using default tag: latest
Trying to pull repository 37y8py0j.mirror.aliyuncs.com/library/elasticsearch ... 
05d1a5232b46: Pull complete 
5cee356eda6b: Pull complete 
89d3385f0fd3: Pull complete 
65dd87f6620b: Pull complete 
78a183a01190: Pull complete 
1a4499c85f97: Pull complete 
2c9d39b4bfc1: Pull complete 
1b1cec2222c9: Pull complete 
59ff4ce9df68: Pull complete 
1976bc3ee432: Pull complete 
5af49e8af381: Pull complete 
42c8b75ff7af: Pull complete 
7e6902915254: Pull complete 
99853874fa54: Pull complete 
596fbad6fcff: Pull complete 
Digest: sha256:a8081d995ef3443dc6d077093172a5931e02cdb8ffddbf05c67e
01d348a9770e
Status: Downloaded newer image for 37y8py0j.mirror.aliyuncs.com/lib
rary/elasticsearch:latest
[root@CenOSDVD ~]# docker images
REPOSITORY                                           TAG                 IMAGE ID            CREATED             SIZE
37y8py0j.mirror.aliyuncs.com/library/elasticsearch   latest              5acf0e8da90b        11 months ago       486 MB

运行elasticsearch

[root@CenOSDVD ~]# docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 --name ES01 IMAGE ID
7a6d5f1a23af5069ed50e5cd76126b5d8824993fafdcf0162f33deee5310d32d

在浏览器输入http://192.168.80.129:9200/生成如下json数据,则安装运行成功

{
  "name" : "G9NyAfv",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "DR_K45Q2RKSZXlr_AnW0nw",
  "version" : {
    "number" : "5.6.12",
    "build_hash" : "cfe3d9f",
    "build_date" : "2018-09-10T20:12:43.732Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.1"
  },
  "tagline" : "You Know, for Search"
}

停止和启动

docker stop container-name/container-id
docker start container-name/container-id

你可能感兴趣的:(docker)