怎么理解TiDB兼容MySQL参数优化-创新互联
本篇内容介绍了“怎么理解TiDB兼容MySQL参数优化”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
站在用户的角度思考问题,与客户深入沟通,找到炎陵网站设计与炎陵网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站设计、网站建设、企业官网、英文网站、手机端网站、网站推广、域名与空间、虚拟空间、企业邮箱。业务覆盖炎陵地区。默认 SQL mode 与 MySQL 已相同
TiDB 和 MySQL 5.7 中均为 ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
当前:
mysql> SELECT @@sql_mode
-> ;
+--------------------------------------------+
| @@sql_mode |
+--------------------------------------------+
| STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+--------------------------------------------+
1 row in set (0.00 sec)
mysql>
SET [ SESSION | GLOBAL ] sql_mode='modes'`;
SET GLOBAL sql_mode='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
tidb
设置大连接:
set global max_user_connections=200;
mysql> show variables like '%conn%';
+-----------------------------------------------+-----------------+
| Variable_name | Value |
+-----------------------------------------------+-----------------+
| performance_schema_session_connect_attrs_size | 512 |
| disconnect_on_expired_password | 1 |
| collation_connection | utf8_general_ci |
| character_set_connection | utf8 |
| connect_timeout | 10 |
| max_user_connections | 0 |
| max_connections | 151 |
| init_connect | |
| max_connect_errors | 100 |
+-----------------------------------------------+-----------------+
9 rows in set (0.01 sec)
mysql>
mysql> show variables like '%log%';
+------------------------------------------+------------------------------------------+
| Variable_name | Value |
+------------------------------------------+------------------------------------------+
| relay_log_space_limit | 0 |
| ndb_table_no_logging | |
| relay_log_recovery | 0 |
| log_bin | 0 |
| innodb_mirrored_log_groups | 1 |
| innodb_log_buffer_size | 8388608 |
| log_slave_updates | 0 |
| log_error | /usr/local/mysql/data/localhost.err |
| log_bin_use_v1_row_events | 0 |
| innodb_log_files_in_group | 2 |
| tidb_slow_log_threshold | 300 |
| binlog_gtid_simple_recovery | 1 |
| relay_log_info_file | relay-log.info |
| back_log | 80 |
| tidb_general_log | 0 |
| innodb_log_file_size | 50331648 |
| innodb_api_enable_binlog | 0 |
| innodb_log_group_home_dir | ./ |
| tidb_query_log_max_len | 2048 |
| log_output | FILE |
| innodb_locks_unsafe_for_binlog | 0 |
| relay_log_info_repository | FILE |
| innodb_undo_logs | 128 |
| binlog_checksum | CRC32 |
| innodb_flush_log_at_timeout | 1 |
| slow_query_log_file | /usr/local/mysql/data/localhost-slow.log |
| binlog_direct_non_transactional_updates | OFF |
| innodb_online_alter_log_max_size | 134217728 |
| log_timestamps | |
| max_binlog_stmt_cache_size | 18446744073709547520 |
| innodb_log_compressed_pages | ON |
| binlog_format | STATEMENT |
| innodb_max_undo_log_size | |
| log_queries_not_using_indexes | OFF |
| relay_log_purge | ON |
| binlog_cache_size | 32768 |
| innodb_log_checksum_algorithm | |
| ndb_log_binlog_index | |
| max_binlog_cache_size | 18446744073709547520 |
| binlog_max_flush_queue_time | 0 |
| binlog_rows_query_log_events | OFF |
| slow_query_log | OFF |
| general_log | 0 |
| max_binlog_size | 1073741824 |
| binlog_stmt_cache_size | 32768 |
| sql_log_bin | 1 |
| general_log_file | /usr/local/mysql/data/localhost.log |
| log_slow_slave_statements | OFF |
| sql_log_off | OFF |
| innodb_log_write_ahead_size | |
| log_backward_compatible_user_definitions | |
| log_syslog | |
| sync_binlog | 0 |
| binlog_group_commit_sync_delay | |
| log_syslog_include_pid | |
| binlog_order_commits | ON |
| innodb_undo_log_truncate | |
| sync_relay_log_info | 10000 |
| log_error_verbosity | |
| log_warnings | 1 |
| log_syslog_facility | |
| binlogging_impossible_mode | IGNORE_ERROR |
| ndb_log_updated_only | |
| ndb_log_empty_epochs | |
| binlog_group_commit_sync_no_delay_count | |
| innodb_flush_log_at_trx_commit | 1 |
| log_bin_trust_function_creators | OFF |
| binlog_error_action | IGNORE_ERROR |
| log_throttle_queries_not_using_indexes | 0 |
| max_relay_log_size | 0 |
| binlog_row_image | FULL |
| sync_relay_log | 10000 |
| log_slow_admin_statements | OFF |
| log_syslog_tag | |
| expire_logs_days | 0 |
+------------------------------------------+------------------------------------------+
75 rows in set (0.01 sec)
mysql>
set global max_connections=1000; #这个参数需要重启db
设置后需要重启
SET GLOBAL binlog_format = 'ROW'; #这个参数动态修改
重启服务:
停止tidb服务:
ansible-playbook stop.yml --tags=tidb
启动tidb服务:
ansible-playbook start.yml --tags=tidb
“怎么理解TiDB兼容MySQL参数优化”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注创新互联-成都网站建设公司网站,小编将为大家输出更多高质量的实用文章!
网站标题:怎么理解TiDB兼容MySQL参数优化-创新互联
本文URL:http://pwwzsj.com/article/dpjjos.html