Skip to content

Commit 699acfc

Browse files
committed
mariadb: installing plugins
1 parent 81191b4 commit 699acfc

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
@@ -269,3 +269,71 @@ $ docker run --rm -v /my/own/datadir:/var/lib/mysql -v /my/own/passwordreset.sql
269269
```
270270

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