mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-16 18:37:04 +03:00
nixos/mysql: properly configure mariadb for galera recovery
This commit is contained in:
parent
dc0e2bfd78
commit
4b9262786d
@ -375,6 +375,18 @@ in
|
||||
fi
|
||||
'';
|
||||
|
||||
script = ''
|
||||
# https://mariadb.com/kb/en/getting-started-with-mariadb-galera-cluster/#systemd-and-galera-recovery
|
||||
if test -n "''${_WSREP_START_POSITION}"; then
|
||||
if test -e "${cfg.package}/bin/galera_recovery"; then
|
||||
VAR=$(cd ${cfg.package}/bin/..; ${cfg.package}/bin/galera_recovery); [[ $? -eq 0 ]] && export _WSREP_START_POSITION=$VAR || exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# The last two environment variables are used for starting Galera clusters
|
||||
exec ${cfg.package}/bin/mysqld --defaults-file=/etc/my.cnf ${mysqldOptions} $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION
|
||||
'';
|
||||
|
||||
postStart = let
|
||||
# The super user account to use on *first* run of MySQL server
|
||||
superUser = if isMariaDB then cfg.user else "root";
|
||||
@ -481,8 +493,7 @@ in
|
||||
Type = if hasNotify then "notify" else "simple";
|
||||
Restart = "on-abort";
|
||||
RestartSec = "5s";
|
||||
# The last two environment variables are used for starting Galera clusters
|
||||
ExecStart = "${cfg.package}/bin/mysqld --defaults-file=/etc/my.cnf ${mysqldOptions} $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION";
|
||||
|
||||
# User and group
|
||||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
|
Loading…
Reference in New Issue
Block a user