dienste:bytecluster0002:mariadb

Dies ist eine alte Version des Dokuments!


Container 'mariadb'

  • 1 GB RAM
  • 2 Cores
  • 8 GB HDD (root-fs)
  • interne IPs
    • 10.2.0.100, fd00:10:2:0::100
    • 10.3.0.100, fd00:10:3:0::100 (MariaDB)
  • MariaDB 10
Datenbank Benutzer Verwendung
nextcloud nc_user Nextcloud
wordpress wp_user Wordpress
  1. Zur Datenbank verbinden
    • sudo mysql
  2. Datenbank anlegen und Benutzer mit Passwort zuweisen

    MySQL-Konsole "MariaDB [(none)]"

    CREATE DATABASE databasename;
    GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'%' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
  1. Zur Datenbank verbinden
    • sudo mysql
  2. Benutzer neues Passwort zuweisen

    MySQL-Konsole "MariaDB [(none)]"

    ALTER USER 'username'@'%' IDENTIFIED BY 'password';
    FLUSH PRIVILEGES;
  • Standard-Template mit Benutzern
  1. MariaDB-Server installieren
    • apt-get install mariadb-server
  2. MariaDB - Erstkonfiguration
    • mysql_secure_installation
      • Set root password? [Y/n]: Y
      • New password: PASSWORT
      • Re-enter new password: PASSWORT
      • Remove anonymous users? [Y/n]: Y
      • Disallow root login remotely? [Y/n]: Y
      • Remove test database and access to it? [Y/n]: Y
      • Reload privilege tables now? [Y/n]: Y
  3. Benutzerdefinierte Konfiguration anlegen

    /etc/mysql/mariadb.conf.d/99-bytecluster.cnf

    [mysqld]
    # An lokale IP binden
    bind-address                    = 10.3.0.100
    
    # Binlog deaktivieren
    skip-log-bin
    
    # InnoDB verwenden
    default_storage_engine          = InnoDB
    
    # InnoDB-Optimierungen
    innodb_buffer_pool_size         = 256M
    innodb_log_buffer_size          = 8M
    innodb_log_file_size            = 128M
    
    innodb_log_files_in_group       = 2
    innodb_flush_log_at_trx_commit  = 2
    innodb_flush_method             = O_DIRECT
    innodb_file_per_table           = 1 
  4. MariaDB neustarten
    • systemctl restart mariadb.service
  1. Borgmatic installieren
    • sudo apt-get install borgmatic
  2. Borgmatic-Konfiguration in der Datei /etc/borgmatic/config.yaml erzeugen
    • sudo generate-borgmatic-config
  3. SSH-Key erzeugen
    • sudo ssh-keygen -a100 -t ed25519 -f /root/.ssh/id_borgbackup
  4. SSH-Key bei Backupserver hinterlegen
  5. Zufälliges Passwort in Konfiguration erzeugen
    • sudo sed -i -e "s|^\( encryption_passphrase: \"\).*\(\"\)$|\1PASS_TO_REPLACE\2|" /etc/borgmatic/config.yaml
    • sudo sed -i "s|PASS_TO_REPLACE|$(pwgen -cnysB -1 32 -r \"\^\|)|" /etc/borgmatic/config.yaml
  • dienste/bytecluster0002/mariadb.1606340921.txt.gz
  • Zuletzt geändert: 25.11.2020 22:48
  • von mape2k