From efc699e27b95eb74fd9e60ff65adb24c1a52ccb7 Mon Sep 17 00:00:00 2001 From: Povilas Vaitkus Date: Tue, 7 Nov 2023 11:17:59 +0200 Subject: [PATCH] Add replicate_do_db --- attributes/default.rb | 1 + metadata.rb | 2 +- templates/my.cnf.main.erb | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 3ee98baa..a289b6df 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -192,6 +192,7 @@ default['percona']['server']['replication']['replication_sql'] = '/etc/mysql/replication.sql' default['percona']['server']['replication']['slave_transaction_retries'] = 10 default['percona']['server']['replication']['slave_exec_mode'] = 'IDEMPOTENT' +default['percona']['server']['replication']['replicate_do_db'] = [] # Mysqld_safe default['percona']['server']['skip_syslog'] = false diff --git a/metadata.rb b/metadata.rb index 8a55a3fb..a408f2b0 100644 --- a/metadata.rb +++ b/metadata.rb @@ -5,7 +5,7 @@ description 'Installs Percona MySQL client and server' source_url 'https://github.com/hostinger/chef-percona' issues_url 'https://github.com/hostinger/chef-percona/issues' -version '5.11.25' +version '5.11.26' chef_version '>= 16.0' depends 'yum' diff --git a/templates/my.cnf.main.erb b/templates/my.cnf.main.erb index 3c4a6434..1badd985 100644 --- a/templates/my.cnf.main.erb +++ b/templates/my.cnf.main.erb @@ -306,6 +306,12 @@ replicate-ignore-db = <%= ignore_db %> <% end -%> <% end -%> +<% unless node["percona"]["server"]["replication"]["replicate_do_db"].empty? %> +<% Array(node["percona"]["server"]["replication"]["replicate_do_db"]).each do |db| -%> +replicate-do-db = <%= db %> +<% end -%> +<% end -%> + <% unless node["percona"]["server"]["replication"]["ignore_table"].empty? %> # Creates a replication filter by telling the replica SQL thread not to replicate any statement that updates the specified table, even if any other tables might be updated by the same statement. <% node["percona"]["server"]["replication"]["ignore_table"].each do |ignore_table| -%>