MariaDB 启用页面压缩

MariaDB enabling page compression

我最近从 mysql 转移到 maria db ,我想启用 mariadb 提供的页面压缩功能,但我没有成功启用它。

https://mariadb.com/kb/en/mariadb/compression/

我做了什么

我按照上面的文档安装了 lz4 算法

我也 运行 几个命令是可以的。

SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_file_format=Barracuda;

但是当我 运行

set global innodb_compression_algorithm=lz4;

我收到错误

Unknown system variable 'innodb_compression_algorithm'

所以知道如何修复它,基本上我有 100mb 的数据库,我想压缩它

您正在试用的 MariaDB 版本是什么?页面压缩是在 MariaDB 10.1 中引入的。 more info here

这里的要点是默认情况下并非所有可用的压缩格式都被编译。您可以在此处阅读 https://mariadb.com/kb/en/mariadb/compression/

Because all of these compression methods are not available by default on all distributions and MariaDB server does not bundle them, you may need to download the desired compression method package from the above links, install the package and finally recompile MariaDB server from the source distribution with:

因此,要使用 lz4,您需要从源代码重新编译 mariadb。

尝试在 my.cnf 文件中设置

[mysqld]
innodb_compression_algorithm = lz4