Skip to content

Commit 9367503

Browse files
committed
mariadb: installing plugins
1 parent 3a1eef5 commit 9367503

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

mariadb/content.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,71 @@ $ docker run --rm -v /my/own/datadir:/var/lib/mysql -v /my/own/passwordreset.sql
271271
```
272272

273273
On restarting the MariaDB container on this `/my/own/datadir`, the `root` and `myuser` passwords will be reset.
274+
275+
## How to install MariaDB plugins
276+
277+
MariaDB has many plugins, most are not enabled by default, some are in the %%IMAGE%% container, others need to be installed from additional packages.
278+
279+
The following methods summarize the [MariaDB Blog article - Installing plugins in the MariaDB Docker Library Container](https://mariadb.org/installing-plugins-in-the-mariadb-docker-library-container/) on this topic.
280+
281+
### Which plugins does the container contain?
282+
283+
To see which plugins are available in the %%IMAGE%%:
284+
285+
```console
286+
$ docker run --rm %%IMAGE%%:latest ls -C /usr/lib/mysql/plugin
287+
```
288+
289+
### Enabling a plugin using flags
290+
291+
Using the `--plugin-load-add` flag with the plugin name (can be repeated), the plugins will be loaded and ready when the container is started:
292+
293+
For example enable the `simple\_password\_check` plugin:
294+
295+
```console
296+
$ docker run --name some-%%REPO%% -e MARIADB_ROOT_PASSWORD=my-secret-pw --network=host -d %%IMAGE%%:latest --plugin-load-add=simple_password_check
297+
```
298+
299+
### Enabling a plugin in the configuration files
300+
301+
`plugin-load-add` can be used as a configuration option to load plugins. The example below load the [FederatedX Storage Engine](https://mariadb.com/kb/en/federatedx-storage-engine/).
302+
303+
```console
304+
$ printf "[mariadb]\nplugin-load-add=ha_federatedx\n" > /my/custom/fexeratedx.conf
305+
$ docker run --name some-%%REPO%% -v /my/custom:/etc/mysql/conf.d -e MARIADB_ROOT_PASSWORD=my-secret-pw -d %%IMAGE%%:latest
306+
```
307+
308+
### Install a plugin using SQL in /docker-entrypoint-initdb.d
309+
310+
`[INSTALL SONAME](https://mariadb.com/kb/en/install-soname/)` can be used to install a plugin as part of the database initialization.
311+
312+
Create the SQL file used in initialization:
313+
314+
```console
315+
$ echo 'INSTALL SONAME "disks";' > my_initdb/disks.sql
316+
```
317+
318+
In this case the `my\_initdb` is a `/docker-entrypoint-initdb.d` directory per "Initializing a fresh instance" section above.
319+
320+
### Identifing additional plugins in additional packages
321+
322+
A number of plugins are in separate packages to reduce their installation size. The package names of MariaDB created plugins can be determined using the following command:
323+
324+
```console
325+
$ docker run --rm %%IMAGE%%:latest sh -c 'apt-get update > /dev/null && apt-cache search mariadb-plugin'
326+
```
327+
328+
### Creating a image with plugins from additional packages
329+
330+
A new image needs to be created when using additional packages. The %%IMAGE%% image can be used as a base however:
331+
332+
In the following the [CONNECT Storage Engine](https://mariadb.com/kb/en/connect/) is installed:
333+
334+
```dockerfile
335+
FROM %%IMAGE%%:latest
336+
RUN apt-get update && \
337+
apt-get install mariadb-plugin-connect -y && \
338+
rm -rf /var/lib/apt/lists/*
339+
```
340+
341+
Installing plugins from packages creates a configuration file in the directory `/etc/mysql/mariadb.conf.d/` that loads the plugin on startup.

0 commit comments

Comments
 (0)