docker运行elasticsearch

如何快速运行一个elasticsearch, 当然是用Docker来跑了. 不需要复杂的编译安装,只需要在linux下面,执行一个命令,就可以让elasticsearch跑起来.

docker运行elasticsearch

文章插图
 
准备Linux x64 系统, 如 centos 7和 ubuntu 18.04
15GB 或更多磁盘空间
1GB或更多内存
网络连接
根据docker 官方教程安装好docker,并已经启动docker
开始开启一个命令行shell,执行命令启动 elasticsearch
docker run -d --restart=always --name es -p 9200:9200-p 9300:9300 elasticsearch:6.7.0等待片刻,然后检查 日志是否正常
docker logs -f es 如果没有错误,那么你可以开始用curl测试
$ curl -v http://127.0.0.1:9200/* Trying 127.0.0.1:9200...* TCP_NODELAY set* Connected to 127.0.0.1 (127.0.0.1) port 9200 (#0)> GET / HTTP/1.1> Host: 127.0.0.1:9200> User-Agent: curl/7.66.0> Accept: */*> * Mark bundle as not supporting multiuse< HTTP/1.1 200 OK< content-type: Application/json; charset=UTF-8< content-length: 496< { "name" : "BKoY3qr", "cluster_name" : "elasticsearch", "cluster_uuid" : "eGIfGYBFQB2495AGXxFyHg", "version" : { "number" : "6.7.0", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "8453f77", "build_date" : "2019-03-21T15:32:29.844721Z", "build_snapshot" : false, "lucene_version" : "7.7.0", "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" : "You Know, for Search"}* Connection #0 to host 127.0.0.1 left intact到这里,你的elasticsearch就跑起来了,可以开始写程序查询elasticsearch了

【docker运行elasticsearch】


    推荐阅读