Mysql™ Guide For Sun™ Storage 7000 Unified Storage System
Mysql™ Guide For Sun™ Storage 7000 Unified Storage System
Part No 820-7350-10
Revision 1.0, 2/9/09
Sun Microsystems, Inc.
Table of Contents
As data volumes continue to grow, organizations struggle to deliver fast and reliable
information access while containing costs. Unfortunately, many storage solutions
today are proprietary, complex, and expensive. Recognizing the need for easy-to-
manage, eco-friendly, and scalable storage solutions that deliver exceptional business
value, Sun created the Sun™ Storage 7000 Unified Storage Systems. These systems
incorporate an open-systems approach that selects the best general-purpose servers
and storage components, combines them with innovative technologies, and unifies
them with storage software. As a result, these systems offer significant cost savings
while providing enterprise-class data services, good scalability, and superior
performance.
For MySQL™ database applications, the Sun Storage 7000 Unified Storage Systems meet
a range of functional requirements for availability, capacity, and performance. This
paper demonstrates how the Sun Storage 7000 series family of unified storage systems
can be used to share NFS and iSCSI file systems with MySQL database servers deployed
on Sun SPARC® and x86 servers running the Solaris™ or Red Hat Enterprise Linux (RHEL)
5.2 operating systems. In addition, this paper documents how the built-in snapshot,
clone, and rollback functionality of the Sun Storage 7000 unified storage systems can
be used in conjunction with the MySQL database on these platforms.
This paper assumes the reader is familiar with Solaris operating system (Solaris OS) and
MySQL database administration.
2 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
The ZFS file system enables a new approach to data management called Hybrid Storage
Pools, which automatically provide data placement, data protection, and data services
such as RAID, error correction, and system management. By placing data on the most
appropriate storage media, Hybrid Storage Pools help to optimize performance and
contain costs.
To meet varied needs for capacity, reliability, performance, and price, the product
family includes three different models — the Sun Storage 7110, 7210, and 7410 Unified
Storage Systems (Figure 1). Configured with appropriate data processing and storage
resources, these systems can support a wide range of requirements. Table 1 compares
general characteristics of models in the product family.
3 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Sun Storage 7000 Unified Storage Systems exploit the power of today’s multicore,
multithreaded processors to increase application performance. In addition, advanced
solid state device (SSD) technology in the Sun Storage 7210 and 7410 systems provide
enhanced performance. For applications such as the MySQL database, this superior
performance combined with ease of deployment and management, the Sun Storage
7000 Unified Storage Systems are a compelling choice for data sharing.
4 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Test environment
Figure 2 provides a logical diagram of the test environment used in this study. Two Sun
servers, a Sun Fire X4200 and V890 server, were configured as MySQL database servers
and used for the primary testing. Both servers ran the Solaris 10 OS (08/07 release) and
the MySQL 5.1.24rc software. A Sun Fire X4200 server hosted the sysbench and iGen
software OLTP database driver applications1 used to generate database loads in the
tests. A Sun Fire X4200 server running the Linux operating system (RHEL 5.2) was used
for additional testing. Only a single MySQL database server was active at any point in
the test.
A Sun Storage 7000 Unified Storage System was used for database storage. The
configuration used in this testing included 2 dual core AMD Opteron™ 2.6 GHz
processors, 16 GB of memory, and 48 500-GB SATA hard disk drives.
Configuration details, including the hardware and software components of the systems
used in this study, are included in Table 2:
1. Information on the iGen suite of computer benchmarks can be found at the Web site
http://en.wikipedia.org/wiki/IGen. Information on the sysbench benchmark utility can be
found at http://sysbench.sourceforge.net/index.html.
5 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Test procedures
The Sun Storage 7000 unified storage system was configured to provide both NFS and
iSCSI volumes. The MySQL database software was installed and configured on both
primary test systems. Both test systems were configured to access the Sun Storage
7000 system first using NFS, and then iSCSI, for MySQL database storage. The iGen suite
of benchmarks was used to generate load for the MySQL database.
Additional testing was also performed using a Sun Fire x4200 server running the Red
Hat Enterprise Linux operating system and accessing NFS volumes on the Sun Storage
7000 system. The sysbench benchmark tool was used to generate load for this test.
Following these tests, the snapshot, cloning, and rollback features of the Sun Storage
7000 Unified Storage System were tested.
6 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
2. Create /etc/my.cnf file and specify datadir equal to the exported NFS or iSCSI
file system on the Sun Storage 7000 Unified Storage System. (Details on NFS config-
uration are included in “Configuring NFS access” on page 7; details in iSCSI configu-
ration are included in “Configuring iSCSI access” on page 9.)
3. Change directories to the installation directory, and run the mysql_install_db
script to initialize the MySQL database:
# cd $MYSQL_HOME
# scripts/mysql_install_db
5. Use the mysqladmin command to set the password. For example, the following
command sets the password for the specified host to be admin123.
# mysqladmin -u root -h server_hostname password admin123
6. Issue MySQL commands to create the database for the database driver being used
and grant access to the database user.
7 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Note – All the steps documented in this section are run as OS root user (superuser) unless
stated otherwise.
2. Click on the Shares tab, then click on the “+” icon to create a new file system.
3. In the Create File System pop-up, provide the following information:
• Name: nfsvol1
• Set permissions rwx for user, group, and other
• Use defaults for other options
4. Click APPLY, to create the file system.
This step will create the file system nfsvol1 under the default project, with the
mount point /export/nfsvol1.
Note – The default configuration for NFS shared file systems on the Sun Storage 7000 Unified
Storage System doesn't allow root user write access; it is necessary to explicitly grant root
user write access to the network file system.
8 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
1. Verify that the /diskam_nfs file system has been successfully mounted and is
listed in the output of the df -k command:
SystemA:[/] # df -k
2. Verify read/write access on the file system using these steps to create and then
remove a file:
SystemA:[/] # touch /diskam_nfs/abc
SystemA:[/] # rm /diskam_nfs/abc
9 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Major steps in setting up iSCSI targets (LUNs) on the Sun Storage 7000 Unified Storage
System and configuring a Solaris 10 iSCSI client include:
1. Configure the Sun Storage 7000 Unified Storage System (see page 9), creating a
new LUN.
2. Configure the Solaris 10 system for iSCSI access (see page 10), to access the LUN:
a. Configure the target device to be discovered statically.
b. Enable the iSCSI target static discovery method .
c. Verify the device availability using dmesg and format.
d. Partition device, create and mount file system.
3. Remove the statically discovered iSCSI target (see page 13), when the file system is
no longer needed.
2. List the iSCSI file systems defined on the Sun Storage 7000 system:
SystemA:[/] # iscsiadm list discovery-address -v IP-Address:3260
5. Configure the target device to be discovered statically, and then list the configura-
tion using the following iscsiadm commands:
SystemA:[/] # iscsiadm add static-config
iqn.1986-03.com.sun:02:e69018ea-cc2f-e018-fdd2-ecc5e832ac84,10.6.241.99
Note – For additional background information and a more detailed explanation of using the
iscsiadm command, see the section “How to Configure iSCSI Target Discovery” in the
Solaris 10 System Administration Guide: Devices and File Systems, available online:
http://docs.sun.com/app/docs/doc/817-5093/fqnlk?l=en&q=iSCSI&a=view
6. Use the following devfsadm command to create the iSCSI links for the local sys-
tem:
SystemA:[/] # devfsadm -i iscsi
11 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
7. Verify the device availability using the dmesg and format commands:
SystemA:[/] # dmesg | grep iscsi
Jul 14 21:58:10 x4200-240-08 iscsi: [ID 240218 kern.notice] NOTICE:
iscsi session(4) iqn.1986-03.com.sun:02:abe68892-3951-efa2-9381-
8268b3fda48f online
SystemA:[/] # format
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <DEFAULT cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@0,0
1. c0t1d0 <DEFAULT cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@1,0
2. c6t010000144F20F83000002A00487BD1A8d0 <DEFAULT cyl 13052 alt 2
hd 255 sec 63>
/scsi_vhci/disk@g010000144f20f83000002a00487bd1a8
8. Use the format command to partition the disk, using the standard Solaris OS disk
partitioning process:
SystemA:[/] # format
AVAILABLE DISK SELECTIONS:
0. c0t0d0 <DEFAULT cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@0,0
1. c0t1d0 <DEFAULT cyl 8921 alt 2 hd 255 sec 63>
/pci@0,0/pci1022,7450@2/pci1000,3060@3/sd@1,0
2. c6t010000144F20F83000002A00487BD1A8d0 <DEFAULT cyl 13052 alt 2
hd 255 sec 63>
/scsi_vhci/disk@g010000144f20f83000002a00487bd1a8
Specify disk (enter its number): 2
selecting c6t010000144F20F83000002A00487BD1A8d0
[disk formatted]
FORMAT MENU:
disk - select a disk
type - select (define) a disk type
partition - select (define) a partition table
TRUNCATED OUTPUT
quit
format> p
Please run fdisk first.
format> fdisk
No fdisk table exists. The default partition for the disk is:
a 100% "SOLARIS System" partition
Type "y" to accept the default partition, otherwise type "n" to edit
the partition table.
y
format> p
PARTITION MENU:
0 - change `0' partition
... truncated output ...
12 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
partition> p
Current partition table (original):
Total disk cylinders available: 13051 + 2 (reserved cylinders)
9. Create a file system on the partitioned iSCSI disks using the following command:
SystemA:[/] # newfs /dev/rdsk/c6t010000144F20F83000002A00487BD1A8d0s0
newfs: construct a new file system
/dev/rdsk/c6t010000144F20F83000002A00487BD1A8d0s0: (y/n)? y
Warning: 132 sector(s) in last cylinder unallocated
/dev/rdsk/c6t010000144F20F83000002A00487BD1A8d0s0: 207624060
sectors in 33793 cylinders of 48 tracks, 128 sectors
TRUNCATED OUTPUT
207429408, 207527840, 207618080
SystemA:[/] #
10. Mount the file system using the following command. In this example, the file sys-
tem will be mounted on the directory /mnt.
SystemA:[/] # mount /dev/dsk/c6t010000144F20F83000002A00487BD1A8d0s0 /mnt
Note – You can edit the file system table /etc/vfstab to automatically mount this file sys-
tem across system reboots.
13 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Caution – The statically discovered ISCSI target should only be removed when all iSCSI
testing has been completed and the iSCSI file system is no longer needed. An
attempt to remove the iSCSI target will fail if the file system is still in use.
b. Copy the backup file to the target directory and grant access permissions to the
file:
# cp snapload.sql /export/home/mysql/
5. Take the first snapshot before data load. On the Sun Storage 7000 Unified Storage
System, log in as a privileged user. This example used user mysqlk, and stored
data on /export/nfsvol1; the created snapshot was named firstsnap:
a. Place the database in hot-backup (or equivalent) mode. Choose a hot-backup
utility that can backup any table regardless of its storage engine type, and
which has no other limitations.
a. On the GUI, click on Shares Tab to display a list of all shares.
b. Select the desired share (nfsvol1 in this example), and double-click to display
details for this share.
c. On the next screen, click on Snapshots.
d. On the next screen, click the + button against Snapshots to add a snapshot.
e. On the next screen, which prompts for a snapshot name, type in the name
(firstsnap in this example) and press Apply or the Enter key.
f. The new snapshot entry is now listed on the screen.
g. Take the database out of hot-backup mode.
6. Use the following steps to update the database server with the specdb database
load:
a. Restart the database server, and update it with the specdb database load:
$ mysqld &
$ mysql -uroot
> create database specdb;
> exit
7. Now, take a second snapshot from the Unified Storage System. This example cre-
ates a snapshot named secondsnap:
a. Again, place the server in hot-backup mode:
15 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
2. Against the secondsnap snapshot, bring up the clone creation menu, by clicking +
(the middle icon on the right side of the interface).
3. On the clone creation screen, enter the following information:
• Name = mysqlclone
16 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
• Select Preserve Local Properties (enter a check mark for this field)
• Mount Point = /export/nfsvol1
4. Click Apply to create the clone.
The clone is now seen as another share under the /export directory on the NAS.
However, it is not an independent share: it depends on the underlying snapshot, which
recursively depends on its parent, and finally on the physical database.
Next, the following steps were used to access data from the clone. In this example, the
clone data is modified, and the base volume is unaffected.
1. As user mysql on the client database system, shutdown the MySQL server:
$ mysql -uroot shutdown
2. Modify the configuration file parameters (/etc/my.cnf) to point the MySQL data
directory to the cloned share volume (mysqlclone) on the Sun Storage 7000 Uni-
fied Storage System:
/net/server_name/export/mysqlclone
4. Invoke the MySQL client utility, and access the sample specdb test database, and
drop a few tables:
$ mysql -uroot
> use specdb;
> drop <all tables beginning with 'txn_log_table'>
> exit
6. Edit the /etc/my.cnf file to switch the data directory to the path on the base NAS
volume:
datadir=/net/server_name/export/nfsvol1
8. Check that specdb has all the tables, including those deleted off the clone. The
tables should be retained on the base volume, despite being deleted earlier on the
clone.
17 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
substituting the IP address of the Sun Storage 7000 Unified Storage System and
the name of the snapshot file (for example, secondsnap). This above examples
assume a project named nfstest and a volume named nfsvol1.
Before starting this procedure, create an iSCSI Volume on the Sun Storage 7000 Unified
Storage System, and associate it with an iSCSI LUN on the client database system (see
“Configuring iSCSI access” on page 9).
1. Once an iSCSI Volume is set up on the Unified Storage System, make its LUN entry
visible on the client database machine. On the client, execute the following
command to configure the devices for the iscsi driver:
# devfsadm -i iscsi
2. Mount the LUN onto a local mount point, for example /iscsi.
3. As with the previous example of creating an NFS snapshot, create a MySQL data-
base on /iscsi, and load additional data (for example, the specdb database
tables). Then:
a. Place the database in hot-backup (or equivalent) mode.
b. Take a snapshot (snapiscsifs).
c. Take the database out of hot-backup mode.
d. Create a clone (cloneiscsifs).
4. The clone resides as an iSCSI Volume on the NAS. Make its reference visible to the
client as a LUN entry by using the following command:
# devfsadm -i iscsi
18 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
5. Execute the newfs command, and create a local mountpoint on the client. Then,
mount the above LUN. For example, this command mounts the LUN on the mount
point /cloneiscsifs:
# mount /dev/dsk/c6t600144F04892D07A0000144F20ECD400d0s0 /cloneiscsifs
6. Edit the /etc/my.cnf file to point the data directory to /cloneiscsifs, and then
start up the MySQL server:
# mysqld &
7. As shown in the previous example using NFS, execute the steps to modify the clone
data, and then verify that the base data is unaffected.
Test results
The stated goal of this project was to demonstrate the capability of the Sun Storage
7000 Unified Storage System for storing MySQL databases using NFS and iSCSI file
systems. A secondary goal was to demonstrate the built-in storage system snapshot,
cloning, and rollback capabilities.
This study successfully demonstrated the capability of the Sun Storage 7000 Unified
Storage System for storing MySQL databases using NFS and iSCSI file systems accessed
by servers running the Solaris OS. Snapshot, cloning, and rollback capabilities for NFS
systems were successfully demonstrated. In addition, snapshot and cloning capabilities
for iSCSI system were also successfully demonstrated in this study. Rollback
functionality is known to work on iSCSI file systems as well, but full support for this
feature was not added until after this project was complete.
Tests using the iGen utility to generate database loads on the Sun Fire X4200 server
running RHEL 5.2, with NFS access of the MySQL database files on the Sun Storage 7000
Unified Storage System, were also successful.
Summary
This article describes a proof-of-concept study that demonstrated the successful
configuration of MySQL database servers using a Sun Storage 7000 Unified Storage
System for database storage. Configuration procedures are included, describing how to
configure both the Sun Storage 7000 Unified Storage System and the MySQL database
servers for both NFS and iSCSI access of storage. Tests included MySQL servers running
both the Solaris 10 OS and Red Hat Enterprise Linux 5.2. In addition, this document
describes testing that was performed to demonstrate the feasibility of using built-in
snapshot , cloning, and rollback features of the Sun Storage 7000 Unified Storage
System in conjunction with MySQL database servers.
19 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.
Krish Shankar works in the Open Source software group at Sun. The group contributes
to the Open Source community via adoption and optimization of key Open Source
applications that support Sun product strategies.
References
Sun Storage 7000 Unified Storage Systems:
http://www.sun.com/storage/disk_systems/unified_storage/
MySQL:
http://www.sun.com/software/products/mysql/index.jsp
To reference Sun BluePrints Online articles, visit the Sun BluePrints Online Web site at:
http://www.sun.com/blueprints/online.html
MySQL Guide for Sun Storage 7000 Unified Storage System On the Web sun.com
Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 USA Phone 1-650-960-1300 or 1-800-555-9SUN (9786) Web sun.com
© 2009 Sun Microsystems, Inc. All rights reserved. Sun, Sun Microsystems, the Sun logo, MySQL, OpenSolaris, Solaris, and Sun BluePrints are trademarks
or registered trademarks of Sun Microsystems, Inc. or its subsidiaries in the United States and other countries. All SPARC trademarks are used under license
and are trademarks or registered trademarks of SPARC International, Inc. in the US and other countries. Products bearing SPARC trademarks are based
upon an architecture developed by Sun Microsystems, Inc. AMD and Opteron are trademarks or registered trademarks of Advanced Micro Devices.
Information subject to change without notice. Printed in USA 02/09