Docker install single node Elasticsearch

Step 1, Increase the lmit of virtual memory of your linux server

Even we are using docker, but docker images are still referring the global setting from their parent machine.

sudo sysctl -w vm.max_map_count=262144
sudo echo 'vm.max_map_count=262144' >> /etc/sysctl.conf



Step 2, pull the ES image from dockhub

docker pull elasticsearch:7.6.2



Step 3,run the ES image

please note that we expose 2 ports , 9200 and 9300.
after ES 7, we could use 9200 as the REST api and internal api.
but we could still open port 9300… no bad.

if your server has more then 1G memory , the xms xms parameter is not needed

docker run --name es_server -d -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -e "discovery.type=single-node" elasticsearch:7.6.2

Step 4,check the container logs

docker logs es_server | grep -i start
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
{"type": "server", "timestamp": "2022-08-30T17:33:40,497Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "5971f0e6fc81", "message": "starting ..." }
{"type": "server", "timestamp": "2022-08-30T17:33:41,996Z", "level": "INFO", "component": "o.e.n.Node", "cluster.name": "docker-cluster", "node.name": "5971f0e6fc81", "message": "started", "cluster.uuid": "lC-D1qCATgKPyQJ93lZFmA", "node.id": "elHGQazMQyWeIPy8KutxyQ"  }

if you see the logs of started, then fine.

Step 5,test it from browser or curl command

curl http://localhost:9200
{
  "name" : "5971f0e6fc81",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "lC-D1qCATgKPyQJ93lZFmA",
  "version" : {
    "number" : "7.6.2",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
    "build_date" : "2020-03-26T06:34:37.794943Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

nvd11

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值