若是沒有安裝docker請參考個人另外一篇使用docker安裝redis yum安裝一行命令便可搞定redis
使用 Docker 中國官方鏡像加速docker
[root@VM_0_4_centos ~]# docker pull registry.docker-cn.com/library/elasticsearch
查看鏡像:命令 docker imagescentos
docker images REPOSITORY TAG IMAGE ID CREATED SIZE registry.docker-cn.com/library/elasticsearch latest 73e6fdf8bd4f 5 days ago 486 MB registry.docker-cn.com/library/redis latest 4e8db158f18d 2 weeks ago 83.4 MB
瀏覽器
注意:5.0默認分配jvm空間大小爲2g 5.0以前好像是1g 服務器
若是你的服務器內存夠大請隨意,個人只有2g內存 第一次裝沒設置大小,結果嘛,大不了重裝系統而已jvm
-e ES_JAVA_OPTS="-Xms256m -Xmx256m" //設置初始內存 和最大內存elasticsearch
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 --name myes 73e6fdf8bd4f[注:這是要運行的鏡像id]
docker ps 查看 能夠看到myes以運行tcp
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fa6da79ebd61 73e6fdf8bd4f "/docker-entrypoin..." 3 minutes ago Up 3 minutes 0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp myes 7512230290be registry.docker-cn.com/library/redis "docker-entrypoint..." 26 hours ago Up 26 hours 0.0.0.0:6379->6379/tcp myredis
測試
瀏覽器輸入:http://140.1x3.x.xx:9200/ 你的服務器ip 端口號ui
瀏覽器返回以下信息,證實安裝成功
{ "name" : "kdJt_qz", "cluster_name" : "elasticsearch", "cluster_uuid" : "24MHPea3QCGX10L_yyxe4A", "version" : { "number" : "5.6.10", "build_hash" : "b727a60", "build_date" : "2018-06-06T15:48:34.860Z", "build_snapshot" : false, "lucene_version" : "6.6.1" }, "tagline" : "You Know, for Search" }