diff --git a/mysql_ansible/roles/make_replication/templates/master_slaves.sql.j2 b/mysql_ansible/roles/make_replication/templates/master_slaves.sql.j2 index b7eef0ac154fe3485a00305ad50eccebcf440d36..cc15999dc0948707fd12f1485c66e5c76d4d8a35 100644 --- a/mysql_ansible/roles/make_replication/templates/master_slaves.sql.j2 +++ b/mysql_ansible/roles/make_replication/templates/master_slaves.sql.j2 @@ -1,6 +1,11 @@ {% if master_ip in ansible_all_ipv4_addresses %} create user {{mysql_rple_user}}@'{{ sub_nets }}' identified by '{{mysql_rple_password}}'; -grant replication slave,replication client on *.* to {{mysql_rple_user}}@'{{ sub_nets }}'; +{% if mysql_version.startswith('8.4') and db_type == 'mysql' %} +grant replication slave, replication client on *.* to {{mysql_rple_user}}@'{{ sub_nets }}'; +grant SYSTEM_USER on *.* to {{mysql_rple_user}}@'{{ sub_nets }}'; +{% else %} +grant replication slave, replication client on *.* to {{mysql_rple_user}}@'{{ sub_nets }}'; +{% endif %} {% else %} select sleep(10); diff --git a/mysql_ansible/roles/mysql_server/templates/5.7/my.cnf.j2 b/mysql_ansible/roles/mysql_server/templates/5.7/my.cnf.j2 index 23ee9f125a62d17bba9ce240e0268c0b6446033a..8dc45aa4348dcee25f5ed506c9bbb161ce02d85b 100644 --- a/mysql_ansible/roles/mysql_server/templates/5.7/my.cnf.j2 +++ b/mysql_ansible/roles/mysql_server/templates/5.7/my.cnf.j2 @@ -3,85 +3,85 @@ auto-rehash [mysqld] ####: for global -user ={{ mysql_user }} # mysql +user = {{ mysql_user }} # mysql basedir = {{ mysql_software_dir }} # /usr/local/mysql/ datadir = {{ datadir }} # /usr/local/mysql/data tmpdir = {{ tmpdir }} -server_id ={{ mysql_server_id }} # 0 -port ={{ mysql_port }} # 3306 -character_set_server ={{ mysql_character_set_server }} # latin1 -log_bin_trust_function_creators =on # 0 -max_prepared_stmt_count =1048576 -log_timestamps =system # utc -read_only =0 # off -skip_name_resolve =1 # 0 -auto_increment_increment =1 # 1 -auto_increment_offset =1 # 1 -lower_case_table_names =1 # 0 -secure_file_priv = # null -open_files_limit =65536 # 1024 -max_connections ={{mysql_max_connections | default(1000)}} -thread_cache_size ={{ [(server_specs_processor_count|int) * 8,256] | max}} # 9 -table_open_cache =4096 # 2000 -table_definition_cache =2000 # 1400 -table_open_cache_instances =32 # 16 -local_infile =off # on -disabled_storage_engines=archive,blackhole,example,federated,memory,merge,ndb +server_id = {{ mysql_server_id }} # 0 +port = {{ mysql_port }} # 3306 +character_set_server = {{ mysql_character_set_server }} # latin1 +log_bin_trust_function_creators = ON # 0 +max_prepared_stmt_count = 1048576 +log_timestamps = SYSTEM # utc +read_only = OFF # off +skip_name_resolve = ON # 0 +auto_increment_increment = 1 # 1 +auto_increment_offset = 1 # 1 +lower_case_table_names = 1 # 0 +secure_file_priv = # null +open_files_limit = 65536 # 1024 +max_connections = {{mysql_max_connections | default(1000)}} +thread_cache_size = {{ [(server_specs_processor_count|int) * 8,256] | max}} # 9 +table_open_cache = 4096 # 2000 +table_definition_cache = 2000 # 1400 +table_open_cache_instances = 32 # 16 +local_infile = OFF # on +disabled_storage_engines = archive,blackhole,example,federated,memory,merge,ndb plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so;validate_password=validate_password.so" -pid_file=mysqld.pid -transaction_isolation ={{ mysql_transaction_isolation }} #RR -socket = {{ socket }} # /tmp/mysql.sock +pid_file = mysqld.pid +transaction_isolation = {{ mysql_transaction_isolation }} #RR +socket = {{ socket }} # /tmp/mysql.sock ####: for binlog -binlog_format ={{mysql_binlog_format}} # row -binlog_error_action =abort_server # abort_server +binlog_format = {{mysql_binlog_format}} # row +binlog_error_action = ABORT_SERVER # abort_server log_bin = {{ binlog_dir }}/mysql-bin # OFF -binlog_rows_query_log_events =on # off -log_slave_updates =on # off -expire_logs_days =8 # 0 +binlog_rows_query_log_events = ON # off +log_slave_updates = ON # off +expire_logs_days = 8 # 0 {# set binlog cache size #} {% if mysql_binlog_format == 'mixed' %} -binlog_cache_size =32768 # 32768(32k) +binlog_cache_size = 32768 # 32768(32k) {% else %} -binlog_cache_size =65536 # 65536(64k) +binlog_cache_size = 65536 # 65536(64k) {% endif %} {# set binlog cache size #} -binlog_checksum =CRC32 # CRC32 -sync_binlog =1 # 1 -slave_preserve_commit_order =ON # OFF +binlog_checksum = CRC32 # CRC32 +sync_binlog = 1 # 1 +slave_preserve_commit_order = ON # OFF ####: for error-log -log_error ={{ errlog_dir }}/error.log # /usr/local/mysql/data/localhost.localdomain.err +log_error = {{ errlog_dir }}/error.log # /usr/local/mysql/data/localhost.localdomain.err {# set general log #} -general_log =off # off -general_log_file ={{ generallog_dir }}/general.log # hostname.log +general_log = OFF # off +general_log_file = {{ generallog_dir }}/general.log # hostname.log {# set general log #} ####: for slow query log -slow_query_log =on # off -slow_query_log_file ={{ slowlog_dir }}/slow.log # hostname-slow.log -log_queries_not_using_indexes =off # off -long_query_time =2.000000 # 10.000000 +slow_query_log = ON # off +slow_query_log_file = {{ slowlog_dir }}/slow.log # hostname-slow.log +log_queries_not_using_indexes = OFF # off +long_query_time = 2.000000 # 10.000000 ####: for gtid -gtid_executed_compression_period =1000 # 1000 -gtid_mode =on # off -enforce_gtid_consistency =on # off +gtid_executed_compression_period = 1000 # 1000 +gtid_mode = ON # off +enforce_gtid_consistency = ON # off ####: for replication -skip_slave_start =0 # -relay_log ={{ relaylog_dir }}/relay-bin -relay_log_recovery=1 -master_info_repository =table # file -relay_log_info_repository =table # file -slave_parallel_type =logical_clock # database | LOGICAL_CLOCK -slave_parallel_workers ={{[(server_specs_processor_count |int) * 4 ,32] | min}} # 0 -rpl_semi_sync_master_enabled =1 # 0 -rpl_semi_sync_slave_enabled =1 # 0 -rpl_semi_sync_master_timeout =1000 # 1000(1 second) -binlog_group_commit_sync_delay =500 # 0 500(0.05% seconde) +skip_slave_start = OFF # +relay_log = {{ relaylog_dir }}/relay-bin +relay_log_recovery = ON +master_info_repository = TABLE # file +relay_log_info_repository = TABLE # file +slave_parallel_type = LOGICAL_CLOCK # database | LOGICAL_CLOCK +slave_parallel_workers = {{[(server_specs_processor_count |int) * 4 ,32] | min}} # 0 +rpl_semi_sync_master_enabled = ON # 0 +rpl_semi_sync_slave_enabled = ON # 0 +rpl_semi_sync_master_timeout = 1000 # 1000(1 second) +binlog_group_commit_sync_delay = 500 # 0 500(0.05% seconde) binlog_group_commit_sync_no_delay_count = 13 # 0 {% if use_write_set == 1 %} binlog_transaction_dependency_tracking = WRITESET # COMMIT_ORDER @@ -90,65 +90,65 @@ transaction_write_set_extraction = XXHASH64 ####: for innodb -default_storage_engine =innodb # innodb -default_tmp_storage_engine =innodb # innodb -innodb_data_file_path =ibdata1:64M:autoextend # ibdata1:12M:autoextend -innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend -innodb_buffer_pool_filename =ib_buffer_pool # ib_buffer_pool -innodb_log_group_home_dir ={{ redolog_dir }} # ./ -innodb_log_files_in_group ={{ mysql57_innodb_log_files_in_group }} # 2 -innodb_log_file_size ={{ mysql57_innodb_log_file_size }} # 50331648(48M) -innodb_file_per_table =on # on -innodb_online_alter_log_max_size =128M # 134217728(128M) -innodb_open_files ={{mysql_innodb_open_files}} # 2000 -innodb_page_size =16k # 16384(16k) -innodb_thread_concurrency =0 # 0 -innodb_read_io_threads =4 # 4 -innodb_write_io_threads =4 # 4 -innodb_purge_threads =4 # 4(garbage collection) -innodb_page_cleaners =4 # 4(flush lru list) -innodb_print_all_deadlocks =on # off -innodb_deadlock_detect =on # on -innodb_lock_wait_timeout =50 # 50 -innodb_spin_wait_delay =6 # 6 -innodb_autoinc_lock_mode =2 # 1 -innodb_io_capacity =200 # 200 -innodb_io_capacity_max =2000 # 2000 +default_storage_engine = INNODB # innodb +default_tmp_storage_engine = INNODB # innodb +innodb_data_file_path = ibdata1:64M:autoextend # ibdata1:12M:autoextend +innodb_temp_data_file_path = ibtmp1:12M:autoextend # ibtmp1:12M:autoextend +innodb_buffer_pool_filename = ib_buffer_pool # ib_buffer_pool +innodb_log_group_home_dir = {{ redolog_dir }} # ./ +innodb_log_files_in_group = {{ mysql57_innodb_log_files_in_group }} # 2 +innodb_log_file_size = {{ mysql57_innodb_log_file_size }} # 50331648(48M) +innodb_file_per_table = ON # on +innodb_online_alter_log_max_size = 128M # 134217728(128M) +innodb_open_files = {{mysql_innodb_open_files}} # 2000 +innodb_page_size = 16K # 16384(16k) +innodb_thread_concurrency = 0 # 0 +innodb_read_io_threads = 4 # 4 +innodb_write_io_threads = 4 # 4 +innodb_purge_threads = 4 # 4(garbage collection) +innodb_page_cleaners = 4 # 4(flush lru list) +innodb_print_all_deadlocks = ON # off +innodb_deadlock_detect = ON # on +innodb_lock_wait_timeout = 50 # 50 +innodb_spin_wait_delay = 6 # 6 +innodb_autoinc_lock_mode = 2 # 1 +innodb_io_capacity = 200 # 200 +innodb_io_capacity_max = 2000 # 2000 #--------Persistent Optimizer Statistics -innodb_stats_auto_recalc =on # on -innodb_stats_persistent =on # on -innodb_stats_persistent_sample_pages =20 # 20 +innodb_stats_auto_recalc = ON # on +innodb_stats_persistent = ON # on +innodb_stats_persistent_sample_pages = 20 # 20 {# -- set innodb_buffer_pool_instances -- #} {% if ((server_specs_memtotal_gb | int ) * 0.6 ) < 64 %} -innodb_buffer_pool_instances ={{ [ (((server_specs_memtotal_gb | int ) * 0.6) | round(0, 'ceil') | int ) , 1 ] | max }} +innodb_buffer_pool_instances = {{ [ (((server_specs_memtotal_gb | int ) * 0.6) | round(0, 'ceil') | int ) , 1 ] | max }} {% else %} -innodb_buffer_pool_instances =64 +innodb_buffer_pool_instances = 64 {% endif %} {# -- set innodb_buffer_pool_instances -- #} -innodb_adaptive_hash_index =on # on -innodb_change_buffering =all # all -innodb_change_buffer_max_size =25 # 25 -innodb_flush_neighbors =1 # 1 +innodb_adaptive_hash_index = ON # on +innodb_change_buffering = ALL # all +innodb_change_buffer_max_size = 25 # 25 +innodb_flush_neighbors = 1 # 1 #innodb_flush_method = # -innodb_doublewrite =on # on -innodb_log_buffer_size ={{mysql_innodb_log_buffer_size}} # 16777216(16M) -innodb_flush_log_at_timeout =1 # 1 -innodb_flush_log_at_trx_commit =1 # 1 -innodb_buffer_pool_size ={{ ((server_specs_memtotal_gb | int ) * 1024 * 0.6 // 128 * 128 ) | round(0, 'ceil') | int }}M # 134217728(128M) -autocommit =1 # 1 +innodb_doublewrite = ON # on +innodb_log_buffer_size = {{mysql_innodb_log_buffer_size}} # 16777216(16M) +innodb_flush_log_at_timeout = 1 # 1 +innodb_flush_log_at_trx_commit = 1 # 1 +innodb_buffer_pool_size = {{ ((server_specs_memtotal_gb | int ) * 1024 * 0.6 // 128 * 128 ) | round(0, 'ceil') | int }}M # 134217728(128M) +autocommit = ON # 1 #--------innodb scan resistant -innodb_old_blocks_pct =37 # 37 -innodb_old_blocks_time =1000 # 1000 +innodb_old_blocks_pct = 37 # 37 +innodb_old_blocks_time = 1000 # 1000 #--------innodb read ahead -innodb_read_ahead_threshold =56 # 56 (0..64) -innodb_random_read_ahead =OFF # OFF +innodb_read_ahead_threshold = 56 # 56 (0..64) +innodb_random_read_ahead = OFF # OFF #--------innodb buffer pool state -innodb_buffer_pool_dump_pct =25 # 25 -innodb_buffer_pool_dump_at_shutdown =ON # ON -innodb_buffer_pool_load_at_startup =ON # ON +innodb_buffer_pool_dump_pct = 25 # 25 +innodb_buffer_pool_dump_at_shutdown = ON # ON +innodb_buffer_pool_load_at_startup = ON # ON #--------undo log -innodb_undo_log_truncate = 1 # 0 +innodb_undo_log_truncate = ON # 0 innodb_max_undo_log_size = 2G # 1G #innodb_undo_logs = 128 # 128 innodb_undo_tablespaces = 2 # 0 @@ -164,47 +164,47 @@ default_time_zone = {{ mysql_default_time_zone }} {% if mtls_with_mysql_group_replication == 1 %} ####: for mysql group replication -loose-group_replication_recovery_retry_count =10 # 10 -loose-group_replication_recovery_reconnect_interval =60 # 60 -loose-group_replication_allow_local_disjoint_gtids_join=off # off -loose-group_replication_allow_local_lower_version_join=off # off -loose-group_replication_ip_whitelist =AUTOMATIC # AUTOMATIC -loose-transaction_write_set_extraction =XXHASH64 # off -loose-group_replication_group_name ="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" # -loose-group_replication_start_on_boot =off # off -loose-group_replication_bootstrap_group =off # off -loose-group_replication_single_primary_mode =on # on -loose-group_replication_enforce_update_everywhere_checks=off -loose-group_replication_gtid_assignment_block_size =1000000 # 1000000 -loose-group_replication_poll_spin_loops =0 # 0 -loose-group_replication_compression_threshold =1024 # 1000000 -loose-group_replication_flow_control_mode =QUOTA # QUOTA +loose-group_replication_recovery_retry_count = 10 # 10 +loose-group_replication_recovery_reconnect_interval = 60 # 60 +loose-group_replication_allow_local_disjoint_gtids_join = OFF # off +loose-group_replication_allow_local_lower_version_join = OFF # off +loose-group_replication_ip_whitelist = AUTOMATIC # AUTOMATIC +loose-transaction_write_set_extraction = XXHASH64 # off +loose-group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" # +loose-group_replication_start_on_boot = OFF # off +loose-group_replication_bootstrap_group = OFF # off +loose-group_replication_single_primary_mode = ON # on +loose-group_replication_enforce_update_everywhere_checks = OFF +loose-group_replication_gtid_assignment_block_size = 1000000 # 1000000 +loose-group_replication_poll_spin_loops = 0 # 0 +loose-group_replication_compression_threshold = 1024 # 1000000 +loose-group_replication_flow_control_mode = QUOTA # QUOTA {% for ip in ansible_all_ipv4_addresses %} {%- for host_ip in mysql_mgr_hosts %} {%- if ip == host_ip %} -loose-group_replication_local_address ="{{ip}}:{{mysql_mgr_port}}" +loose-group_replication_local_address = "{{ip}}:{{mysql_mgr_port}}" {%- endif %} {%- endfor %} {% endfor %} {% set gs = ':' + (mysql_mgr_port | string)+',' %} -loose-group_replication_group_seeds ="{{ mysql_mgr_hosts | join(gs) + ':' + (mysql_mgr_port | string) }}" +loose-group_replication_group_seeds = "{{ mysql_mgr_hosts | join(gs) + ':' + (mysql_mgr_port | string) }}" {% endif %} #### for performance_schema -performance_schema =on # on -performance_schema_consumer_global_instrumentation =on # on -performance_schema_consumer_thread_instrumentation =on # on -performance_schema_consumer_events_stages_current =on # off -performance_schema_consumer_events_stages_history =on # off -performance_schema_consumer_events_stages_history_long =off # off -performance_schema_consumer_statements_digest =on # on -performance_schema_consumer_events_statements_current =on # on -performance_schema_consumer_events_statements_history =on # on -performance_schema_consumer_events_statements_history_long =off # off -performance_schema_consumer_events_waits_current =on # off -performance_schema_consumer_events_waits_history =on # off -performance_schema_consumer_events_waits_history_long =off # off -performance-schema-instrument ='memory/%=COUNTED' +performance_schema = ON # on +performance_schema_consumer_global_instrumentation = ON # on +performance_schema_consumer_thread_instrumentation = ON # on +performance_schema_consumer_events_stages_current = ON # off +performance_schema_consumer_events_stages_history = ON # off +performance_schema_consumer_events_stages_history_long = OFF # off +performance_schema_consumer_statements_digest = ON # on +performance_schema_consumer_events_statements_current = ON # on +performance_schema_consumer_events_statements_history = ON # on +performance_schema_consumer_events_statements_history_long = OFF # off +performance_schema_consumer_events_waits_current = ON # off +performance_schema_consumer_events_waits_history = ON # off +performance_schema_consumer_events_waits_history_long = OFF # off +performance-schema-instrument = 'memory/%=COUNTED' diff --git a/mysql_ansible/roles/mysql_server/templates/5.7/percona-my.cnf.j2 b/mysql_ansible/roles/mysql_server/templates/5.7/percona-my.cnf.j2 index 81e315eaceecad01c90fedc87d1eafc8f6874eb2..16f5b6dc6ce9f5ce29630210ccadbbe53893d44d 100644 --- a/mysql_ansible/roles/mysql_server/templates/5.7/percona-my.cnf.j2 +++ b/mysql_ansible/roles/mysql_server/templates/5.7/percona-my.cnf.j2 @@ -3,85 +3,85 @@ auto-rehash [mysqld] ####: for global -user ={{ mysql_user }} # mysql +user = {{ mysql_user }} # mysql basedir = {{ mysql_software_dir }} # /usr/local/mysql/ datadir = {{ datadir }} # /usr/local/mysql/data tmpdir = {{ tmpdir }} -server_id ={{ mysql_server_id }} # 0 -port ={{ mysql_port }} # 3306 -character_set_server ={{ mysql_character_set_server }} # latin1 -log_bin_trust_function_creators =on # 0 -max_prepared_stmt_count =1048576 -log_timestamps =system # utc -read_only =0 # off -skip_name_resolve =1 # 0 -auto_increment_increment =1 # 1 -auto_increment_offset =1 # 1 -lower_case_table_names =1 # 0 -secure_file_priv = # null -open_files_limit =65536 # 1024 -max_connections ={{mysql_max_connections | default(1000)}} -thread_cache_size ={{ [(server_specs_processor_count|int) * 8,256] | max}} # 9 -table_open_cache =4096 # 2000 -table_definition_cache =2000 # 1400 -table_open_cache_instances =32 # 16 -local_infile =off # on -disabled_storage_engines=archive,blackhole,example,federated,memory,merge,ndb +server_id = {{ mysql_server_id }} # 0 +port = {{ mysql_port }} # 3306 +character_set_server = {{ mysql_character_set_server }} # latin1 +log_bin_trust_function_creators = ON # 0 +max_prepared_stmt_count = 1048576 +log_timestamps = SYSTEM # utc +read_only = OFF # off +skip_name_resolve = ON # 0 +auto_increment_increment = 1 # 1 +auto_increment_offset = 1 # 1 +lower_case_table_names = 1 # 0 +secure_file_priv = # null +open_files_limit = 65536 # 1024 +max_connections = {{mysql_max_connections | default(1000)}} +thread_cache_size = {{ [(server_specs_processor_count|int) * 8,256] | max}} # 9 +table_open_cache = 4096 # 2000 +table_definition_cache = 2000 # 1400 +table_open_cache_instances = 32 # 16 +local_infile = OFF # on +disabled_storage_engines = archive,blackhole,example,federated,memory,merge,ndb plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so;validate_password=validate_password.so" -pid_file=mysqld.pid -transaction_isolation ={{ mysql_transaction_isolation }} #RR -socket = {{ socket }} # /tmp/mysql.sock +pid_file = mysqld.pid +transaction_isolation = {{ mysql_transaction_isolation }} #RR +socket = {{ socket }} # /tmp/mysql.sock ####: for binlog -binlog_format ={{mysql_binlog_format}} # row -binlog_error_action =abort_server # abort_server -log_bin ={{ binlog_dir }}/mysql-bin # off -binlog_rows_query_log_events =on # off -log_slave_updates =on # off -expire_logs_days =8 # 0 +binlog_format = {{mysql_binlog_format}} # row +binlog_error_action = ABORT_SERVER # abort_server +log_bin = {{ binlog_dir }}/mysql-bin # off +binlog_rows_query_log_events = ON # off +log_slave_updates = ON # off +expire_logs_days = 8 # 0 {# set binlog cache size #} {% if mysql_binlog_format == 'mixed' %} -binlog_cache_size =32768 # 32768(32k) +binlog_cache_size = 32768 # 32768(32k) {% else %} -binlog_cache_size =65536 # 65536(64k) +binlog_cache_size = 65536 # 65536(64k) {% endif %} {# set binlog cache size #} -binlog_checksum =CRC32 # CRC32 -sync_binlog =1 # 1 -slave_preserve_commit_order =ON # OFF +binlog_checksum = CRC32 # CRC32 +sync_binlog = 1 # 1 +slave_preserve_commit_order = ON # OFF ####: for error-log -log_error ={{ errlog_dir }}/error.log # /usr/local/mysql/data/localhost.localdomain.err +log_error = {{ errlog_dir }}/error.log # /usr/local/mysql/data/localhost.localdomain.err {# set general log #} -general_log =off # off -general_log_file ={{ generallog_dir }}/general.log # hostname.log +general_log = OFF # off +general_log_file = {{ generallog_dir }}/general.log # hostname.log {# set general log #} ####: for slow query log -slow_query_log =on # off -slow_query_log_file ={{ slowlog_dir }}/slow.log # hostname-slow.log -log_queries_not_using_indexes =off # off -long_query_time =2.000000 # 10.000000 +slow_query_log = ON # off +slow_query_log_file = {{ slowlog_dir }}/slow.log # hostname-slow.log +log_queries_not_using_indexes = OFF # off +long_query_time = 2.000000 # 10.000000 ####: for gtid -gtid_executed_compression_period =1000 # 1000 -gtid_mode =on # off -enforce_gtid_consistency =on # off +gtid_executed_compression_period = 1000 # 1000 +gtid_mode = ON # off +enforce_gtid_consistency = ON # off ####: for replication -skip_slave_start =0 # -relay_log ={{ relaylog_dir }}/relay-bin -relay_log_recovery=1 -master_info_repository =table # file -relay_log_info_repository =table # file -slave_parallel_type =logical_clock # database | LOGICAL_CLOCK -slave_parallel_workers ={{[(server_specs_processor_count |int) * 4 ,32] | min}} # 0 -rpl_semi_sync_master_enabled =1 # 0 -rpl_semi_sync_slave_enabled =1 # 0 -rpl_semi_sync_master_timeout =1000 # 1000(1 second) -binlog_group_commit_sync_delay =500 # 0 500(0.05% seconde) +skip_slave_start = OFF # +relay_log = {{ relaylog_dir }}/relay-bin +relay_log_recovery = ON +master_info_repository = TABLE # file +relay_log_info_repository = TABLE # file +slave_parallel_type = LOGICAL_CLOCK # database | LOGICAL_CLOCK +slave_parallel_workers = {{[(server_specs_processor_count |int) * 4 ,32] | min}} # 0 +rpl_semi_sync_master_enabled = ON # 0 +rpl_semi_sync_slave_enabled = ON # 0 +rpl_semi_sync_master_timeout = 1000 # 1000(1 second) +binlog_group_commit_sync_delay = 500 # 0 500(0.05% seconde) binlog_group_commit_sync_no_delay_count = 13 # 0 {% if use_write_set == 1 %} binlog_transaction_dependency_tracking = WRITESET # COMMIT_ORDER @@ -90,65 +90,65 @@ transaction_write_set_extraction = XXHASH64 ####: for innodb -default_storage_engine =innodb # innodb -default_tmp_storage_engine =innodb # innodb -innodb_data_file_path =ibdata1:64M:autoextend # ibdata1:12M:autoextend -innodb_temp_data_file_path =ibtmp1:12M:autoextend # ibtmp1:12M:autoextend -innodb_buffer_pool_filename =ib_buffer_pool # ib_buffer_pool -innodb_log_group_home_dir ={{ redolog_dir }} # ./ -innodb_log_files_in_group ={{ mysql57_innodb_log_files_in_group }} # 2 -innodb_log_file_size ={{ mysql57_innodb_log_file_size }} # 50331648(48M) -innodb_file_per_table =on # on -innodb_online_alter_log_max_size =128M # 134217728(128M) -innodb_open_files ={{mysql_innodb_open_files}} # 2000 -innodb_page_size =16k # 16384(16k) -innodb_thread_concurrency =0 # 0 -innodb_read_io_threads =4 # 4 -innodb_write_io_threads =4 # 4 -innodb_purge_threads =4 # 4(garbage collection) -innodb_page_cleaners =4 # 4(flush lru list) -innodb_print_all_deadlocks =on # off -innodb_deadlock_detect =on # on -innodb_lock_wait_timeout =50 # 50 -innodb_spin_wait_delay =6 # 6 -innodb_autoinc_lock_mode =2 # 1 -innodb_io_capacity =200 # 200 -innodb_io_capacity_max =2000 # 2000 +default_storage_engine = INNODB # innodb +default_tmp_storage_engine = INNODB # innodb +innodb_data_file_path = ibdata1:64M:autoextend # ibdata1:12M:autoextend +innodb_temp_data_file_path = ibtmp1:12M:autoextend # ibtmp1:12M:autoextend +innodb_buffer_pool_filename = ib_buffer_pool # ib_buffer_pool +innodb_log_group_home_dir = {{ redolog_dir }} # ./ +innodb_log_files_in_group = {{ mysql57_innodb_log_files_in_group }} # 2 +innodb_log_file_size = {{ mysql57_innodb_log_file_size }} # 50331648(48M) +innodb_file_per_table = ON # on +innodb_online_alter_log_max_size = 128M # 134217728(128M) +innodb_open_files = {{mysql_innodb_open_files}} # 2000 +innodb_page_size = 16K # 16384(16k) +innodb_thread_concurrency = 0 # 0 +innodb_read_io_threads = 4 # 4 +innodb_write_io_threads = 4 # 4 +innodb_purge_threads = 4 # 4(garbage collection) +innodb_page_cleaners = 4 # 4(flush lru list) +innodb_print_all_deadlocks = ON # off +innodb_deadlock_detect = ON # on +innodb_lock_wait_timeout = 50 # 50 +innodb_spin_wait_delay = 6 # 6 +innodb_autoinc_lock_mode = 2 # 1 +innodb_io_capacity = 200 # 200 +innodb_io_capacity_max = 2000 # 2000 #--------Persistent Optimizer Statistics -innodb_stats_auto_recalc =on # on -innodb_stats_persistent =on # on -innodb_stats_persistent_sample_pages =20 # 20 +innodb_stats_auto_recalc = ON # on +innodb_stats_persistent = ON # on +innodb_stats_persistent_sample_pages = 20 # 20 {# -- set innodb_buffer_pool_instances -- #} {% if ((server_specs_memtotal_gb | int ) * 0.6 ) < 64 %} -innodb_buffer_pool_instances ={{ [ (((server_specs_memtotal_gb | int ) * 0.6) | round(0, 'ceil') | int ) , 1 ] | max }} +innodb_buffer_pool_instances = {{ [ (((server_specs_memtotal_gb | int ) * 0.6) | round(0, 'ceil') | int ) , 1 ] | max }} {% else %} -innodb_buffer_pool_instances =64 +innodb_buffer_pool_instances = 64 {% endif %} {# -- set innodb_buffer_pool_instances -- #} -innodb_adaptive_hash_index =on # on -innodb_change_buffering =all # all -innodb_change_buffer_max_size =25 # 25 -innodb_flush_neighbors =1 # 1 +innodb_adaptive_hash_index = ON # on +innodb_change_buffering = ALL # all +innodb_change_buffer_max_size = 25 # 25 +innodb_flush_neighbors = 1 # 1 #innodb_flush_method = # -innodb_doublewrite =on # on -innodb_log_buffer_size ={{mysql_innodb_log_buffer_size}} # 16777216(16M) -innodb_flush_log_at_timeout =1 # 1 -innodb_flush_log_at_trx_commit =1 # 1 -innodb_buffer_pool_size ={{ ((server_specs_memtotal_gb | int ) * 1024 * 0.6 // 128 * 128 ) | round(0, 'ceil') | int }}M # 134217728(128M) -autocommit =1 # 1 +innodb_doublewrite = ON # on +innodb_log_buffer_size = {{mysql_innodb_log_buffer_size}} # 16777216(16M) +innodb_flush_log_at_timeout = 1 # 1 +innodb_flush_log_at_trx_commit = 1 # 1 +innodb_buffer_pool_size = {{ ((server_specs_memtotal_gb | int ) * 1024 * 0.6 // 128 * 128 ) | round(0, 'ceil') | int }}M # 134217728(128M) +autocommit = ON # 1 #--------innodb scan resistant -innodb_old_blocks_pct =37 # 37 -innodb_old_blocks_time =1000 # 1000 +innodb_old_blocks_pct = 37 # 37 +innodb_old_blocks_time = 1000 # 1000 #--------innodb read ahead -innodb_read_ahead_threshold =56 # 56 (0..64) -innodb_random_read_ahead =OFF # OFF +innodb_read_ahead_threshold = 56 # 56 (0..64) +innodb_random_read_ahead = OFF # OFF #--------innodb buffer pool state -innodb_buffer_pool_dump_pct =25 # 25 -innodb_buffer_pool_dump_at_shutdown =ON # ON -innodb_buffer_pool_load_at_startup =ON # ON +innodb_buffer_pool_dump_pct = 25 # 25 +innodb_buffer_pool_dump_at_shutdown = ON # ON +innodb_buffer_pool_load_at_startup = ON # ON #--------undo log -innodb_undo_log_truncate = 1 # 0 +innodb_undo_log_truncate = ON # 0 innodb_max_undo_log_size = 2G # 1G #innodb_undo_logs = 128 # 128 innodb_undo_tablespaces = 2 # 0 @@ -164,57 +164,57 @@ default_time_zone = {{ mysql_default_time_zone }} {% if mtls_with_mysql_group_replication == 1 %} ####: for mysql group replication -loose-group_replication_recovery_retry_count =10 # 10 -loose-group_replication_recovery_reconnect_interval =60 # 60 -loose-group_replication_allow_local_disjoint_gtids_join=off # off -loose-group_replication_allow_local_lower_version_join=off # off -loose-group_replication_ip_whitelist =AUTOMATIC # AUTOMATIC -loose-transaction_write_set_extraction =XXHASH64 # off -loose-group_replication_group_name ="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" # -loose-group_replication_start_on_boot =off # off -loose-group_replication_bootstrap_group =off # off -loose-group_replication_single_primary_mode =on # on -loose-group_replication_enforce_update_everywhere_checks=off -loose-group_replication_gtid_assignment_block_size =1000000 # 1000000 -loose-group_replication_poll_spin_loops =0 # 0 -loose-group_replication_compression_threshold =1024 # 1000000 -loose-group_replication_flow_control_mode =QUOTA # QUOTA +loose-group_replication_recovery_retry_count = 10 # 10 +loose-group_replication_recovery_reconnect_interval = 60 # 60 +loose-group_replication_allow_local_disjoint_gtids_join = OFF # off +loose-group_replication_allow_local_lower_version_join = OFF # off +loose-group_replication_ip_whitelist = AUTOMATIC # AUTOMATIC +loose-transaction_write_set_extraction = XXHASH64 # off +loose-group_replication_group_name = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" # +loose-group_replication_start_on_boot = OFF # off +loose-group_replication_bootstrap_group = OFF # off +loose-group_replication_single_primary_mode = ON # on +loose-group_replication_enforce_update_everywhere_checks = OFF +loose-group_replication_gtid_assignment_block_size = 1000000 # 1000000 +loose-group_replication_poll_spin_loops = 0 # 0 +loose-group_replication_compression_threshold = 1024 # 1000000 +loose-group_replication_flow_control_mode = QUOTA # QUOTA {% for ip in ansible_all_ipv4_addresses %} {%- for host_ip in mysql_mgr_hosts %} {%- if ip == host_ip %} -loose-group_replication_local_address ="{{ip}}:{{mysql_mgr_port}}" +loose-group_replication_local_address = "{{ip}}:{{mysql_mgr_port}}" {%- endif %} {%- endfor %} {% endfor %} {% set gs = ':' + (mysql_mgr_port | string)+',' %} -loose-group_replication_group_seeds ="{{ mysql_mgr_hosts | join(gs) + ':' + (mysql_mgr_port | string) }}" +loose-group_replication_group_seeds = "{{ mysql_mgr_hosts | join(gs) + ':' + (mysql_mgr_port | string) }}" {% endif %} #### for performance_schema -performance_schema =on # on -performance_schema_consumer_global_instrumentation =on # on -performance_schema_consumer_thread_instrumentation =on # on -performance_schema_consumer_events_stages_current =on # off -performance_schema_consumer_events_stages_history =on # off -performance_schema_consumer_events_stages_history_long =off # off -performance_schema_consumer_statements_digest =on # on -performance_schema_consumer_events_statements_current =on # on -performance_schema_consumer_events_statements_history =on # on -performance_schema_consumer_events_statements_history_long =off # off -performance_schema_consumer_events_waits_current =on # off -performance_schema_consumer_events_waits_history =on # off -performance_schema_consumer_events_waits_history_long =off # off -performance-schema-instrument ='memory/%=COUNTED' +performance_schema = ON # on +performance_schema_consumer_global_instrumentation = ON # on +performance_schema_consumer_thread_instrumentation = ON # on +performance_schema_consumer_events_stages_current = ON # off +performance_schema_consumer_events_stages_history = ON # off +performance_schema_consumer_events_stages_history_long = OFF # off +performance_schema_consumer_statements_digest = ON # on +performance_schema_consumer_events_statements_current = ON # on +performance_schema_consumer_events_statements_history = ON # on +performance_schema_consumer_events_statements_history_long = OFF # off +performance_schema_consumer_events_waits_current = ON # off +performance_schema_consumer_events_waits_history = ON # off +performance_schema_consumer_events_waits_history_long = OFF # off +performance-schema-instrument = 'memory/%=COUNTED' #percona special plugin_load = "rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisync_slave.so;validate_password=validate_password.so;audit_log.so" -loose-audit_log_file='{{ auditlog_dir }}/audit.log' -loose-audit_log_rotations=99 -loose-audit_log_rotate_on_size=1G -loose-audit_log_include_databases='test' -loose-audit_log_policy='QUERIES' -loose-audit_log_include_commands='create_table,delete,drop_table,alter_table,create_db,drop_db,set_option' +loose-audit_log_file = '{{ auditlog_dir }}/audit.log' +loose-audit_log_rotations = 99 +loose-audit_log_rotate_on_size = 1G +loose-audit_log_include_databases = 'test' +loose-audit_log_policy = 'QUERIES' +loose-audit_log_include_commands = 'create_table,delete,drop_table,alter_table,create_db,drop_db,set_option' diff --git a/mysql_ansible/roles/mysql_server/templates/8.0/my.cnf.j2 b/mysql_ansible/roles/mysql_server/templates/8.0/my.cnf.j2 index fa99df70171edade61e94c21f41255bbd9babdcd..37721c7182db82e8e0b95e40bc24dcc90be1da25 100644 --- a/mysql_ansible/roles/mysql_server/templates/8.0/my.cnf.j2 +++ b/mysql_ansible/roles/mysql_server/templates/8.0/my.cnf.j2 @@ -54,8 +54,8 @@ slave_preserve_commit_order =ON # OFF ####: for error-log log_error = {{ errlog_dir }}/error.log # hostname.err +general_log =off # off general_log_file = {{ generallog_dir }}/general.log # hostname.log -general_log_file =general.log # hostname.log ####: for slow query log slow_query_log =on # off diff --git a/mysql_ansible/roles/mysql_server/templates/secure.sql.j2 b/mysql_ansible/roles/mysql_server/templates/secure.sql.j2 index ea57a1a68072aeecb3ea757bc7adbc5c996a64f9..09dd290b7c630400c404e00b1da10bdf3c0328ad 100644 --- a/mysql_ansible/roles/mysql_server/templates/secure.sql.j2 +++ b/mysql_ansible/roles/mysql_server/templates/secure.sql.j2 @@ -3,7 +3,15 @@ set sql_log_bin=0; flush privileges; alter user {{ mysql_admin_user }}@'localhost' identified by '{{ mysql_admin_password }}' ; create user {{ mysql_admin_user }}@'127.0.0.1' identified by '{{ mysql_admin_127_password }}' ; + {% if mysql_version.startswith('8.4') and db_type == 'mysql' %} grant all on *.* to {{ mysql_admin_user }}@'127.0.0.1' with grant option; + grant all on *.* to {{ mysql_admin_user }}@'localhost' with grant option; + grant SYSTEM_USER on *.* to {{ mysql_admin_user }}@'127.0.0.1'; + grant SYSTEM_USER on *.* to {{ mysql_admin_user }}@'localhost'; + {% else %} + grant all on *.* to {{ mysql_admin_user }}@'127.0.0.1' with grant option; + grant all on *.* to {{ mysql_admin_user }}@'localhost' with grant option; + {% endif %} {% if mysql_version.startswith('8.4') %} INSTALL COMPONENT 'file://component_validate_password'; {% endif %} diff --git a/mysql_ansible/roles/pre_check_and_set/filter_plugins/__pycache__/path_filters.cpython-39.pyc b/mysql_ansible/roles/pre_check_and_set/filter_plugins/__pycache__/path_filters.cpython-39.pyc index a78e31def90e2b34bb14498bb3f0bfba7921973c..70fe95d10a8fc44c1c205a832f83c02403911eb8 100644 Binary files a/mysql_ansible/roles/pre_check_and_set/filter_plugins/__pycache__/path_filters.cpython-39.pyc and b/mysql_ansible/roles/pre_check_and_set/filter_plugins/__pycache__/path_filters.cpython-39.pyc differ