~marcoceppi/charms/precise/mysql/actually-start-mysql

« back to all changes in this revision

Viewing changes to README.md

  • Committer: Juan L. Negron
  • Date: 2013-01-16 17:46:57 UTC
  • mfrom: (91.1.1 mysql)
  • Revision ID: juan.negron@canonical.com-20130116174657-lp9p7v09cs3yhgj1
Merging Robert's changes ( Added README ). MP:143374

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Overview
 
2
 
 
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.
 
6
 
 
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.
 
10
 
 
11
[http://www.mysql.com](http://www.mysql.com)
 
12
 
 
13
[http://www.percona.com/software/percona-server](http://www.percona.com/software/percona-server)
 
14
 
 
15
# Usage
 
16
 
 
17
## General
 
18
 
 
19
To deploy a MySQL service:
 
20
 
 
21
    juju deploy mysql
 
22
 
 
23
Once deployed, you can ssh into the deployed service and access the
 
24
MySQL console as the MySQL root user:
 
25
 
 
26
    juju ssh <unit>
 
27
    mysql -u root -p
 
28
    # enter root password - /var/lib/juju/mysql.passwd
 
29
 
 
30
To change deployment to a Percona server:
 
31
 
 
32
    juju set mysql flavor=percona
 
33
 
 
34
## Optimization
 
35
 
 
36
You can tweak various options to optimize your MySQL deployment:
 
37
 
 
38
* max-connections - Maximum connections allowed to server or '-1' for default.
 
39
 
 
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.
 
43
 
 
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.
 
48
 
 
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.
 
53
 
 
54
* query-cache-type - Specify 'ON', 'DEMAND' or 'OFF' to turn query cache on,
 
55
  selectively (dependent on queries) or off.
 
56
 
 
57
* query-cache-size - Size of query cache (no. of bytes) or '-1' to use 20%
 
58
  of memory allocation.
 
59
 
 
60
Each of these can be applied by running:
 
61
 
 
62
    juju set <service> <option>=<value>
 
63
 
 
64
e.g.
 
65
 
 
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
 
70
 
 
71
## Replication
 
72
 
 
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
 
76
performance.
 
77
 
 
78
To deploy a slave:
 
79
 
 
80
    # deploy second service
 
81
    juju deploy mysql mysql-slave
 
82
 
 
83
    # add master to slave relation
 
84
    juju add-relation mysql:master mysql-slave:slave
 
85
 
 
86
Any changes to the master are reflected on the slave.
 
87
 
 
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.
 
90
 
 
91
You can add further slaves with:
 
92
 
 
93
    juju add-unit mysql-slave
 
94
 
 
95
## Monitoring
 
96
 
 
97
This charm provides relations that support monitoring via either Nagios or
 
98
Munin. Refer to the appropriate charm for usage.