![background image](http://html1.mh-extra.com/html/oracle/5-0/5-0_reference-manual_16461961350.webp)
Setting Up MySQL on an EC2 AMI
1330
For tips and advice on how to create a scalable EC2 environment using MySQL, including guides on
setting up replication, see
Section 15.4.3, “Deploying a MySQL Database Using EC2”
.
15.4.1. Setting Up MySQL on an EC2 AMI
There are many different ways of setting up an EC2 AMI with MySQL, including using any of the pre-
configured AMIs supplied by Amazon.
The default Getting Started AMI provided by Amazon uses Fedora Core 4, and you can install MySQL
by using
yum
:
shell>
yum install mysql
This installs both the MySQL server and the Perl DBD::mysql driver for the Perl DBI API.
Alternatively, you can use one of the AMIs that include MySQL within the standard installation.
Finally, you can also install a standard version of MySQL downloaded from the MySQL Web site. The
installation process and instructions are identical to any other installation of MySQL on Linux. See
Chapter 2, Installing and Upgrading MySQL
.
The standard configuration for MySQL places the data files in the default location,
/var/lib/mysql
.
The default data directory on an EC2 instance is
/mnt
(although on the large and extra large instance
you can alter this configuration). You must edit
/etc/my.cnf
to set the
datadir
[404]
option to point
to the larger storage area.
Important
The first time you use the main storage location within an EC2 instance it needs
to be initialized. The initialization process starts automatically the first time you
write to the device. You can start using the device right away, but the write
performance of the new device is significantly lower on the initial writes until the
initialization process has finished.
To avoid this problem when setting up a new instance, you should start the
initialization process before populating your MySQL database. One way to do
this is to use
dd
to write to the file system:
root-shell>
dd if=/dev/zero of=initialize bs=1024M count=50
The preceding creates a 50GB on the file system and starts the initialization
process. Delete the file once the process has finished.
The initialization process can be time-consuming. On the small instance,
initialization takes between two and three hours. For the large and extra large
drives, the initialization can be 10 or 20 hours, respectively.
In addition to configuring the correct storage location for your MySQL data files, also consider setting
the following other settings in your instance before you save the instance configuration for deployment:
• Set the MySQL server ID, so that when you use it for replication, the ID information is set correctly.
• Enabling binary logging, so that replication can be initialized without starting and stopping the server.
• Set the caching and memory parameters for your storage engines. There are no limitations or
restrictions on what storage engines you use in your EC2 environment. Choose a configuration,
possibly using one of the standard configurations provided with MySQL appropriate for the instance
on which you expect to deploy. The large and extra large instances have RAM that can be dedicated
to caching. Be aware that if you choose to install
memcached
on the servers as part of your
application stack you must ensure there is enough memory for both MySQL and
memcached
.
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...