MariaDB is an open source database server. It can be used as the backing
database for web, business, and other applications and application servers.
It is an evolution of the popular MySQL database, the M in the popular LAMP
(Linux, Apache, MySQL, PHP) web-based application server software stack.
MariaDB offers enhanced performance, more features, and greater scalability
while maintaining full transparent compatibility with the many existing
applications built to work with MySQL. This charm downloads and deploys
MariaDB on an Ubuntu system.
MariaDB strives to be the logical choice for database
professionals looking for a robust, scalable, and reliable SQL server. To
accomplish this, the MariaDB Foundation works closely and cooperatively with
the larger community of users and developers in the true spirit of Free and
open source software, and release software in a manner that balances
predictability with reliability.
MariaDB Enterprise from MariaDB Corporation, Inc. takes
MariaDB and enhances it with an optimized configuration, additional testing,
and available 24/7 professional support and consulting.
This charm deploys MariaDB using packages in a repository provided by the
MariaDB Foundation or, optionally, MariaDB Enterprise packages in a repository
provided by MariaDB Corporation, Inc.
Packages for IBM's Power8 platform are only available from the MariaDB
As much as possible this charm uses the same charm structure as the MySQL charm
for the sake of compatability.
To deploy a MariaDB service:
juju deploy mariadb
Once deployed, you can retrive the MariaDB root user password by logging in to
the machine via juju ssh and reading the /var/lib/mysql/mysql.passwd file.
To log in as root MariaDB User at the MariaDB console you can issue the
juju ssh mariadb/0
mysql -u root -p$(sudo cat /var/lib/mysql/mysql.passwd)
First obtain a username/password from the MariaDB Portal
and you will then have access to the MariaDB Enterprise repository.
Next create a file called enterprise.yaml with the following contents,
replacing username:password with your actual username and password:
source: "deb https://username:email@example.com/mariadb-enterprise/10.0/repo/ubuntu trusty main"
Lastly, deploy MariaDB as normal but with the addition of:
juju deploy --config ./enterprise.yaml mariadb
MariaDB Enterprise will be deployed instead of MariaDB. You must agree to all
terms contained in ENTERPRISE-LICENSE.md in the charm directory to use
If you deployed MariaDB and would like to switch to MariaDB Enterprise, first
obtain a username/password from the MariaDB Portal and
you will then have access to the MariaDB Enterprise repository. You can then
enable the repository in the charm with the following configuration:
juju set mariadb enterprise-eula=true key="0xd324876ebe6a595f" source="deb https://username:firstname.lastname@example.org/mariadb-enterprise/10.0/repo/ubuntu trusty main"
This will perform an in-place binary upgrade on all the MariaDB nodes from
MariaDB to MariaDB Enterprise. You must agree to all terms contained in
ENTERPRISE-LICENSE.md in the charm directory to use MariaDB Enterprise.
MariaDB supports the ability to replicate databases to slave instances. This
allows you, for example, to load balance read queries across multiple slaves or
use a slave to perform backups, all whilst not impeding the master's
To deploy a slave:
# deploy second service
juju deploy mariadb mariadb-slave
# add master to slave relation
juju add-relation mariadb:master mariadb-slave:slave
Any changes to the master are reflected on the slave.
Any queries that modify the database(s) should be applied to the master only.
The slave should be treated strictly as read only.
You can add further slaves with:
juju add-unit mariadb-slave
This charm provides relations that support monitoring via either
Munin. Refer to the appropriate charm
You can tweak various options to optimize your MariaDB deployment:
max-connections - Maximum connections allowed to server or '-1' for default.
preferred-storage-engine - A comma separated list of storage engines to
optimize for. First in the list is marked as default storage engine. 'InnoDB'
or 'MyISAM' are acceptable values.
tuning-level - Specify 'safest', 'fast' or 'unsafe' to choose required
transaction safety. This option determines the flush value for innodb commit
and binary logs. Specify 'safest' for full ACID compliance. 'fast' relaxes the
compliance for performance and 'unsafe' will remove most restrictions.
dataset-size - Memory allocation for all caches (InnoDB buffer pool, MyISAM
key, query). Suffix value with 'K', 'M', 'G' or 'T' to indicate unit of
kilobyte, megabyte, gigabyte or terabyte respectively. Suffix value with '%'
to use percentage of machine's total memory.
query-cache-type - Specify 'ON', 'DEMAND' or 'OFF' to turn query cache on,
selectively (dependent on queries) or off.
query-cache-size - Size of query cache (no. of bytes) or '-1' to use 20%
of memory allocation.
Each of these can be applied by running:
juju set <service> <option>=<value>
juju set mariadb preferred-storage-engine=InnoDB
juju set mariadb dataset-size=50%
juju set mariadb query-cache-type=ON
juju set mariadb query-cache-size=-1