soana Posted June 3, 2015 Share Posted June 3, 2015 I created this little docker to keep a backup of my SQL database for Kodi. It starts from a phusion base image, installs mariaDB and then launches a cron job. It requires a location for the backed-up files, cron parameters, IP address of the SQL server, the pushbullet token if you want notifications and the number of backup files to keep. All of these are environment variables and can be input after selecting Advanced view. I'm using it for some time now with no issues. Link to the docker-template is in my signature. EDIT 1: Right now only one backup a day is supported due to the naming convention of the backup file. But then I was not expecting to need more than one backup a day. EDIT 2: Obviously this docker needs more error proofing - I would like to change it into beta until all the fixes are in place EDIT 3: Added variable for userid, implementing the password is giving me a little headache. Pushbullet notification modified for successful backup and to show error code if the backup command failed. EDIT4: In order to restore a backed-up file use: gunzip < MyDatabase_DATE.sql.gz | mysql -uroot -h 192.168.99.99 Quote Link to comment
CHBMB Posted June 3, 2015 Share Posted June 3, 2015 I love the idea of this, I set it up like this, my MySQL server is Needo's MariaDB MySQLIP: 192.168.1.1 (also tried 192.168.1.1:3306) The job runs but creates a 1kb file. The logs don't reveal anything and the pushbullet notification suggests the backup is completed, I suspect it's because of a username / password issue as I don't see anywhere to input this. Also, I think it would be helpful for people like me that aren't particularly skilled with mysql to let us know how to restore the data. Quote Link to comment
soana Posted June 3, 2015 Author Share Posted June 3, 2015 Agreed the userid and password fields need to be available for input. Will update Quote Link to comment
CHBMB Posted June 3, 2015 Share Posted June 3, 2015 Agreed the userid and password fields need to be available for input. Will update Look forward to it, now how would I go about reimporting the sql files into my MariaDB container? Quote Link to comment
CHBMB Posted June 25, 2015 Share Posted June 25, 2015 EDIT 3: implementing the password is giving me a little headache. Any progress on this? Quote Link to comment
ikosa Posted June 25, 2015 Share Posted June 25, 2015 i m not sure how much a docker repo eats resource but i dont think that mysql backup needs a docker repo. plugin sounds more efficiant to me. i edit my v5 plugin files a bit to backup my kodi database on mariadb docker and add pushover notification. i dont have time for updating my plugin to v6 but i will attach my files, soana or anyone can use or develop. - extract files to /boot/custom/ - change the parametrs in cfg file. - add /backup path mapping to your (mysql/mariadb etc)docker repo. - and add this to your go file: #mysql backup cron job /boot/custom/mysql_cron.sh * checking files permissions will be good to be sure they can be executed. mysql.zip Quote Link to comment
soana Posted June 26, 2015 Author Share Posted June 26, 2015 I agree that a plugin makes more sense since it will also give the option/interface for restoring a backup. The docker created will do regular backups but for restoring one has to use a command line. Quote Link to comment
ikosa Posted June 29, 2015 Share Posted June 29, 2015 For some reason docker exec -ti command throws a tty error when running from cron. I remove -ti parameter, seems running ok now. mysql.zip Quote Link to comment
RockDawg Posted October 15, 2015 Share Posted October 15, 2015 I am getting the 1kb file also. I saw where to enter the SQL_userid variable to which I entered 'root'. What about the root password and/or db user and password? Where how do I enter those? Would love to get this working. For years I used a script via cronjob to backup my Kodi db's, but now that I switched over to Docker containers I haven't been able to get anything to work. Also, when working correctly, is this just the video database or does it also include the music database? Quote Link to comment
RockDawg Posted October 18, 2015 Share Posted October 18, 2015 I can verify that the missing password is the problem. I took took the command from your cronjob and added -p<apssword> and it ran as exepected from shell. I would fix it, but I have no idea how to use github or how to make my own files to create a Docker container for unraid. Quote Link to comment
ikosa Posted October 18, 2015 Share Posted October 18, 2015 You can use my scripts 3 posts up, no docker needed. Quote Link to comment
RockDawg Posted October 19, 2015 Share Posted October 19, 2015 A password variable is now included in the latest version and it works great. Thanks soana! Quote Link to comment
RockDawg Posted October 19, 2015 Share Posted October 19, 2015 You can use my scripts 3 posts up, no docker needed. I didn't realize what your attachment was. Thanks for the heads up. Quote Link to comment
2twisty Posted April 26, 2020 Share Posted April 26, 2020 Back from the dead. Does this docker (or the script mentioned) work on 6.8.3? With the docker, I am getting the 1kb file with a zero-byte sql dump file inside. With the script, it fails to run,giving me "mysqldump: errno 11 on write" when it executes the docker command Quote Link to comment
soana Posted April 27, 2020 Author Share Posted April 27, 2020 I did abandon this container some time ago since I did not need it anymore. It was used to backup my xbmc sql database but since I switched to plex I never used it again. I will ask squid to remove it from the list. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.