docker安装并运行elasticsearch

https://blog.csdn.net/weixin_43674794/article/details/90788196 docker安装

https://www.cnblogs.com/agilestyle/p/11754705.html

拉取镜像:

 

[mall@VM_0_7_centos ~]$ sudo docker pull elasticsearch:6.4.0
[sudo] password for mall: 
6.4.0: Pulling from library/elasticsearch
256b176beaff: Pull complete 
6cb472d8b34a: Downloading [=================================================> ]  204.5MB/205.4MB
6cb472d8b34a: Pull complete 
3a4f4d86c1c1: Pull complete 
d185a64a7692: Pull complete 
bc4d63245d6d: Pull complete 
c8e97292a30a: Pull complete 
c1c1a056e791: Pull complete 
69b6c77c3236: Pull complete 
Digest: sha256:96345f6d73c0d615ddf8b9683848d625f211efacfe3b5b8765debbd1eebc5663
Status: Downloaded newer image for elasticsearch:6.4.0
docker.io/library/elasticsearch:6.4.0

 

  修改vm.max_map_count参数:

[mall@VM_0_7_centos ~]$ sudo sysctl -w vm.max_map_count=262144
[sudo] password for mall: 
vm.max_map_count = 262144

  启动容器elasticsearch:

 

[mall@VM_0_7_centos ~]$ sudo docker run -p 9200:9200 -p 9300:9300 --name elasticsearch \
>   -e "discovery.type=single-node" \
>   -e "cluster.name=elasticsearch" \
>   -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
>   -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
>   -d elasticsearch:6.4.0
606c0c45aa2693a23bf1a7de7be518b3022c5f107d2c7083f2590cba1589b9d9

 

  进入容器报错,提示启动失败:

[mall@VM_0_7_centos ~]$ sudo docker exec -it elasticsearch /bin/bash
Error response from daemon: Container 606c0c45aa2693a23bf1a7de7be518b3022c5f107d2c7083f2590cba1589b9d9 is not running

  修改数据文件权限,重启:

[mall@VM_0_7_centos ~]$ sudo chmod +777 /mydata/elasticsearch/data

[mall@VM_0_7_centos ~]$ sudo docker stop elasticsearch
elasticsearch
[mall@VM_0_7_centos ~]$ sudo docker start elasticsearch
elasticsearch

 

  测试一下:

[mall@VM_0_7_centos ~]$ curl -XGET 'localhost:9200'
{
  "name" : "4FZrgc-",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "6JP7jV8wQhqiVCg680hP-w",
  "version" : {
    "number" : "6.4.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "595516e",
    "build_date" : "2018-08-17T23:18:47.308994Z",
    "build_snapshot" : false,
    "lucene_version" : "7.4.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

转自:https://www.cnblogs.com/wuxun1997/p/11771798.html

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值