Using INSTALL SONAME

The INSTALL SONAME command is used to install plugins in MariaDB. In this recipe, we'll install the Cassandra storage engine.

How to do it...

  1. Connect to MariaDB using the mysql command-line client with a user that has the INSERT privilege on the mysql.plugins table. The root user has this privilege, but other users might as well.
  2. Install the Cassandra storage engine plugin using the following command line:
    INSTALL SONAME 'ha_cassandra';
    
  3. Issue the SHOW plugins; command and look for the following text:
    | CASSANDRA | ACTIVE | STORAGE ENGINE | ha_cassandra.so | GPL | 
    
  4. Next, issue the SHOW STORAGE ENGINES; command and look for the following text:
    | CASSANDRA | YES | Cassandra storage engine| NO | NO | NO | 
    
  5. The preceding output indicates that the Cassandra storage engine is installed and ready to go. The three NO columns are about transactions, distributed XA transactions, and savepoints, respectively. All three are features that the Cassandra storage engine does not support.

How it works...

When this command is run, the server looks in the configured plugin directory and loads the plugin with that name. We do not need to specify the file extension. The actual name of the ha_cassandra file will either be ha_cassandra.dll or ha_cassandra.so on Windows and Linux respectively.

There's more...

Installing plugins is not very difficult in MariaDB but there are some things that can trip us up if we're not careful.

Plugin names versus filenames

The name of a given plugin is defined in the data structures inside the plugin. The filename is the name of the file that contains the plugin. The two are similar, but they are not the same. For example, the name of the Cassandra storage engine plugin is CASSANDRA and the filename is ha_cassandra.so. The name is case insensitive, so when referring to it we can use CASSANDRA, Cassandra, cassandra, or even CaSsAnDrA if we want. The filename, on the other hand, is case sensitive if our underlying filesystem is case sensitive.

INSTALL SONAME versus INSTALL PLUGIN

The INSTALL SONAME command is just a variation of the INSTALL PLUGIN command. The main difference is that INSTALL PLUGIN requires two sets of information, the name and the filename, and INSTALL SONAME just needs the filename. The filename must be quoted. Here is the recipe using INSTALL PLUGIN:

INSTALL PLUGIN Cassandra SONAME 'ha_cassandra';

Apart from being shorter, INSTALL SONAME is no different from INSTALL PLUGIN, functionality-wise.

See also