Description
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.
Overview
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 either MariaDB, using packages provided by the MariaDB
Foundation, including packages for IBM's POWER8 platform; or MariaDB
Enterprise, using packages in a repository provided by MariaDB Corporation,
Inc.
Note: Packages for IBM's POWER8 platform are only available from the MariaDB
Foundation repository.
As much as possible this charm uses the same charm structure as the MySQL charm
for the sake of compatability.
Usage
General Usage
Deploying MariaDB
To deploy MariaDB from the MariaDB Foundation, simply deploy like so:
juju deploy mariadb
MariaDB will be deployed.
Deploying MariaDB Enterprise
To deploy a MariaDB Enterprise service, first login to the
MariaDB Portal. On that page you will find
your MariaDB Enterprise download token. It is of the form xxxx-xxxx.
Next create a file called enterprise.yaml with the following contents,
replacing the placeholder token with your actual token:
mariadb:
enterprise-eula: true
token: "xxxx-xxxx"
Lastly, deploy MariaDB Enterprise like so:
juju deploy --config ./enterprise.yaml mariadb
MariaDB Enterprise will be deployed. You must agree to all terms contained in
ENTERPRISE-LICENSE.md in the charm directory to use MariaDB Enterprise.
Installing a different series of MariaDB
Different series of MariaDB can be installed using the charm. The default
series is MariaDB 10.1, but the older MariaDB 5.5 and 10.0 are also available.
To install one of these older series, create a mariadb.yaml file with the
following contents (example is for MariaDB 5.5):
mariadb:
series: "5.5"
You could also add the series line to your enterprise.yaml file, if you are
using MariaDB Enterprise. Then when deploying MariaDB, reference the file like
so:
juju deploy --config ./mariadb.yaml mariadb
Warning: Using the set command to downgrade MariaDB after initial deployment, for example, like so:
juju set mariadb series="5.5"
...does not work. Using the set command to upgrade MariaDB; from 5.5 to 10.0,
or from 10.0 to 10.1; does work.
After deploying
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 the root MariaDB user at the MariaDB console you can, for example,
issue the following:
juju ssh mariadb/0
mysql -u root -p$(sudo cat /var/lib/mysql/mysql.passwd)
Scale Out Usage
Replication
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
performance.
To deploy a slave:
# deploy second service
juju deploy --config ./enterprise.yaml 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
Monitoring
This charm provides relations that support monitoring via either
Nagios or
Munin. Refer to the appropriate charm
for usage.
Configuration
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>
For example:
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
MariaDB Contact Information
Configuration
- vip_iface
- (string) Network Interface where to place the Virtual IP
- eth0
- series
- (string) Name of the MariaDB series to install
- 10.1
- tuning-level
- (string) Valid values are 'safest', 'fast', and 'unsafe'. If set to safest, all settings are tuned to have maximum safety at the cost of performance. Fast will turn off most controls, but may lose data on crashes. unsafe will turn off all protections.
- safest
- key-org
- (string) GPG Keys used to verify MariaDB packages
- 0xcbcb082a1bb943db 0xF1656F24C74CD1D8
- query-cache-size
- (int) Override the computed version from dataset-size. Still works if query-cache-type is "OFF" since sessions can override the cache type setting on their own.
- -1
- vip
- (string) Virtual IP to use to front mariadb in ha configuration
- block-size
- (int) Default block storage size to create when setting up MySQL block storage. This value should be specified in GB (e.g. 100 not 100GB).
- 5
- query-cache-type
- (string) Query cache is usually a good idea, but can hurt concurrency. Valid values are "OFF", "ON", or "DEMAND". http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_query_cache_type
- OFF
- ha-mcastport
- (int) Default multicast port number that will be used to communicate between HA Cluster nodes.
- 5411
- enterprise-eula
- (boolean) I have read and agree to the ENTERPRISE TRIAL agreement, located in ENTERPRISE-LICENSE.md located in the charm, or on the web here: https://mariadb.com/about/legal/evaluation-agreement
- ha-bindiface
- (string) Default network interface on which HA cluster will bind to communication with the other members of the HA Cluster.
- eth0
- repo-pkg
- (string) The name of the MariaDB Enterprise repository package
- mariadb-enterprise-repository.deb
- base-url-org
- (string) Base URL of the MariaDB repository
- http://ftp.osuosl.org/pub/mariadb/repo
- binlog-format
- (string) If binlogging is enabled, this is the format that will be used. Ignored when tuning-level == fast.
- MIXED
- key
- (string) GPG Key used to verify MariaDB Enterprise packages
- 0xce1a3dd5e3c94f49
- max-connections
- (int) Maximum connections to allow. -1 means use the server's compiled in default.
- -1
- preferred-storage-engine
- (string) Tune the server for usage of this storage engine. Other possible value is MyISAM. Comma separated will cause settings to split resources evenly among given engines.
- InnoDB
- base-url
- (string) Base URL of the MariaDB Enterprise repository package
- https://downloads.mariadb.com/enterprise
- dataset-size
- (string) How much data do you want to keep in memory in the database. This will be used to tune settings in the database server appropriately. Any more specific settings will override these defaults though. This currently sets innodb_buffer_pool_size or key_cache_size depending on the setting in preferred-storage-engine. If query-cache-type is set to 'ON' or 'DEMAND' 20% of this is given to query-cache-size. Suffix this value with 'K','M','G', or 'T' to get the relevant kilo/mega/etc. bytes. If suffixed with %, one will get that percentage of RAM devoted to dataset and (if enabled) query cache.
- 50%
- ceph-osd-replication-count
- (int) This value dictates the number of replicas ceph must make of any object it stores within the mysql rbd pool. Of course, this only applies if using Ceph as a backend store. Note that once the mysql rbd pool has been created, changing this value will not have any effect (although it can be changed in ceph by manually configuring your ceph cluster).
- 2
- vip_cidr
- (int) Netmask that will be used for the Virtual IP
- 24
- rbd-name
- (string) The name that will be used to create the Ceph's RBD image with. If the image name exists in Ceph, it will be re-used and the data will be overwritten.
- mysql1
- token
- (string) Enterprise download token from https://mariadb.com/my_portal