summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorIzorkin <izorkin@elven.pw>2019-08-09 22:21:31 +0300
committerIzorkin <izorkin@elven.pw>2019-10-13 19:18:51 +0300
commit632f69e4857925c082cccd7bfc98964813aded00 (patch)
tree31dfcd08da5f54936bf89da36f90912ec1c98a75 /nixos
parent0877ebd6d2e238f708bcf9dbfd2b013f641e0ace (diff)
downloadnixpkgs-632f69e4857925c082cccd7bfc98964813aded00.tar
nixpkgs-632f69e4857925c082cccd7bfc98964813aded00.tar.gz
nixpkgs-632f69e4857925c082cccd7bfc98964813aded00.tar.bz2
nixpkgs-632f69e4857925c082cccd7bfc98964813aded00.tar.lz
nixpkgs-632f69e4857925c082cccd7bfc98964813aded00.tar.xz
nixpkgs-632f69e4857925c082cccd7bfc98964813aded00.tar.zst
nixpkgs-632f69e4857925c082cccd7bfc98964813aded00.zip
nixos/mysql: fix mysqlReplication test
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/databases/mysql.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/nixos/modules/services/databases/mysql.nix b/nixos/modules/services/databases/mysql.nix
index df74cfc9a26..39192d05948 100644
--- a/nixos/modules/services/databases/mysql.nix
+++ b/nixos/modules/services/databases/mysql.nix
@@ -272,8 +272,13 @@ in
       port = ${toString cfg.port}
       datadir = ${cfg.dataDir}
       ${optionalString (cfg.bind != null) "bind-address = ${cfg.bind}" }
-      ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "log-bin=mysql-bin"}
-      ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave") "server-id = ${toString cfg.replication.serverId}"}
+      ${optionalString (cfg.replication.role == "master" || cfg.replication.role == "slave")
+      ''
+        log-bin=mysql-bin-${toString cfg.replication.serverId}
+        log-bin-index=mysql-bin-${toString cfg.replication.serverId}.index
+        relay-log=mysql-relay-bin
+        server-id = ${toString cfg.replication.serverId}
+      ''}
       ${optionalString (cfg.ensureUsers != [])
       ''
         plugin-load-add = auth_socket.so
@@ -381,6 +386,7 @@ in
 
                         ( echo "stop slave;"
                           echo "change master to master_host='${cfg.replication.masterHost}', master_user='${cfg.replication.masterUser}', master_password='${cfg.replication.masterPassword}';"
+                          echo "set global slave_exec_mode='IDEMPOTENT';"
                           echo "start slave;"
                         ) | ${mysql}/bin/mysql -u root -N
                       ''}