uberhacker / shrink-ibdata1

Bash shell script to shrink /var/lib/mysql/ibdata1 and restore disk space
GNU General Public License v3.0
24 stars 8 forks source link

Nice work but.... #2

Open takenek opened 6 years ago

takenek commented 6 years ago

Nice work! Working verry good, but you miss add: [mysqld] innodb_file_per_table innodb_flush_method=O_DIRECT innodb_log_file_size=1G innodb_buffer_pool_size=4G

The best will be cat /proc/meminfo and 75% of whole ram use as innodb_buffer_pool_size and 1/4 of this as innodb_log_file_size if you know what i mean.

Best Regards TaKeN

uberhacker commented 6 years ago

Thank you for the feedback @takenek. The problem with this configuration is it assumes the database is using innodb. What if they're using myisam? Also, we cannot assume any particular memory settings since each server could be different. If you can think of a way to detect the database type and system stats automagically and provide these settings, I would definitely consider it. Submit a PR also if you would like.

utking commented 6 years ago

@uberhacker perhaps it would be enough to check the default engine (SHOW GLOBAL VARIABLES LIKE 'default_storage_engine') and we can use "free -m | grep Mem | awk '{print $2}'" to find RAM. These parameters could be used on the by-argument (-e, for instance) approach. I can create a PR