docker 安装graylog

首先我的docker上已经有es和mongdb了,那么我的graylog希望用已有的es和mongo。

docker pull graylog/graylog:3.3
 
docker run \
--link mongodb:mongo \
--link es:elasticsearch \
--name graylog \
-p 9000:9000 \
-p 12201:12201 -p 12201:12201/udp \
-p 1514:1514 -p 1514:1514/udp -p 5044:5044 \
-e GRAYLOG_HTTP_EXTERNAL_URI=http://192.168.100.21:9000/ \
-e GRAYLOG_ROOT_TIMEZONE=Asia/Shanghai \
-e GRAYLOG_WEB_ENDPOINT_URI="http://192.168.100.21:9000/:9000/api" \
-e GRAYLOG_PASSWORD_SECRET=somepasswordpepper \
-e GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 \
-v /etc/localtime:/etc/localtime:ro \
-v graylog_journal:/usr/share/graylog/data/journal \
-d graylog/graylog:3.3
 
#######
docker run --name mongodb -d mongo:3 #启动mongodb
docker pull elasticsearch:7.5.1 #
docker run -d --name=es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.5.1 #启动es

访问http://192.168.100.21:9000/ 用户名/密码 admin/admin

备注: 如果mongodb启用了身份验证 目前还没有搞定

 

附上docker-compose.yml

version: '3'
services:
  # MongoDB: https://hub.docker.com/_/mongo/
  mongo:
    image: mongo:3
    networks:
      - graylog
  # Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/7.x/docker.html
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.5.1
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    deploy:
      resources:
        limits:
          memory: 1g
    networks:
      - graylog
  # Graylog: https://hub.docker.com/r/graylog/graylog/
  graylog:
    image: graylog/graylog:3.1
    environment:
      # CHANGE ME (must be at least 16 characters)!
      - GRAYLOG_PASSWORD_SECRET=somepasswordpepper
      # Password: admin
      - GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
      - GRAYLOG_HTTP_EXTERNAL_URI=http://192.168.2.79:9009/
    networks:
      - graylog
    depends_on:
      - mongo
      - elasticsearch
    ports:
      # Graylog web interface and REST API
      - 9000:9000
      # Syslog TCP
      - 1514:1514
      # Syslog UDP
      - 1514:1514/udp
      # GELF TCP
      - 12201:12201
      # GELF UDP
      - 12201:12201/udp
networks:
  graylog:
    driver: bridge
mkdir /usr/local/graylog      #创建graylog文件夹
touch docker-compose.yml      #创建docker-compose.yml
vim docker-compose.yml        #编辑docker-compose.yml

 

posted on 2021-02-06 10:35  dz45693  阅读(2587)  评论(0编辑  收藏  举报

导航