Installing MariaDB 10 on Ubuntu 14.04 with TokuDB Support

on

MariaDB is a fork and drop-in replacement for MySQL, that brings many improvements over its predecessor.

In this tutorial, I’ll show you how to install the latest MariaDB 10, and enable TokuDB support on Ubuntu 14.04 LTS. TokuDB is a high-performance storage engine for MySQL which, based on my personal experience, can be faster and achieve better compression rates than InnoDB.

If you are not happy with the download mirror that I chose for this tutorial, you can visit the MariaDB download page, and simply select another one.

  1. Install MariaDB.
    sudo apt-get install software-properties-common
    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
    sudo add-apt-repository 'deb http://lon1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main'
    sudo apt-get update && sudo apt-get install mariadb-server
    
  2. Check that MariaDB was successfully installed:
    mysql --version
    mysql  Ver 15.1 Distrib 10.0.21-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
    
  3. Enable the TokuDB plugin by inserting this line in /etc/mysql/conf.d/tokudb.cnf:
    plugin-load-add=ha_tokudb.so
    
  4. Restart MariaDB:
    sudo service mysql restart
    

If after restarting you get the following error message in the MariaDB error log (/var/log/mysql.err):

[ERROR] TokuDB will not run with transparent huge pages enabled.

Check /sys/kernel/mm/transparent_hugepage/enabled:

cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

If the always option is selected like above, then you will need to disable Transparent Hugepages on your computer.

  1. Edit /etc/rc.local and before the exit 0 line insert:
    if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
            echo never > /sys/kernel/mm/transparent_hugepage/enabled
    fi
    if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
            echo never > /sys/kernel/mm/transparent_hugepage/defrag
    fi
    
  2. Reboot your computer.

Check again /sys/kernel/mm/transparent_hugepage/enabled to verify that Transparent Hugepages have been successfully disabled:

cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]