Handling MySQL Recovery with ZFS
1337
root-shell> zfs send -i scratchpool@snap1 scratchpool@snap2|ssh
id
@
host
pfexec zfs recv slavepool
Doublecheck that the slave has the data by looking at the MySQL data directory on the
slavepool
:
root-shell> ls -al /slavepool/mysql-data/
Now you can start up MySQL, create some data, and then replicate the changes using
zfs send
/
zfs recv
to the slave to synchronize the changes.
The rate at which you perform the synchronization depends on your application and environment.
The limitation is the speed required to perform the snapshot and then to send the changes over the
network.
To automate the process, create a script that performs the snapshot, send, and receive operation, and
use
cron
to synchronize the changes at set times or intervals.
15.5.3. Handling MySQL Recovery with ZFS
When using ZFS replication to provide a constant copy of your data, ensure that you can recover your
tables, either manually or automatically, in the event of a failure of the original system.
In the event of a failure, follow this sequence:
1. Stop the script on the master, if it is still up and running.
2. Set the slave file system to be read/write:
root-shell> zfs set readonly=off slavepool
3. Start up
mysqld
on the slave. If you are using
InnoDB
, you get auto-recovery, if it is needed,
to make sure the table data is correct, as shown here when I started up from our mid-INSERT
snapshot:
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
081109 15:59:59 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
081109 16:00:03 InnoDB: Started; log sequence number 0 1142807951
081109 16:00:03 [Note] /slavepool/mysql-5.0.67-solaris10-i386/bin/mysqld: ready for connections.
Version: '5.0.67' socket: '/tmp/mysql.sock' port: 3306 MySQL Community Server (GPL)
Use
InnoDB
tables and a regular synchronization schedule to reduce the risk for significant data
loss. On MyISAM tables, you might need to run
REPAIR TABLE
, and you might even have lost some
information.
15.6. Using MySQL with
memcached
memcached
is a simple, highly scalable key-based cache that stores data and objects wherever
dedicated or spare RAM is available for quick access by applications, without going through layers of
parsing or disk I/O. To use, you run the
memcached
command on one or more hosts and then use the
shared cache to store objects. For more usage instructions, see
Section 15.6.2, “Using
memcached
”
Benefits of using
memcached
include:
• Because all information is stored in RAM, the access speed is faster than loading the information
each time from disk.
• Because the “value” portion of the key-value pair does not have any data type restrictions, you can
cache data such as complex structures, documents, images, or a mixture of such things.
Содержание 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 ...