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

Unraid docker not connecting to mariadb #349

Open
mlause opened this issue May 25, 2024 · 5 comments
Open

Unraid docker not connecting to mariadb #349

mlause opened this issue May 25, 2024 · 5 comments
Labels

Comments

@mlause
Copy link

mlause commented May 25, 2024

Summary

I get the following error in the logs when db-backup tries to connect to mariadb.
2024-05-25.14:22:50 [WARN] ** [02-x.x.x.x__ALL] MySQL/MariaDB Server 'x.x.x.x' is not accessible, retrying.. (130 seconds so far)

Steps to reproduce

I have the IP address correctly entered, and it shoes this error everytime a backup is attempted.

What is the expected correct behavior?

I'm a first time user. I would expect the application would do the backup and show it in the folder.

Relevant logs and/or screenshots

I copied it above.

Environment

Unraid 6.12.9
Latest version of db-backup

Possible fixes

I tried this solution, #79, but it did not work.

@mlause mlause added the bug label May 25, 2024
@ToshY
Copy link
Contributor

ToshY commented May 25, 2024

Could you provide logs with DEBUG_MODE=true?

Might be similar to #238 (comment).

@mlause
Copy link
Author

mlause commented May 26, 2024

I looked at issue #238, and there was no actual fix posted. I can ping both databases within a shell command. I ran debug mode, and this is what I get.

text error warn system array login

  • '[' '' = true ']'
  • '[' '' = yes ']'
  • print_debug 'Wait Time: 0 Future execution time: 1716697335 Current Time: 1716697335'
  • output_off
  • '[' true = true ']'
  • set +x
    ++ date -d @1716697335 '+%Y-%m-%d %T %Z'
  • print_info 'Next Backup at 2024-05-25 23:22:15 CDT'
  • output_off
  • '[' true = true ']'
  • set +x
  • silent sleep 0
  • '[' TRUE = true ']'
  • '[' '' = true ']'
  • '[' debug = debug ']'
  • sleep 0
  • true
  • '[' -n '' ']'
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • timer job start
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • case "${1}" in
  • case "${2}" in
    ++ date +%s
  • backup_job_start_time=1716697336
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • process_limiter
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • true
  • counter=0
    ++ wc -l /tmp/.container/db-backup-backups
    ++ awk '{print $1}'
  • process_amount=0
  • '[' 0 -ge 1 ']'
  • break
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • echo 02
    ++ date '+%Y-%m-%d %T %Z'
  • print_debug 'Backup 02 routines started time: 2024-05-25 23:22:16 CDT'
  • output_off
  • '[' true = true ']'
  • set +x
  • bootstrap_filesystem
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • '[' '!' -d /backup ']'
    ++ stat -c %U /backup
  • '[' dbbackup '!=' dbbackup ']'
    ++ stat -c %a /backup
  • '[' 755 '!=' 755 ']'
  • '[' -d /backup/archive/ ']'
  • '[' '!' -d /logs ']'
    ++ stat -c %U /logs
  • '[' dbbackup '!=' dbbackup ']'
    ++ date +%Y%m%d
  • '[' '!' -d /logs/20240525 ']'
    ++ stat -c %a /logs
  • '[' 755 '!=' 755 ']'
  • '[' '!' -d /tmp/backups ']'
    ++ stat -c %U /tmp/backups
  • '[' dbbackup '!=' dbbackup ']'
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • check_availability
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • var_false FALSE
  • '[' false = false ']'
  • case "${dbtype}" in
  • counter=0
  • export MYSQL_PWD=
  • MYSQL_PWD=
  • run_as_user mysqladmin -uroot -P3306 -hx.x.x.22 status
  • sleep 5
    2024-05-25.23:22:15 [DEBUG] /etc/services.available/dbbackup-02/run ** [02-x.x.x.22__ALL] Wait Time: 0 Future execution time: 1716697335 Current Time: 1716697335
    2024-05-25.23:22:15 [INFO] /etc/services.available/dbbackup-02/run ** [02-x.x.x.22__ALL] Next Backup at 2024-05-25 23:22:15 CDT
    2024-05-25.23:22:16 [DEBUG] /etc/services.available/dbbackup-02/run ** [02-x.x.x.22__ALL] Backup 02 routines started time: 2024-05-25 23:22:16 CDT
  • (( counter+=5 ))
  • write_log warn 'MySQL/MariaDB Server '''x.x.x.22''' is not accessible, retrying.. (5 seconds so far)'
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • output_off
  • '[' true = true ']'
  • set +x
    2024-05-25.23:22:21 [WARN] /etc/services.available/dbbackup-02/run ** [02-x.x.x.22__ALL] MySQL/MariaDB Server 'x.x.x.22' is not accessible, retrying.. (5 seconds so far)
  • output_on
  • '[' true = true ']'
  • case "$(basename "$0")" in
    ++ basename ./run
  • case "$PWD" in
  • set -x
  • var_true ''
  • '[' '' = true ']'
  • '[' '' = yes ']'
  • run_as_user mysqladmin -uroot -P3306 -hx.x.x.22 status
  • sleep 5
  • (( counter+=5 ))

@ToshY
Copy link
Contributor

ToshY commented May 26, 2024

Hey @mlause 👋

The part that's currently interesting in the log is the following:

export MYSQL_PWD=
MYSQL_PWD=
run_as_user mysqladmin -uroot -P3306 -hx.x.x.22 status
...
write_log warn 'MySQL/MariaDB Server '''x.x.x.22''' is not accessible, retrying.. (5 seconds so far)'
var_true ''

First thing I noticed is that the MYSQL_PWD is empty in the log. While I assume that you've redacted this due to sensitive information, it could also be possible that you forgot to provide the password to the container using DB01_PASS.

You state that "I can ping both databases within a shell command.", does this mean you've pinged/checked it from within the db-backup container? If you perform the following within the db-backup container, substituting your own username, password, port and host, what does it return?

export MYSQL_PWD=<password>
mysqladmin -u<username> -P<port> -h<host> status

My best guess for now would be either that password was not set (or incorrect), or that the host might not be accessible to the db-backup container. Can you provide the config/environment variables you've used, in particularly the DEFAULT_ and DB01_ variables?


Sidenote: if you format your log using markdown with triple backticks that would make it easier to read: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

@mlause
Copy link
Author

mlause commented May 27, 2024

I figured out the issue. I have this set as DB02. The container variable name was correct, but the key was wrong. I was able to backup mysql. Thanks for the help in identifying this.

@ToshY
Copy link
Contributor

ToshY commented May 27, 2024

@mlause Great to hear 👍


You can close this issue if it's resolved.

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