321
Comment:
|
← Revision 6 as of 2023-01-24 09:55:24 ⇥
1804
|
Deletions are marked like this. | Additions are marked like this. |
Line 2: | Line 2: |
* Links [[https://docs.bitnami.com/kubernetes/infrastructure/mariadb/configuration/customize-new-instance/]] |
|
Line 5: | Line 7: |
* Using startup feature, that looks for db/scripts in /docker-entrypoint-initdb.d/ and loads then on db creation. | * Using startup feature, that looks for db/scripts in '''"/docker-entrypoint-initdb.d/"''' and loads then on db creation. * Only first run, then startup leaves flag '''.user_scripts_initialized''' * dirs {{{ export BITNAMI_VOLUME_DIR="/bitnami" export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" export DB_DATA_DIR="${DB_VOLUME_DIR}/data" #= /bitnami/mariadb/data }}} * *.sql.gz imported with {{{ *.sql.gz) [[ "$DB_REPLICATION_MODE" = "slave" ]] \ && warn "Custom SQL $1db is not supported on slave nodes, ignoring $f" && continue wait_for_mysql_access "$DB_ROOT_USER" # In this case, it is best to pipe the uncompressed SQL commands directly # to the 'mysql' command as extraction may cause problems # e.g. lack of disk space, permission issues... if ! gunzip -c "$f" | mysql_execute_print_output "$DB_DATABASE" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD"; then error "Failed executing $f" return 1 fi }}} * example if initdb shell script {{{ initdbScripts: my_init_script.sh: | #!/bin/sh if [[ $(hostname) == *primary* ]]; then echo "Primary node" mysql -P 3306 -uroot -prandompassword -e "create database new_database"; else echo "No primary node" fi }}} |
k8s/MariaDbGaleraInitDb
Links https://docs.bitnami.com/kubernetes/infrastructure/mariadb/configuration/customize-new-instance/
Running MariaDb (mysql fork) clusters version (Galera) using helm in Kubernetes, then initializing DB.
- 2022 - Using the bitnami/Mariadb-galera helm chart to deploy
Using startup feature, that looks for db/scripts in "/docker-entrypoint-initdb.d/" and loads then on db creation.
Only first run, then startup leaves flag .user_scripts_initialized
dirs
export BITNAMI_VOLUME_DIR="/bitnami" export DB_VOLUME_DIR="${BITNAMI_VOLUME_DIR}/mariadb" export DB_DATA_DIR="${DB_VOLUME_DIR}/data" #= /bitnami/mariadb/data
*.sql.gz imported with
*.sql.gz) [[ "$DB_REPLICATION_MODE" = "slave" ]] \ && warn "Custom SQL $1db is not supported on slave nodes, ignoring $f" && continue wait_for_mysql_access "$DB_ROOT_USER" # In this case, it is best to pipe the uncompressed SQL commands directly # to the 'mysql' command as extraction may cause problems # e.g. lack of disk space, permission issues... if ! gunzip -c "$f" | mysql_execute_print_output "$DB_DATABASE" "$DB_ROOT_USER" "$DB_ROOT_PASSWORD"; then error "Failed executing $f" return 1 fi
example if initdb shell script
initdbScripts: my_init_script.sh: | #!/bin/sh if [[ $(hostname) == *primary* ]]; then echo "Primary node" mysql -P 3306 -uroot -prandompassword -e "create database new_database"; else echo "No primary node" fi