Giter VIP home page Giter VIP logo

mysql_too_large's Introduction

mysql space analysis

analysis:

1.search dbs:

concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
group by TABLE_SCHEMA
order by data_length desc;

2.search tables:

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,
concat(truncate(index_length/1024/1024,2),' MB') as index_size
from information_schema.tables where TABLE_SCHEMA = 'TestDB'
group by TABLE_NAME
order by data_length desc;
eg: TestDB

3.search binlog:

login mysql, execute: show binary logs; show log used:show master status;

resolve:

1.binlog too large

del binlog

refer: https://blog.csdn.net/weixin_33895657/article/details/92248743 used log: mysql-bin.000005, which can not be del. del binlog except of mysql-bin.000005, and release some space. use:purge binary logs to 'mysql-bin.000005';

mysql> purge binary logs to 'mysql-bin.000005';

fix my.cnf

expire_logs_days=10  # days, default 0

restart mysql.

set expire_logs_days do not restart mysql

login mysql:

show variables like '%log%';
set global expire_logs_days = 10;
show variables like '%log%';

2.index && data file

use pt-online-schema-change instead of optimize table(table will be locked) refer: https://blog.csdn.net/song634/article/details/80411064

pt-online-schema-change --user=username --password=password --host=yourhost P=yourport,D=yourdb,t=yourtable --charset=utf8 --alter="ENGINE=InnoDB" --nocheck-replication-filters --alter-foreign-keys-method=auto --execute

restart mysql

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.