Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
content:serverbasics:docker-mariadb [2024/08/03 23:41] – [Backup] Danielcontent:serverbasics:docker-mariadb [2025/03/29 19:46] (aktuell) Daniel
Zeile 12: Zeile 12:
   * Using Sockets, not TCP/IP on the host   * Using Sockets, not TCP/IP on the host
   * Added some tweaks from the net   * Added some tweaks from the net
 +
 +====== STOP ======
 +
 +This - it turned out is a very bad idea. MariaDB on Docker performs VERY bad. So i would strongly not advise to use Docker for this. Use native mariadb on your host and adept what is written here.
 +
 +When you link the native mariadb- Socket to the services like this, you will be able to use Mariadb:
 +<file>
 +
 +  volumes:
 +#Bind mount: Socketfile needs to be definied by full filename, not only path!
 +    - /run/mysql/mysql.sock:/run/mysql/mysql.sock
 +
 +</file>
 +
 +Or you can use Port 3306 and as host your servername (NOT localhost).
  
 ===== Create Socket in tmpfs ===== ===== Create Socket in tmpfs =====
Zeile 18: Zeile 33:
  
 Create the File ''/etc/tmpfiles.d/docker-mariadb.conf''  with content Create the File ''/etc/tmpfiles.d/docker-mariadb.conf''  with content
-<file> 
  
 +<file>
 #Type Path            Mode UID      GID    Age Argument #Type Path            Mode UID      GID    Age Argument
 d     /run/mysqld     0755 docker   docker -   - d     /run/mysqld     0755 docker   docker -   -
Zeile 252: Zeile 267:
  
 </file> </file>
 +
 ===== Backup ===== ===== Backup =====
  
-Backing up MariaDB works like this:+Backing up MariaDB on Docker works like this:
  
 <file> <file>
Zeile 271: Zeile 287:
  
 </file> </file>
 +
 +==== No Docker Service ====
 +
 +If you have MariaDB as native Host- Service installed, use:
 +<file>
 +
 +#!/bin/bash
 +# Makes a Backup of the whole Mariadb
 +BACKUPFILE=/root/backup/mariadb_dump_all.zstd
 +echo "Fullbackup of MariaDB into ${BACKUPFILE}..."
 +# Keep one Copy of the old Backup
 +if [ -f ${BACKUPFILE} ]; then
 +    if [ -f ${BACKUPFILE}.back ]; then
 +        rm ${BACKUPFILE}.back
 +    fi
 +    mv ${BACKUPFILE} ${BACKUPFILE}.back
 +else
 +    echo "File ${BACKUPFILE} was not found, not removing ${BACKUPFILE}.back"
 +fi
 +# for mysql use mysqldump...
 +/usr/bin/mariadb-dump --all-databases --single-transaction --quick --lock-tables=true -u root -p'SECRETPASSPHRASE' | zstd -19 -o ${BACKUPFILE} --no-progress
 +if [ ! -f ${BACKUPFILE} ]; then
 +    echo "ERROR: File ${BACKUPFILE} was not created - NO BACKUP PERFORMED. Please check the Backup."
 +    exit 1
 +fi
 +
 +</file>
 +
 ===== Optimizing Tables ===== ===== Optimizing Tables =====
  
  • content/serverbasics/docker-mariadb.txt
  • Zuletzt geändert: 2025/03/29 19:46
  • von Daniel