Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung | |||
content:serverbasics:docker-mariadb [2024/08/03 23:41] – [Backup] Daniel | content: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: | ||
+ | < | ||
+ | |||
+ | volumes: | ||
+ | #Bind mount: Socketfile needs to be definied by full filename, not only path! | ||
+ | - / | ||
+ | |||
+ | </ | ||
+ | |||
+ | 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 ''/ | Create the File ''/ | ||
- | < | ||
+ | < | ||
#Type Path Mode UID GID Age Argument | #Type Path Mode UID GID Age Argument | ||
d / | d / | ||
Zeile 252: | Zeile 267: | ||
</ | </ | ||
+ | |||
===== Backup ===== | ===== Backup ===== | ||
- | Backing up MariaDB works like this: | + | Backing up MariaDB |
< | < | ||
Zeile 271: | Zeile 287: | ||
</ | </ | ||
+ | |||
+ | ==== No Docker Service ==== | ||
+ | |||
+ | If you have MariaDB as native Host- Service installed, use: | ||
+ | < | ||
+ | |||
+ | #!/bin/bash | ||
+ | # Makes a Backup of the whole Mariadb | ||
+ | BACKUPFILE=/ | ||
+ | echo " | ||
+ | # 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... | ||
+ | / | ||
+ | if [ ! -f ${BACKUPFILE} ]; then | ||
+ | echo " | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | </ | ||
+ | |||
===== Optimizing Tables ===== | ===== Optimizing Tables ===== | ||