ITPub博客

首页 > 数据库 > MySQL > MYSQL日志组如何调整

MYSQL日志组如何调整

原创 MySQL 作者:zhenglinsong 时间:2017-09-15 13:24:11 0 删除 编辑
1、查看关闭方式:
mysql> show variables like '%fast%';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 1     |
+----------------------+-------+
1 row in set (0.00 sec)
该参数解释如下:,默认值为1,设置为0 是干净的关闭 和ORACLE里面shutdown immeidate对应
The InnoDB shutdown mode. If the value is 0, InnoDB does a slow shutdown, a full purge and a change buffer merge before shutting down. If the value is 1 (the default), InnoDB skips these operations at shutdown, a process known as a fast shutdown. If the value is 2, InnoDB flushes its logs and shuts down cold, as if MySQL had crashed; no committed transactions are lost, but the crash recovery operation makes the next startup take longer.。
2、 调整参数innodb_fast_shutdown为0
set global innodb_fast_shutdown=0
3、 关闭MYSQL
       mysqladmin -uroot  shutdown -S /home/mysql-5.6/mysql-3306/mysql.sock
4、 调整REDO大小,日志文件默认命名是ib_logfile开头
1、 找到REDO文件所在目录(有几个文件处理几个,移动到其他目录)。
mv ib_logfilexx   ../ ib_logfilexx
2、 添加参数:日志组个数和日志大小到参数文件
在参数文件[mysqld]下面添加如下参数
innodb_log_file_size = 512M –每个日志组大小512M
innodb_log_files_in_group = 3—一共3组日志组
5、    打开mysql
    ./mysqld_safe   --defaults-file=/home/mysql-5.6/mysql-3307/my.cnf  &
 
6、 查看修改后的日志组大小和个数
          
mysql> show variables like '%log_file%';
+---------------------------+------------------------------------------------+
| Variable_name             | Value                                          |
+---------------------------+------------------------------------------------+
| general_log_file          | /home/mysql-5.6/mysql-3306/data/test1.log      |
| innodb_log_file_size      | 536870912                                      |
| innodb_log_files_in_group | 3                                              |
| slow_query_log_file       | /home/mysql-5.6/mysql-3306/data/test1-slow.log |
+---------------------------+------------------------------------------------+
4 rows in set (0.00 sec)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31134212/viewspace-2145029/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: MYSQL外键的坏处
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2016-04-21

  • 博文量
    29
  • 访问量
    41415