Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get the message Mariadb server 'db' is not accesible, ping works #238

Closed
aadje93 opened this issue Jul 30, 2023 · 4 comments
Closed

I get the message Mariadb server 'db' is not accesible, ping works #238

aadje93 opened this issue Jul 30, 2023 · 4 comments
Labels

Comments

@aadje93
Copy link

aadje93 commented Jul 30, 2023

Summary

Trying the manual backup to verify everything is working, i get the db is not accesible. I use ping to do a check if docker network is good and i can ping the "db" container fine (resolving in correct container name and ping <1ms)

the compose file is as follows for the db-backup part

services:
  #backup db

  backup-db:
    image: tiredofit/db-backup
    networks:
      - wordpress
    volumes:
      - ./backups:/backup
      #- ./post-script.sh:/assets/custom-scripts/post-script.sh
    environment:
      - TIMEZONE=Europe/Amsterdam
      - CONTAINER_ENABLE_MONITORING=FALSE
      - DEBUG_MODE=TRUE
      - DB_TYPE=mariadb
      - DB_HOST=db:3306
      - DB_NAME=${DB_NAME}
      - DB_USER=${DB_USER}
      - DB_PASS=${DB_PASS}
      - DB_DUMP_FREQ=1440           # backup every minute
      - DB_DUMP_BEGIN=0000      # backup starts immediately
      - DB_CLEANUP_TIME=10080         # clean backups they are older than 5 minute
      - CHECKSUM=SHA1
      - COMPRESSION=GZ
      - SPLIT_DB=FALSE

the same env variables are used in my web app which make it work fine. so credentials are good, or does it need the root acces?

Steps to reproduce

Start the container with code above, put a secondary web app next to it with same ENV credentials to acces the mariadb container and then the web app works fine, but the db-backup app gives error

[db-backup] MySQL/MariaDB Server 'db' is not accessible, retrying..

What is the expected correct behavior?

Well i expect to let the program do a backup given the same .env credentials to it as my web app :)

Relevant logs and/or screenshots

[tiredofit/db-backup:3.9.7 09:58:11 /] $ backup-now
** Performing Manual Backup
2023-07-30.09:58:36 [WARN] ** [db-backup] MySQL/MariaDB Server 'db' is not accessible, retrying.. (5 seconds so far)


[tiredofit/db-backup:3.9.7 10:05:59 /] $ ping db
PING db (192.168.128.6) 56(84) bytes of data.
64 bytes from [redacted].[redacted] (192.168.128.6): icmp_seq=1 ttl=64 time=0.132 ms
64 bytes from [redacted].[redacted] (192.168.128.6): icmp_seq=2 ttl=64 time=0.134 ms
^C
--- db ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms

  • Image version / tag: tiredofit/db-backup:3.9.7
  • Host OS: debian12

Possible fixes

i'm not sure where its going wrong. i'm sorry.

@aadje93 aadje93 added the bug label Jul 30, 2023
@ToshY
Copy link
Contributor

ToshY commented Jul 30, 2023

Hey @aadje93 👋

If you're certain that your db service is in the same network (wordpress) as your backup-db, then maybe the problem is that your DB_HOST is set to db:3306. The docs state that DB_HOST should just be the hostname, no port 1. So setting DB_HOST=db would be correct. You could optionally set the port with DB_PORT=3306,

Footnotes

  1. https://github.com/tiredofit/docker-db-backup#database-specific-options

@aadje93
Copy link
Author

aadje93 commented Jul 31, 2023

Hi @ToshY,

i tried from inside the shell of the db-backup container to ping to my db host with hostname db which works, so than the network stack is configured allright right?

Port is 3306 which is the default of mysql/mariadb so i removed that :3306 from the host but still it gives db is not accesible

if i use the DB_PORT=3306 still the same. Where do i go to try to debug this further? Are there commands that i can use instead of manual-backup to give a more verbose error message?

@ToshY
Copy link
Contributor

ToshY commented Jul 31, 2023

Hey @aadje93

You can try to use DEBUG_MODE=true and see if that shows more useful shell script messages. Somewhere before the db is not accessible message there hopefully should be something that indicates why it it's not accessible.


Edit

In the code before this error message occurs a mysqladmin -u"${DB_USER}" -P"${DB_PORT}" -h"${DB_HOST}" ${mysql_tls_args} status is performed. Maybe it's worth a shot to perform that check manually in the backup container to see if it works, and also double-check the values in ${DB_USER}, ${DB_PORT} and ${DB_HOST}.

@aadje93
Copy link
Author

aadje93 commented Jul 31, 2023

i realy dont know what happened, but now its working. I did remove the :3306 again but before that it also wasn't working while i could ping the db host.

Did a run in debug mode with the stack in normal (not -d deamon) mode and logged in on a second ssh session to go into the container which did a working backup. Then did a run with deamon mode on the 1 ssh session and backup from the second one and also working fine. Realy strange. DB_PORT=3306 seemd to have fixed it, but shouldn't it by default use this for mysql/mariadb setting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants