Skip to content

Commit caec312

Browse files
authored
Merge pull request #857 from aerostitch/add_mariadb_ex_doc
Add example of MariaDB server installation on Ubuntu
2 parents ce892fb + 21da7dc commit caec312

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [Work with an existing server](#work-with-an-existing-server)
1313
* [Specify passwords](#specify-passwords)
1414
* [Install Percona server on CentOS](#install-percona-server-on-centos)
15+
* [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu)
1516
4. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
1617
5. [Limitations - OS compatibility, etc.](#limitations)
1718
6. [Development - Guide for contributing to the module](#development)
@@ -240,6 +241,110 @@ Yumrepo['percona']->
240241
Class['mysql::bindings']
241242
```
242243

244+
### Install MariaDB on Ubuntu
245+
246+
#### Preliminary step: Install the MariaDB official repo (optionnal)
247+
248+
In this example, we want the latest stable (currently 10.1) from the official
249+
MariaDB repository, not the one from the distro repository.
250+
Note that this part is totally optionnal. You can also use the package from the
251+
Ubuntu repository.
252+
253+
**Note:** `sfo1.mirrors.digitalocean.com` is just one of the many mirrors
254+
available. You can use any other official mirror for better performance.
255+
256+
**Important:** this example is using a MariaDB 10.1 repository. Make sure you
257+
are using the repository corresponding to the version you want.
258+
259+
```
260+
include apt
261+
262+
apt::source { 'mariadb':
263+
location => 'http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.1/ubuntu',
264+
release => $::lsbdistcodename,
265+
repos => 'main',
266+
key => {
267+
id => '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB',
268+
server => 'hkp://keyserver.ubuntu.com:80',
269+
},
270+
include => {
271+
src => false,
272+
deb => true,
273+
},
274+
}
275+
```
276+
277+
#### Installing the MariaDB server
278+
279+
This part of the example shows how to install a MariaDB server on Ubuntu (trusty
280+
here). You will probably want to tweak the version and the parameters of the
281+
my.cnf.
282+
283+
As a reminder, all the parameters of the my.cnf can be defined using the
284+
`override_options` parmeter.
285+
286+
Of course, you need to make sure that all the custom folders you are setting
287+
your files into do exist as prerequisites of this code! :)
288+
Note that `/var/log/mysql` and `/var/run/mysqld` are created automatically.
289+
290+
All the values set here are an example of a working minimal configuration.
291+
You can tweak them all! ;)
292+
293+
**Note:** it is not mandatory to specify the version of the package you want
294+
(using the `package_ensure` parameter) but it's always a good practice to do
295+
so as it avoids some surprises...
296+
297+
```
298+
class {'::mysql::server':
299+
package_name => 'mariadb-server',
300+
package_ensure => '10.1.14+maria-1~trusty',
301+
service_name => 'mysql',
302+
root_password => 'AVeryStrongPasswordUShouldEncrypt!',
303+
override_options => {
304+
mysqld => {
305+
'log-error' => '/var/log/mysql/mariadb.log',
306+
'pid-file' => '/var/run/mysqld/mysqld.pid',
307+
},
308+
mysqld_safe => {
309+
'log-error' => '/var/log/mysql/mariadb.log',
310+
},
311+
}
312+
}
313+
314+
# Dependency management. Only use that part if you are installing the repository
315+
# as shown in the Preliminary step of this example.
316+
Apt::Source['mariadb'] ~>
317+
Class['apt::update'] ->
318+
Class['::mysql::server']
319+
320+
```
321+
322+
#### Installing the MariaDB client (can be done separately)
323+
324+
This part of the example shows how to install the MariaDB client and
325+
use the `bindings_enable` to get all the bindings installed in 1 shot.
326+
327+
This part can be used totally individually from the server installation part.
328+
329+
**Note:** it is not mandatory to specify the version of the package you want
330+
(using the `package_ensure` parameter) but it's always a good practice to do
331+
so as it avoids some surprises...
332+
333+
```
334+
class {'::mysql::client':
335+
package_name => 'mariadb-client',
336+
package_ensure => '10.1.14+maria-1~trusty',
337+
bindings_enable => true,
338+
}
339+
340+
# Dependency management. Only use that part if you are installing the repository
341+
# as shown in the Preliminary step of this example.
342+
Apt::Source['mariadb'] ~>
343+
Class['apt::update'] ->
344+
Class['::mysql::client']
345+
```
346+
347+
243348
## Reference
244349

245350
### Classes

0 commit comments

Comments
 (0)