• elasticsearch系列(一): elasticsearch安装(docker方式)


    单节点安装

    创建es.yml,内容如下:

    version: '3'
    services:
      elasticsearch:
        image: elasticsearch:6.6.2
        container_name: elasticsearch
        environment:
          - cluster.name=elasticsearch-cluster
          - node.name=node0
          - node.master=true
          - node.data=true
          - http.cors.enabled=true
          - http.cors.allow-origin=*
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        ports:
        - 9200:9200
        - 9300:9300
    

    启动容器:
    docker-compose -f es.yml up -d

    • -f 指定文件
    • -d 后台运行

    查看日志:
    docker logs -f elasticsearch

    创建带ik插件镜像

    创建es-ik.yml,内容如下:

    FROM elasticsearch:6.6.2
    ENV VERSION=6.6.2
    
    # https://github.com/medcl/elasticsearch-analysis-ik/releases
    ADD https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v${VERSION}/elasticsearch-analysis-ik-$VERSION.zip /tmp/
    RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install -b file:///tmp/elasticsearch-analysis-ik-$VERSION.zip
    
    RUN rm -rf /tmp/*
    

    创建镜像:
    docker build -t es-ik:6.6.2 -f es-ik.yml .

    • -t 指定名字和标签
    • -f 指定文件
    • . 指定上下文环境,不要漏掉

    查看镜像:
    docker image ls

    集群安装

    创建esclu.yml,集成kibana管理.内容如下:

    version: '3'
    services:
      elasticsearch_n0:
        image: elasticsearch:6.6.2 # 或者使用es-ik:6.6.2镜像↑
        container_name: elasticsearch_n0
        privileged: true
        environment:
          - cluster.name=elasticsearch-cluster
          - node.name=node0
          - node.master=true
          - node.data=true
          - http.cors.enabled=true
          - http.cors.allow-origin=*
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
          - "discovery.zen.ping.unicast.hosts=elasticsearch_n0,elasticsearch_n1,elasticsearch_n2"
          - "discovery.zen.minimum_master_nodes=2"
        ports:
          - 9200:9200
          - 9300:9300
      elasticsearch_n1:
        image: elasticsearch:6.6.2
        container_name: elasticsearch_n1
        privileged: true
        environment:
          - cluster.name=elasticsearch-cluster
          - node.name=node1
          - node.master=true
          - node.data=true
          - http.cors.enabled=true
          - http.cors.allow-origin=*
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
          - "discovery.zen.ping.unicast.hosts=elasticsearch_n0,elasticsearch_n1,elasticsearch_n2"
          - "discovery.zen.minimum_master_nodes=2"
        ports:
          - 9201:9200
          - 9301:9300
      elasticsearch_n2:
        image: elasticsearch:6.6.2
        container_name: elasticsearch_n2
        privileged: true
        environment:
          - cluster.name=elasticsearch-cluster
          - node.name=node2
          - node.master=true
          - node.data=true
          - http.cors.enabled=true
          - http.cors.allow-origin=*
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
          - "discovery.zen.ping.unicast.hosts=elasticsearch_n0,elasticsearch_n1,elasticsearch_n2"
          - "discovery.zen.minimum_master_nodes=2"
        ports:
          - 9202:9200
          - 9302:9300
      kibana:
        image: kibana:6.6.2
        container_name: kibana
        environment:
          - SERVER_NAME=kibana
          - ELASTICSEARCH_URL=http://elasticsearch_n0:9200
          - XPACK_MONITORING_ENABLED=true
        ports:
          - 5601:5601
        depends_on:
          - elasticsearch_n0
    

    启动容器:
    docker-compose -f esclu.yml up -d

    查看启动

    使用elasticsearch-headkibana都可以

    elasticsearch-head

    elasticsearch-head最简单操作,安装chrom插件,免去其他多余操作.输入 http://192.168.183.220:9200/ 连接即可

    kibana

    访问 http://192.168.183.220:5601/ 找到DEV TOOLS

    参考:

  • 相关阅读:
    [原创]在Windows平台使用msvc(cl.exe) + vscode编写和调试C/C++代码
    几种动态调用js函数方案的性能比较
    z-index随笔
    [原]配置多个密钥免密码登录服务器简明教程
    [转]为 windows cmd 设置代理
    [原创]实现多层DIV叠加的js事件穿透
    [转]linux terminal中使用proxy
    [转]jquery中innerWidth(),outerWidth(),outerWidth(true)和width()的区别
    [转]React表单无法输入原因----约束性和非约束性组件
    [原创]aaencode等类似js加密方案破解方法
  • 原文地址:https://www.cnblogs.com/linyufeng/p/13044543.html
Copyright © 2020-2023  润新知