本篇内容介绍了"怎么理解TiDB兼容关系型数据库参数优化"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
默认结构化查询语言模式与关系型数据库已相同
TiDB和MySQL 5.7中均为仅_完整_分组_依据、严格_传输_表格、无_零_输入_日期、无_零_日期、错误_用于_除法_依据_零、无_自动_创建_用户、无_引擎_替换
当前:
mysql SELECT @@sql_mode
- ;
-
| @@sql_mode |
-
| STRICT_TRANS_TABLES,NO _ ENGINE _ replacement |
-
一行一组(0.00秒)
关系型数据库
SET[SESSION | GLobaL]SQL _ mode=' modes ' `;
设置全局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 _ replacement ';
tidb
设置最大连接:
设置全局max _ user _ connections=200
关系型数据库显示像“%conn%”这样的变量;
- -
|变量名|值|
- -
| performance _ schema _ session _ connect _ attrs _ size | 512
| disconnect _ on _ expired _ password | 1 |
|排序规则_连接| utf8_general_ci |
| character _ set _ connection | utf8 |
| connect_timeout | 10 |
|最大用户连接数
p; | 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参数优化”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!
内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/76889.html