3
MySQL is a fast, stable and true multi-user, multi-threaded SQL database server.
4
SQL (Structured Query Language) is the most popular database query language in
5
the world. The main goals of MySQL are speed, robustness and ease of use.
7
Percona is fork of MySQL by Percona Inc. which focuses on maximizing
8
performance, particularly for heavy workloads. It is a drop-in replacement for
9
MySQL and features XtraDB, a drop-in replacement for the InnoDB storage engine.
11
[http://www.mysql.com](http://www.mysql.com)
13
[http://www.percona.com/software/percona-server](http://www.percona.com/software/percona-server)
19
To deploy a MySQL service:
23
Once deployed, you can ssh into the deployed service and access the
24
MySQL console as the MySQL root user:
28
# enter root password - /var/lib/juju/mysql.passwd
30
To change deployment to a Percona server:
32
juju set mysql flavor=percona
36
You can tweak various options to optimize your MySQL deployment:
38
* max-connections - Maximum connections allowed to server or '-1' for default.
40
* preferred-storage-engine - A comma separated list of storage engines to
41
optimize for. First in the list is marked as default storage engine. 'InnoDB'
42
or 'MyISAM' are acceptable values.
44
* tuning-level - Specify 'safest', 'fast' or 'unsafe' to choose required
45
transaction safety. This option determines the flush value for innodb commit
46
and binary logs. Specify 'safest' for full ACID compliance. 'fast' relaxes the
47
compliance for performance and 'unsafe' will remove most restrictions.
49
* dataset-size - Memory allocation for all caches (InnoDB buffer pool, MyISAM
50
key, query). Suffix value with 'K', 'M', 'G' or 'T' to indicate unit of
51
kilobyte, megabyte, gigabyte or terabyte respectively. Suffix value with '%'
52
to use percentage of machine's total memory.
54
* query-cache-type - Specify 'ON', 'DEMAND' or 'OFF' to turn query cache on,
55
selectively (dependent on queries) or off.
57
* query-cache-size - Size of query cache (no. of bytes) or '-1' to use 20%
60
Each of these can be applied by running:
62
juju set <service> <option>=<value>
66
juju set mysql preferred-storage-engine=InnoDB
67
juju set mysql dataset-size=50%
68
juju set mysql query-cache-type=ON
69
juju set mysql query-cache-size=-1
73
MySQL supports the ability to replicate databases to slave instances. This
74
allows you, for example, to load balance read queries across multiple slaves or
75
use a slave to perform backups, all whilst not impeding the master's
80
# deploy second service
81
juju deploy mysql mysql-slave
83
# add master to slave relation
84
juju add-relation mysql:master mysql-slave:slave
86
Any changes to the master are reflected on the slave.
88
Any queries that modify the database(s) should be applied to the master only.
89
The slave should be treated strictly as read only.
91
You can add further slaves with:
93
juju add-unit mysql-slave
97
This charm provides relations that support monitoring via either Nagios or
98
Munin. Refer to the appropriate charm for usage.