• ELK之使用docker-compose搭建elasticsearch和kibana


      环境查看

      docker版本

    # docker info
    Client:
     Debug Mode: false
    
    Server:
     Containers: 26
      Running: 15
      Paused: 0
      Stopped: 11
     Images: 312
     Server Version: 19.03.8
     Storage Driver: overlay2
      Backing Filesystem: <unknown>
      Supports d_type: true
      Native Overlay Diff: true
     Logging Driver: json-file
     Cgroup Driver: cgroupfs
     Plugins:
      Volume: local
      Network: bridge host ipvlan macvlan null overlay
      Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
     Swarm: inactive
     Runtimes: runc
     Default Runtime: runc
     Init Binary: docker-init
     containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
     runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
     init version: fec3683
     Security Options:
      seccomp
       Profile: default
     Kernel Version: 3.10.0-862.el7.x86_64
     Operating System: CentOS Linux 7 (Core)
     OSType: linux
     Architecture: x86_64
     CPUs: 6
     Total Memory: 15.51GiB
     Name: local-k8s-master
     ID: NLMQ:VZCR:OVLO:NJMC:DZCP:LD64:3FV4:5GWY:PGRU:K5GW:K6MA:AP3G
     Docker Root Dir: /var/lib/docker
     Debug Mode: false
     Registry: https://index.docker.io/v1/
     Labels:
     Experimental: false
     Insecure Registries:
      192.168.1.11
      192.168.1.61
      127.0.0.0/8
     Registry Mirrors:
      https://7sl94zzz.mirror.aliyuncs.com/
     Live Restore Enabled: false
    

       docker-compose版本

    # docker-compose version
    docker-compose version 1.18.0, build 8dd22a9
    docker-py version: 2.6.1
    CPython version: 3.6.8
    OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017
    

       系统信息

    # cat /etc/red
    redhat-release       redis.conf           redis-sentinel.conf  
    [root@local-k8s-master elasticsearch]# cat /etc/redhat-release 
    CentOS Linux release 7.8.2003 (Core)
    

       创建docker-compose文件夹

    mkdir /elasticsearch/
    

       创建elasticsearch数据文件夹

    mkdir  /usr/share/elasticsearch/data/
    

       设置sysctl参数

    echo "vm.max_map_count=655360">>/etc/sysctl.conf
    sysctl -p
    

       PS:不设置启动elasticsearch报错

      创建docker-compos配置文件

    # cat /elasticsearch/docker-compose.yml 
    version: '2.2'
    services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.6.2
        container_name: elasticsearch
        environment:
          - cluster.name=docker-cluster
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - esdata1:/usr/share/elasticsearch/data
        ports:
          - 9200:9200
        networks:
          - esnet
      elasticsearch2:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.6.2
        container_name: elasticsearch2
        environment:
          - cluster.name=docker-cluster
          - bootstrap.memory_lock=true
          - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
          #设置集群master节点是elasticsearch
          - "discovery.zen.ping.unicast.hosts=elasticsearch"
        ulimits:
          memlock:
            soft: -1
            hard: -1
        volumes:
          - esdata2:/usr/share/elasticsearch/data
        networks:
          - esnet
        
      kibana:
        image: docker.elastic.co/kibana/kibana:6.6.2
        container_name: kibana
        environment:
          - ELASTICSEARCH_HOSTS="http://elasticsearch:9200"
        ports:
          - 5601:5601
        networks:
          - esnet
     
    volumes:
      esdata1:
        driver: local
      esdata2:
        driver: local
    
    networks:
      esnet:
    

       启动

     cd /elasticsearch/
    #-d参数后台启动
     docker-compose up -d
    

       查看启动

    # docker-compose ps
         Name                   Command               State                Ports              
    ------------------------------------------------------------------------------------------
    elasticsearch    /usr/local/bin/docker-entr ...   Up      0.0.0.0:9200->9200/tcp, 9300/tcp
    elasticsearch2   /usr/local/bin/docker-entr ...   Up      9200/tcp, 9300/tcp              
    kibana           /usr/local/bin/kibana-docker     Up      0.0.0.0:5601->5601/tcp          
    

       对应主机启动了端口9200 5601

       PS:本次测试es两个节点挂载的数据目录是一样的

  • 相关阅读:
    JS中encodeURIComponent在PHP中实现的办法_tdweb的博客,仅仅是个博客_百度空间
    废弃的java 爬虫代码
    c#实现Javascript的encodeURIComponent()函数
    Encode query with Python
    Chunked decoding in python
    python implemention javascript encodeURIComponent
    Java MongoDB : Insert a document
    tar zcvf ./xxx.tar.gz ./directory
    MyStringUtils test
    application/xwwwformurlencoded
  • 原文地址:https://www.cnblogs.com/minseo/p/13265395.html
Copyright © 2020-2023  润新知