J’ai trouvé sur le wiki diasporafondation un script pour effectuer un backup de son Pod. Souci quand je le lance j’ai une erreur “Unknown adapter mysql2”, j’en déduis qu’il ne prends pas en charge les installations avec Mysql.
I found in the diasporafondation’s wiki a script to make a backup of my Pods but when i run it, i’ve an error “Unknown adapter mysql2” so i think mysql isn’t coded in this script.
Hi there!
Well, if you read the description, it says “The presented version only supports PostgreSQL for now, but MySQL support could easily be added.”
You can add it yourself by adding section in, something like this:
mysql2)
echo "Running MySQL dump..."
TMP_FILE=$( mktemp )
mysqldump -u $USERNAME -p $PASSWORD $DATABASE > $TMP_FILE
status=$?
if [ $status -ne 0 ]; then
echo "Error running dump command: $status"
exit $status
fi
gzip -n $TMP_FILE
mv $TMP_FILE.gz $DUMP_FILE_NAME.sql.gz
;;
case $ADAPTER in
mysql)
echo “Running MySQL dump…”
TMP_FILE=$( mktemp )
mysqldump -u $USERNAME -p $PASSWORD $DATABASE > $TMP_FILE
status=$?
if [ $status -ne 0 ]; then
echo “Error running dump command: $status”
exit $status
fi
gzip -n $TMP_FILE
mv $TMP_FILE.gz $DUMP_FILE_NAME.sql.gz
;;
esac
Here the scripts logs :
[diaspora@dicespora:~/diaspora/script] master* ± ./backup.sh
Creating archive diaspora_dicespora.net_2020-02-20_10-24-58.tar…
tar: mysql2_diaspora_production_2020-02-20_10-24-58.sql.gz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Error 2 running tar. Archive wasn’t created.
unlink: cannot unlink ‘mysql2_diaspora_production_2020-02-20_10-24-58.sql.gz’: No such file or directory
Be sure to keep an eye on backups because if something happens to your server and you won’t be able to restore from backup, you’ll lose not only pod data but also ability to use same addresses (user@domain) forever. It is important
In a nutshell: when you create an account you also create an encryption key which is used to verify your identity. It is stored in your server database. When you add contacts, the other servers take record of this key to identify you in the future.
If you lose your database and have no backup, you won’t be able to use same usernames because if you do, other servers will remember the previous identity with the old key and reject new one as counterfeit. You will have to use new usernames (or domain).
So having backups is really important, especially if you plan to host other people. Keep some of them off your server too.