sebastianfeldmann / phpbu

PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process
https://phpbu.de
Other
1.29k stars 110 forks source link

error #358

Closed koloner closed 7 months ago

koloner commented 8 months ago

hi i am use this config.json

{
   "verbose": true,
   "logging": [
     {
       "type": "json",
       "target": "backup/json.log"
     }
   ],
   "backups": [
     {
       "name": "MyDatabase",
       "source": {
         "type": "mysqldump",
         "options": {
            "databases":"****",
            "user":"****",
            "password":"****",
            "structureOnly":"tabel1,tabel2"
         }
       },
       "target": {
         "dirname": "backup",
         "filename": "mysql-%Y%m%d-%H%i.sql",
         "compress": "bzip2"
       },
       "cleanup": {
         "type": "Capacity",
         "options": {
           "size": "200M"
         }
       }
     }
   ]
 }

But the settings are not applied and in this case it only gives the structure of the database. I want to give the whole database and those two tables give only the structure.

sebastianfeldmann commented 8 months ago

In this case create 2 backups One with the data ignoring both tables and one backup getting the structure of the 2 tables :)

koloner commented 8 months ago

Hello, thank you for your help, but I still have a problem, if I use this

{
   "verbose": true,
   "logging": [
     {
       "type": "json",
       "target": "backup/json.log"
     }
   ],
   "backups": [
     {
       "name": "MyDatabase",
       "source": {
         "type": "mysqldump",
         "options": {
            "databases":"****",
            "user":"****",
            "password":"****",
            "ignoreTables":"tabel"
         }
       },
       "target": {
         "dirname": "backup",
         "filename": "mysql-%Y%m%d-%H%i.sql",
         "compress": "bzip2"
       }
     }
   ]
 }

It gives me an empty output without any backup

If I tell it with "ignoreTables", it takes all of them

sebastianfeldmann commented 8 months ago

Are you using the database prefixes for your tables?

What should happen is, that if you configure it in one backup that phpbu will still execute two mysqldump commands.

You can check if you add the --debug option to your execution.

phpbu --debug

My example config looks like this and it seems to work.

    <backup>
      <source type="mysqldump">
        <option name="filePerTable" value="false" />
        <option name="user" value="root" />
        <option name="password" value="" />
        <option name="databases" value="db1,db2" />
        <option name="structureOnly" value="db2.cache-table" />
      </source>
      <target dirname="backup/mysql" filename="mysql-%Y%m%d-%H%i.sql" compress="bzip2" />

      <check type="sizemin" value="10MB"/>

      <cleanup type="Capacity">
        <option name="size" value="100M"/>
      </cleanup>
    </backup>