databacker / mysql-backup

image to enable automated backups of mysql databases in containers
636 stars 178 forks source link

SMB backup issue #202

Open avilabss opened 2 years ago

avilabss commented 2 years ago
./backup_2022-07-14T21:28:24Z.sql
directory_create_or_exist: lstat failed on directory /var/lib/samba/private/msg.sock: Permission denied
Unable to initialize messaging context
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
./
./backup_2022-07-15T21:28:25Z.sql
directory_create_or_exist: lstat failed on directory /var/lib/samba/private/msg.sock: Permission denied
Unable to initialize messaging context
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
./

If it's a mistake on my end then is this the right way to make an SMB backup?

db-backup:
    image: databack/mysql-backup
    restart: always
    networks:
      - my-net
    links:
      - db
    environment:
      DB_SERVER: db
      DB_PORT: 3306
      DB_USER: user
      DB_PASS: pass
      # DB_DUMP_KEEP_PERMISSIONS: false
      DB_DUMP_TARGET: smb://ipp/storage
      DB_DUMP_FREQ: 1440
      SMB_USER: smbuser
      SMB_PASS: smbpass
deitch commented 2 years ago

This looks like a duplicate of #200 ; if so, please check the latest tagged version and use that, and close this issue.

image: databack/mysql-backup

This uses the implicit tag of latest, which always is unstable (hence not a great idea). mysql-backup follows a common pattern where:

Both are mutable and provided as conveniences. You should use an explicit tag.

avilabss commented 2 years ago

understood but is my schema right? Is this how u write compose for backup on sbm?

deitch commented 2 years ago

Looks like it.

avilabss commented 2 years ago

results using master tag:

Starting at Fri Jul 29 08:45:48 UTC 2022
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
./
./backup_2022-07-29T08:45:48Z.sql
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
avilabss commented 2 years ago

results using latest tag:

Starting at Fri Jul 29 08:48:54 UTC 2022
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
./
./backup_2022-07-29T08:48:54Z.sql
directory_create_or_exist: lstat failed on directory /var/lib/samba/private/msg.sock: Permission denied
Unable to initialize messaging context
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
avilabss commented 2 years ago

I am able to access my smb storage using my mac so my samba is running properly

avilabss commented 2 years ago

results using 64da50c8e5196fd820a2eb5b75bd5b73456927de tag:

Starting at Fri Jul 29 08:51:38 UTC 2022
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
./
./backup_2022-07-29T08:51:38Z.sql
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
avilabss commented 2 years ago

@deitch can u please check my issue

avilabss commented 2 years ago

I tried to set backup to server itself to check if it works:

db-backup:
    image: databack/mysql-backup:master
    restart: always
    networks:
      - backend-net
    user: root
    links:
      - db
    environment:
      DB_SERVER: db
      DB_PORT: 3306
      DB_USER: db
      DB_PASS: pass
      DB_DUMP_KEEP_PERMISSIONS: false
      DB_DUMP_TARGET: /db
      DB_DUMP_FREQ: 1440
    volumes:
     - /home:/db

and it still gives error

Starting at Sat Aug 6 05:19:36 UTC 2022
mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces
./
./backup_2022-08-06T05:19:36Z.sql

but! file was found on /home

root@my-server:/home# ls
db_backup_2022-08-06T05:16:40Z.tgz  db_backup_2022-08-06T05:19:36Z.tgz
deitch commented 2 years ago

This error:

mysqldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces

Is an error coming from mysql, while this one:

tree connect failed: NT_STATUS_BAD_NETWORK_NAME

is an error coming from smb.

So it isn't too surprising that switching to local server works with the file existing. In the last case, did the file have any size?

I would run this with DB_DUMP_DEBUG=true env var set, and then let's see what the output is.