• 14.7.1 重新调整InnoDB系统表空间的大小


    一、增加系统表空间的大小

    (一)操作步骤:

    1.停止服务

    2.查看表空间物理文件大小,修改my.cnf文件,将原表空间文件大小调整为当前物理文件大小,以MB为单位

    3.在变量innodb_data_file_path后面追加一个数据文件,大小随意,并设置成自动扩展

    4.重启服务生效

    (二)实例:

    1.my.cnf原始配置

    innodb_data_file_path = ibdata1:10M:autoextend

    物理文件大小76MB

    2.my.cnf调整后的配置

    innodb_data_file_path = ibdata1:76M;ibdata2:10M:autoextend

    (三)故障实验:

    innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend

    服务启动报如下错误

    2017-04-19 20:43:05 4570 [ERROR] InnoDB: Data file ./ibdata1 is of a different size 4864 pages (rounded down to MB) than specified in the .cnf file 640 pages!
    2017-04-19 20:43:05 4570 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
    2017-04-19 20:43:05 4570 [ERROR] Plugin 'InnoDB' init function returned error.
    2017-04-19 20:43:05 4570 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2017-04-19 20:43:05 4570 [ERROR] Unknown/unsupported storage engine: InnoDB
    2017-04-19 20:43:05 4570 [ERROR] Aborting

    二、缩小InnoDB表空间的大小

    你不能直接的删除系统表空间的物理文件,要缩小系统表空间的大小,按如下步骤操作:
    1.用mysqldump将所有的包括MySQL数据库中的InnoDB表dump出来,在5.6当前版本中,包括5张InnoDB表:
    2.停止服务.
    3.删除所有的表空间文件(*.ibd),包括ibdata和ib_log文件,MySQL数据库中的*.ibd文件也删除.
    4.删除所有的InnoDB表的.frm文件.
    5.重新设置一个新的表空间.
    6.重启服务.
    7.导入dump文件.

    实验:

    1.mysqldump -uroot -p -A > /root/all_databases_20170726.sql

    2.mysqladmin -uroot -p shutdown

    3.

    rm -fr fission_action/*
    rm -fr fission_log/*
    rm -fr mydb/*
    rm -fr fission_ha/*

    rm ibdata* -fr
    rm ib_logfile* -f

    rm -fr innodb_index_stats*
    rm -fr innodb_table_stats*
    rm -fr slave_master_info*
    rm -fr slave_relay_log_info*
    rm -fr slave_worker_info*

    4.vi my.cnf

    innodb_data_file_path = ibdata1:10M:autoextend

    5../bin/mysqld_safe --defaults-file=/etc/my.cnf &

    6.导入文件

    ERROR 1813 (HY000): Tablespace for table '`mysql`.`slave_relay_log_info`' exists. Please DISCARD the tablespace before IMPORT.

    可能原因:1.source前没有stop slave;还存在InnoDB表空间没清理干净 

    参考文档:Increasing the Size of the InnoDB System Tablespace.

  • 相关阅读:
    Hystrix熔断原理
    FeignClient Hystrix超时重试降级
    Windows上Docker Toolbox修改镜像源
    Windows10家庭版安装docker
    Class类文件结构--访问标志
    MySQL常见的七种锁详细介绍()
    maven setting.xml 阿里云镜像 没有一句废话
    mysql 批量操作,已存在则修改,不存在则insert,同时判断空选择性写入字段
    hdu5730
    3月部分题目简要题解
  • 原文地址:https://www.cnblogs.com/geek-ace/p/7239505.html
Copyright © 2020-2023  润新知