Linux

Posted 记录每天

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux相关的知识,希望对你有一定的参考价值。

09:15:24(root@localhost) [(none)]> show variables like "%innodb%";

#1> 事务日志性能优化
09:17:44(root@localhost) [(none)]> set global innodb_flush_log_at_trx_commit=2;
Query OK, 0 rows affected (0.00 sec)

#2>错误日志
09:18:34(root@localhost) [(none)]> show variables like "%log_error%";
+---------------------+-----------------------+
| Variable_name       | Value                 |
+---------------------+-----------------------+
| binlog_error_action | ABORT_SERVER          |
| log_error           | /data/mysql/mysql.log |
| log_error_verbosity | 3                     |
+---------------------+-----------------------+

#3>通用日志
09:21:39(root@localhost) [(none)]> show variables like "%general_log%";
+------------------+-------------------------+
| Variable_name    | Value                   |
+------------------+-------------------------+
| general_log      | OFF                     |
| general_log_file | /data/mysql/centos7.log |
+------------------+-------------------------+
2 rows in set (0.00 sec)

09:22:19(root@localhost) [(none)]> set global general_log=on;
Query OK, 0 rows affected (0.03 sec)

09:22:35(root@localhost) [(none)]> show variables like "%general_log%";
+------------------+-------------------------+
| Variable_name    | Value                   |
+------------------+-------------------------+
| general_log      | ON                      |
| general_log_file | /data/mysql/centos7.log |
+------------------+-------------------------+
2 rows in set (0.01 sec)
09:22:37(root@localhost) [(none)]> show variables like "%log_out%";
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_output    | FILE  |
+---------------+-------+
1 row in set (0.01 sec)

3> 慢查询日志
slow_query_log=ON|OFF #开启或关闭慢查询,支持全局和会话,只有全局设置才会生成慢查询文件 
long_query_time=N #慢查询的阀值,单位秒 

slow_query_log_file=HOSTNAME-slow.log  #慢查询日志文件 

log_slow_filter =admin,filesort,filesort_on_disk,full_join,full_scan, query_cache,query_cache_miss,tmp_table,tmp_table_on_disk  #上述查询类型且查询时长超过long_query_time,则记录日志 

log_queries_not_using_indexes=ON  #不使用索引或使用全索引扫描,不论是否达到慢查询阀值的语 句是否记录日志,默认OFF,即不记录 

log_slow_rate_limit = 1 #多少次查询才记录,mariadb特有 

log_slow_verbosity= Query_plan,explain #记录内容 

log_slow_queries = OFF    #同slow_query_log,MariaDB 10.0/MySQL 5.6.1 版后已删除

4> 二进制日志

09:27:37(root@localhost) [(none)]> show variables like "%binlog%";
+--------------------------------------------+----------------------+
| Variable_name                              | Value                |
+--------------------------------------------+----------------------+
| binlog_cache_size                          | 32768                |
| binlog_checksum                            | CRC32                |
| binlog_direct_non_transactional_updates    | OFF                  |
| binlog_error_action                        | ABORT_SERVER         |
| binlog_format                              | ROW                  |
| binlog_group_commit_sync_delay             | 0                    |
| binlog_group_commit_sync_no_delay_count    | 0                    |
| binlog_gtid_simple_recovery                | ON                   |
| binlog_max_flush_queue_time                | 0                    |
| binlog_order_commits                       | ON                   |
| binlog_row_image                           | FULL                 |
| binlog_rows_query_log_events               | OFF                  |
| binlog_stmt_cache_size                     | 32768                |
| binlog_transaction_dependency_history_size | 25000                |
| binlog_transaction_dependency_tracking     | COMMIT_ORDER         |
| innodb_api_enable_binlog                   | OFF                  |
| innodb_locks_unsafe_for_binlog             | OFF                  |
| log_statements_unsafe_for_binlog           | ON                   |
| max_binlog_cache_size                      | 18446744073709547520 |
| max_binlog_size                            | 1073741824           |
| max_binlog_stmt_cache_size                 | 18446744073709547520 |
| sync_binlog                                | 1                    |
+--------------------------------------------+----------------------+
22 rows in set (0.00 sec)

#mixed让系统自己判断采取行还是语句判断
09:27:45(root@localhost) [(none)]> set global binlog_format=mixed;
Query OK, 0 rows affected (0.00 sec)

 

以上是关于Linux的主要内容,如果未能解决你的问题,请参考以下文章

linux打开终端如何启动scala,如何在终端下运行Scala代码片段?

Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段

linux中怎么查看mysql数据库版本

-bash: /usr/bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory(代码片段

text Debian linux片段

markdown 我的linux片段为RHCSA