@@ -17,86 +17,92 @@ limitations under the License.
1717package syncer
1818
1919import (
20- logf "sigs.k8s.io/controller-runtime/pkg/log"
21-
2220 "github.com/radondb/radondb-mysql-kubernetes/utils"
21+ logf "sigs.k8s.io/controller-runtime/pkg/log"
2322)
2423
2524// log is for logging in this package.
2625var log = logf .Log .WithName ("mysqlcluster.syncer" )
2726
2827// mysqlSysConfigs is the map of mysql system configs.
2928var mysqlSysConfigs = map [string ]string {
30- "default-time-zone" : "+08:00" ,
31- "slow_query_log_file" : "/var/log/mysql/mysql-slow.log" ,
32- "read_only" : "ON" ,
33- "binlog_format" : "row" ,
29+ "default-time-zone" : "+08:00" ,
30+ "slow_query_log_file" : "/var/log/mysql/mysql-slow.log" ,
31+ "read_only" : "ON" ,
32+ "binlog_format" : "row" ,
33+ "log-bin" : "/var/lib/mysql/mysql-bin" ,
34+ "log-timestamps" : "SYSTEM" ,
35+ "innodb_open_files" : "655360" ,
36+ "open_files_limit" : "655360" ,
37+
38+ "gtid-mode" : "ON" ,
39+ "enforce-gtid-consistency" : "ON" ,
40+ "slave_parallel_type" : "LOGICAL_CLOCK" ,
41+ "relay_log" : "/var/lib/mysql/mysql-relay-bin" ,
42+ "relay_log_index" : "/var/lib/mysql/mysql-relay-bin.index" ,
43+ "master_info_repository" : "TABLE" ,
44+ "relay_log_info_repository" : "TABLE" ,
45+ "slow_query_log" : "1" ,
46+ "tmp_table_size" : "32M" ,
47+ "tmpdir" : "/var/lib/mysql" ,
48+ }
49+
50+ var mysqlSpecialConfig = map [string ]string {
3451 "plugin-load" : "\" semisync_master.so;semisync_slave.so;audit_log.so;connection_control.so\" " ,
35- "log-bin" : "/var/lib/mysql/mysql-bin" ,
36- "log-timestamps" : "SYSTEM" ,
37- "innodb_open_files" : "655360" ,
38- "open_files_limit" : "655360" ,
52+ "audit_log_file" : "/var/log/mysql/mysql-audit.log" ,
53+ "audit_log_exclude_accounts" : "\" root@localhost,root@127.0.0.1," + utils .ReplicationUser + "@%," + utils .MetricsUser + "@%\" " ,
54+ "audit_log_buffer_size" : "16M" ,
3955 "rpl_semi_sync_master_enabled" : "OFF" ,
4056 "rpl_semi_sync_slave_enabled" : "ON" ,
4157 "rpl_semi_sync_master_wait_no_slave" : "ON" ,
4258 "rpl_semi_sync_master_timeout" : "1000000000000000000" ,
43- "gtid-mode" : "ON" ,
44- "enforce-gtid-consistency" : "ON" ,
45- "slave_parallel_type" : "LOGICAL_CLOCK" ,
46- "relay_log" : "/var/lib/mysql/mysql-relay-bin" ,
47- "relay_log_index" : "/var/lib/mysql/mysql-relay-bin.index" ,
48- "master_info_repository" : "TABLE" ,
49- "relay_log_info_repository" : "TABLE" ,
50- "relay_log_recovery" : "ON" ,
51- "slow_query_log" : "1" ,
52- "tmp_table_size" : "32M" ,
53- "tmpdir" : "/var/lib/mysql" ,
54- "audit_log_file" : "/var/log/mysql/mysql-audit.log" ,
55- "audit_log_exclude_accounts" : "\" root@localhost,root@127.0.0.1," + utils .ReplicationUser + "@%," + utils .MetricsUser + "@%\" " ,
56- "audit_log_buffer_size" : "16M" ,
57- }
58-
59- // mysqlCommonConfigs is the map of the mysql common configs.
60- var mysqlCommonConfigs = map [string ]string {
61- "character_set_server" : "utf8mb4" ,
62- "interactive_timeout" : "3600" ,
63- "default-time-zone" : "+08:00" ,
64- "expire_logs_days" : "7" ,
65- "key_buffer_size" : "33554432" ,
66- "log_bin_trust_function_creators" : "1" ,
67- "long_query_time" : "3" ,
68- "binlog_cache_size" : "32768" ,
69- "binlog_stmt_cache_size" : "32768" ,
70- "max_connections" : "1024" ,
71- "max_connect_errors" : "655360" ,
72- "query_cache_size" : "0" ,
73- "sync_master_info" : "1000" ,
74- "sync_relay_log" : "1000" ,
75- "sync_relay_log_info" : "1000" ,
76- "table_open_cache" : "2000" ,
77- "thread_cache_size" : "128" ,
78- "wait_timeout" : "3600" ,
79- "group_concat_max_len" : "1024" ,
80- "slave_rows_search_algorithms" : "INDEX_SCAN,HASH_SCAN" ,
81- "max_allowed_packet" : "1073741824" ,
82- "event_scheduler" : "OFF" ,
83- "innodb_print_all_deadlocks" : "0" ,
84- "autocommit" : "1" ,
85- "transaction-isolation" : "READ-COMMITTED" ,
59+ //"audit-log": "ON",
8660 "audit_log_policy" : "NONE" ,
8761 "audit_log_rotate_on_size" : "104857600" ,
8862 "audit_log_rotations" : "6" ,
63+ "audit_log_format" : "OLD" ,
8964 "connection_control_failed_connections_threshold" : "3" ,
9065 "connection_control_min_connection_delay" : "1000" ,
9166 "connection_control_max_connection_delay" : "2147483647" ,
92- "explicit_defaults_for_timestamp" : "0" ,
93- "innodb_adaptive_hash_index" : "0" ,
67+ "default-authentication-plugin" : "mysql_native_password" ,
68+ }
69+
70+ // mysqlCommonConfigs is the map of the mysql common configs.
71+ var mysqlCommonConfigs = map [string ]string {
72+ "character_set_server" : "utf8mb4" ,
73+ "interactive_timeout" : "3600" ,
74+ "default-time-zone" : "+08:00" ,
75+ "expire_logs_days" : "7" ,
76+ "key_buffer_size" : "33554432" ,
77+ "log_bin_trust_function_creators" : "1" ,
78+ "long_query_time" : "3" ,
79+ "binlog_cache_size" : "32768" ,
80+ "binlog_stmt_cache_size" : "32768" ,
81+ "max_connections" : "1024" ,
82+ "max_connect_errors" : "655360" ,
83+ "query_cache_size" : "0" ,
84+ "sync_master_info" : "1000" ,
85+ "sync_relay_log" : "1000" ,
86+ "sync_relay_log_info" : "1000" ,
87+ "table_open_cache" : "2000" ,
88+ "thread_cache_size" : "128" ,
89+ "wait_timeout" : "3600" ,
90+ "group_concat_max_len" : "1024" ,
91+ "slave_rows_search_algorithms" : "INDEX_SCAN,HASH_SCAN" ,
92+ "max_allowed_packet" : "1073741824" ,
93+ "event_scheduler" : "OFF" ,
94+ "innodb_print_all_deadlocks" : "0" ,
95+ "autocommit" : "1" ,
96+ "transaction-isolation" : "READ-COMMITTED" ,
97+
98+ "explicit_defaults_for_timestamp" : "0" ,
99+ "innodb_adaptive_hash_index" : "0" ,
94100}
95101
96102// mysqlStaticConfigs is the map of the mysql static configs.
97103// The mysql need restart, if modify the config.
98104var mysqlStaticConfigs = map [string ]string {
99- "audit_log_format" : "OLD" ,
105+
100106 "default-storage-engine" : "InnoDB" ,
101107 "back_log" : "2048" ,
102108 "ft_min_word_len" : "4" ,
0 commit comments