如果没有安装docker请参考我的另一篇使用docker安装redis yum安装一行命令即可搞定
使用 Docker 中国官方镜像加速
[root@VM_0_4_centos ~]# docker pull registry.docker-cn.com/library/elasticsearch
查看镜像:命令 docker images
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内存 第一次装没设置大小,结果嘛,大不了重装系统而已
-e ES_JAVA_OPTS="-Xms256m -Xmx256m" //设置初始内存 和最大内存
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 --name myes 73e6fdf8bd4f[注:这是要运行的镜像id]
docker ps 查看 可以看到myes以运行
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 端口号
浏览器返回如下信息,证明安装成功
{ "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" }