Hey all,
I’m new to graylog, but fairly knowledgable with docker compose. I’m attempting to follow the install instructions for docker compose with graylog. It sets up mongodb, opensearch, and graylog. Everything seems to start up fine, except that i can’t get graylog to connect to mongodb. I can connect via mongosh and MongoDB Compass just fine, no auth. What could be the issue here?
My error in dockge console:
graylog-graylog-1 | 22:31:13.694 [main] INFO org.graylog2.bootstrap.preflight.MongoDBPreflightCheck - MongoDB is not available. Retry #2
graylog-graylog-1 | 22:31:15.694 [main] INFO org.mongodb.driver.cluster - Waiting for server to become available for operation with ID 3. Remaining time: 30000 ms. Selector: ReadPreferenceServerSelector{readPreference=primary}, topology description: {type=UNKNOWN, servers=[{address=192.168.2.23:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.SocketTimeoutException: Connect timed out}}].
Here’s my compose file:
version: “3”
services:
MongoDB: https://hub.docker.com/_/mongo/
mongodb:
image: mongo:6.0.14
volumes:
- /mnt/files/graylog/mongodb/db:/data/db
- /mnt/files/graylog/mongodb/mongod/mongod.conf:/etc/mongod.conf:ro
entrypoint:
- mongod
- --replSet
- graylogrepl
- --bind_ip
- “*”
restart: on-failure
ports:
- 27017:27017
networks:
- graylog
opensearch:
image: opensearchproject/opensearch:2.12.0
environment:
- OPENSEARCH_JAVA_OPTS=-Xms1g -Xmx1g
- bootstrap.memory_lock=true
- discovery.type=single-node
- action.auto_create_index=false
- plugins.security.ssl.http.enabled=false
- plugins.security.disabled=true
- OPENSEARCH_INITIAL_ADMIN_PASSWORD=
ports:
- 9200:9200
ulimits:
memlock:
hard: -1
soft: -1
nofile:
soft: 65536
hard: 65536
restart: on-failure
networks:
- graylog
Graylog: https://hub.docker.com/r/graylog/ graylog/
graylog:
hostname: pyra
image: graylog/graylog:6.0
# To install Graylog Open: “graylog/graylog:6.0”
depends_on:
mongodb:
condition: service_started
opensearch:
condition: service_started
entrypoint: /usr/bin/tini – wait-for-it opensearch:9200 – /docker-entrypoint.sh
environment:
#- GRAYLOG_NODE_ID_FILE= /usr/share/graylog/data/config/node-id
- GRAYLOG_REPORT_DISABLE_SANDBOX=true
#- GRAYLOG_MONGODB_URI=mongodb://graylog:vWGzncmBe9"@mongodb:27017/graylog
#“8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918”
#- GRAYLOG_HTTP_EXTERNAL_URI= “http:// dockage:9000/”
ports:
# Graylog web interface and REST API
- 39000:9000/tcp
- 5044:5044/tcp
- 5140:5140/tcp
- 5140:5140/udp
- 12201:12201/tcp
- 12201:12201/udp
- 13301:13301/tcp
- 13302:13302/tcp
volumes:
- /mnt/files/graylog/data:/usr/share/graylog/data/
- /mnt/files/graylog/journal:/usr/share/graylog/data/journal
restart: on-failure
networks:
graylog:
driver: bridge