zoukankan      html  css  js  c++  java
  • docker安装并运行elasticsearch

      拉取镜像:

    [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"
    }
  • 相关阅读:
    ORM和JDBC
    四种会话跟踪技术以及jstl介绍
    GC、进程和线程的定义
    数组和链表的理解,及各自的优缺点
    JSP和Servlet及浏览器与tomcat交互过程
    多线程、同步实现方法及Error和Exception的区别与联系
    Eclipse创建一个普通maven项目详细步骤
    Eclipse创建一个动态maven项目详细步骤
    Myeclipse项目出现红叉解决方案
    数据结构和算法 — 平衡二叉树的实现
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/11771798.html
Copyright © 2011-2022 走看看