0% found this document useful (0 votes)
305 views

Mysql™ Guide For Sun™ Storage 7000 Unified Storage System

MySQL Guide for Sun Storage 7000 unified storage system.. Aiken, open source software group Krishnan. Shankar, Sun blueprints(tm) online table of contents.

Uploaded by

m_zaki_a50
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
305 views

Mysql™ Guide For Sun™ Storage 7000 Unified Storage System

MySQL Guide for Sun Storage 7000 unified storage system.. Aiken, open source software group Krishnan. Shankar, Sun blueprints(tm) online table of contents.

Uploaded by

m_zaki_a50
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

MYSQL™ GUIDE FOR SUN™ STORAGE

7000 UNIFIED STORAGE SYSTEM



William Aiken, Open Source Software Group
Krishnan Shankar, Open Source Software Group

Sun BluePrints™ Online

Part No 820-7350-10
Revision 1.0, 2/9/09
Sun Microsystems, Inc.

Table of Contents

MySQL Guide for Sun Storage 7000 Unified Storage System . . . . . . . . . . . . . . . . . . 1


Sun Storage 7000 Unified Storage System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Setup and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Installing and configuring MySQL software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Configuring NFS access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Configuring iSCSI access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Database snapshots and cloning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Test results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
About the authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Ordering Sun documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Accessing Sun documentation online . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.

MySQL™ Guide for 


Sun™ Storage 7000 Unified Storage System

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.

The article addresses the following topics:


• “Sun Storage 7000 Unified Storage System” on page 2 describes the open systems
architecture of the storage solution.
• “Setup and configuration” on page 4 describes the hardware and software
configurations used in this testing.
• Detailed configuration procedures are described in “Installing and configuring MySQL
software” on page 6, “Configuring NFS access” on page 7, and “Configuring iSCSI
access” on page 9.
• “Database snapshots and cloning” on page 13 demonstrates the feasibility of using
these built-in features of the Sun Storage 7000 unified storage system.

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.

Sun Storage 7000 Unified Storage System


Sun Storage 7000 Unified Storage Systems incorporate an open-source operating
system, commodity hardware, and industry-standard technologies. They are low-cost,
fully-functional network attached storage (NAS) storage devices designed around these
core technologies:
• General-purpose x64-based servers (which function as the NAS head), and Sun
Storage products — proven high-performance commodity hardware solutions with
compelling price-performance points
• The general-purpose OpenSolaris™ Operating System, which brings these
technologies:
– The ZFS file system, the world’s first 128-bit file system with unprecedented
availability and reliability features
– The high-performance Solaris networking stack for IPv4 or IPv6 networking
– DTrace Analytics, including capabilities (based on Solaris DTrace) that provide
dynamic instrumentation for real-time performance analysis and debugging
• FMA (Fault Management Architecture) for built-in fault detection, diagnosis, and self-
healing for common hardware problems
• A large and adaptive two-tiered caching model based on DRAM and enterprise-quality
solid state devices (SSDs)

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.

Sun Storage 7000 Unified Storage Systems feature a common, easy-to-use


management interface, along with a comprehensive analytics environment to help
isolate and resolve issues. The systems support NFS, CIFS, and iSCSI data access
protocols, mirrored and parity-based data protection, local point-in-time (PIT) copy,
remote replication, data checksum, data compression, and data reconstruction.

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 7110 Sun Storage 7210 Sun Storage 7410


Unified Storage System Unified Storage System Unified Storage System

Figure 1. Sun Storage 7000 Unified Storage System family.

Table 1. Sun Storage 7000 series family configurations.

System Model Maximum Capacity Space Features


Sun Storage 7110 2 TB  2U • Standalone appliance
system (16 x 2.5” SAS disks) • Single AMD Opteron processor in
NAS head
Sun Storage 7210 44 TB  4U • Standalone appliance
system (48 x 3.5” SATA II • Dual AMD Opteron processors in
disks) NAS head
• Enterprise SSDs for enhanced write
performance
Sun Storage 7410 576 TB  6U • Standalone appliance or cluster for
system (576 x 3.5” SATA II high availability
disks) • Enterprise SSDs for enhanced read
and write performance
• Support for multiple Sun Storage
J4400 expansion arrays

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.

Setup and configuration


The following sections describe the setup and configuration of the test environment
and provide an overview of the test procedures used in this study.

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.

Sun Fire X4200 Sun Storage 7000


Unified Storage System
Database
Driver

Solaris 10 OS Solaris 10 OS RHEL 5.2


MySQL 5.1.24rc MySQL 5.1.24rc MySQL 5.1.24rc

Sun Fire X4200 Sun Fire V890 Sun Fire X4200


MySQL Database Servers
Figure 2. Logical diagram of test environment.

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.

Table 2. Hardware and software configuration.

Component System Software Hardware


Storage Sun Storage 7000 • Sun Storage 7000 • 2 dual core AMD
Unified Storage version 2008.10 processors @ 2.6 GHz 
System • Firmware version (AMD Opteron 285)
1.3 • 16 GB memory
• 48 500-GB SATA drives
Database Driver Sun Fire X4200 Solaris 10 (08/07) • 2 dual core AMD
iGen processors @ 2.6 GHz
sysbench (AMD Opteron 285)
• 16 GB memory
• 2 72-GB internal disks
MySQL server— Sun Fire X4200 Solaris 10 (08/07) • 2 dual core AMD
Solaris/x64 MySQL 5.1.24rc processors @ 2.6 GHz
(AMD Opteron 285)
• 8 GB memory
• 2 72-GB internal disks
MySQL server— Sun Fire V890 Solaris 10 (08/07) • 8 dual core UltraSPARC-
Solaris/SPARC MySQL 5.1.24rc IV+ processors @ 1.5 GHz
• 64 GB memory
• 6 146-GB internal disks
MySQL server— Sun Fire X4200 RHEL 5.2 • 2 dual core AMD
Red Hat Linux MySQL 5.1.24rc processors @ 2.6 GHz
(AMD Opteron 285)
• 16 GB memory
• 2 72-GB internal disks

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.

Installing and configuring MySQL software


The following directions describe the procedure for installing MySQL binaries on a
system running either the Solaris or Linux operating system:
1. Download the appropriate binary zip file from the following location:
http://dev.mysql.com/downloads/mysql/5.1.html#downloads

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

4. Start the MySQL server:


# mysqld &

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.

Configuring NFS access


The Unified Storage System supports NFS, CIFS, HTTP, WebDAV, and FTP file level
protocols. This section describes the steps needed to configure the Sun Storage 7000
Unified Storage System and servers running the Solaris 10 OS for NFS access.

Major steps include:


1. Configure the Sun Storage 7000 Unified Storage System, creating a file system.
2. Configure the Solaris 10 system for NFS access, mounting the newly created file sys-
tem.

Note – All the steps documented in this section are run as OS root user (superuser) unless
stated otherwise.

Configure the Sun Storage 7000 Unified Storage System


This procedure assumes the Sun Storage 7000 Unified Storage System has already been
installed, and a Project was created during the installation process.
1. Log in to the Sun Storage 7000 Unified Storage System using the Web browser
interface, substituting the appropriate IP address:
https://ip-address:215

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.

Configure the Solaris 10 system for NFS access


The following steps describe how to configure a system running the Solaris 10 OS for
NFS access.
1. Run the following commands to mount the NFS file system, replacing IP_Address
with the IP address of the Sun Storage 7000 Unified Storage System:
SystemA:[/] # mkdir /diskam_nfs
SystemA:[/] # mount -F nfs IP-Address:/export/nfsvol1 /diskam_nfs

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.

Configuring iSCSI access


The Unified Storage System can share its disk storage by defining iSCSI targets. The
iSCSI targets can then be accessed by other systems that support the iSCSI protocol.
These systems define initiators that are mapped to the iSCSI targets. The terms client
and initiator are used interchangeably in this document. The following example uses a
system running the Solaris 10 OS as the iSCSI client.

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.

Details on these steps are included in the following sections.

Configure the Sun Storage 7000 Unified Storage System


The following steps describe the steps taken to configure the Sun Storage 7000 Unified
Storage System for iSCSI access. This procedures assume the Sun Storage 7000 Unified
Storage System has already been installed, and a Project was created during the
installation process.
1. Login to the Sun Storage 7000 Unified Storage System using the Web browser
interface, substituting the appropriate IP address:
https://ip-address:215

2. Click on Shares Tab.


3. Click on LUNs Tab.
4. Click on Add New.
5. In the Create LUN pop-up window, provide the following information:
• Project—Default
• Size—100G
• Sparse—Unchecked (default)
• Volume Block Size—8k (default)
6. Click APPLY.
10 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.

Configure the Solaris 10 system for iSCSI access


This section describes the steps needed to configure a Solaris 10 system to access iSCSI
LUNs on the Sun Storage 7000 Unified Storage System. The target device can be
discovered either dynamically or statically.
1. Issue the following iscsiadm command, substituting the IP address of the Sun
Storage 7000 Unified Storage System, to add the target to the list of discovery
addresses:
SystemA:[/] # iscsiadm add discovery-address IP-Address:3260

2. List the iSCSI file systems defined on the Sun Storage 7000 system:
SystemA:[/] # iscsiadm list discovery-address -v IP-Address:3260

3. Enable the iSCSI target static discovery method:


SystemA:[/] # iscsiadm modify discovery --static enable

4. Verify the static discovery method is enabled:


SystemA:[/] # iscsiadm list discovery

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

SystemA:[/] # iscsiadm list static-config


Static Configuration Target: iqn.1986-03.com.sun:02:e69018ea-cc2f-e018-
fdd2-ecc5e832ac84,10.6.241.99:3260

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)

Part Tag Flag Cylinders Size Blocks


0 unassigned wm 0 0 (0/0/0) 0
1 unassigned wm 0 0 (0/0/0) 0
2 backup wu 0 - 13051 99.98GB (13052/0/0) 209680380
3 unassigned wm 0 0 (0/0/0) 0
4 unassigned wm 0 0 (0/0/0) 0
5 unassigned wm 0 0 (0/0/0) 0
6 unassigned wm 0 0 (0/0/0) 0
7 unassigned wm 0 0 0/0/0) 0
8 boot wu 0 - 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0
partition> 0
Part Tag Flag Cylinders Size Blocks
0 unassigned wm 0 0 (0/0/0) 0
Enter partition id tag[unassigned]:
Enter partition permission flags[wm]:
Enter new starting cyl[0]:
Enter partition size[0b, 0c, 0e, 0.00mb, 0.00gb]: 99gb
partition> label
Ready to label disk, continue? yes
partition> quit
format>quit

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.

Remove the statically discovered iSCSI target


When the iSCSI file system is no longer needed it can be removed. The following
command removes the statically discovered iSCSI target:
SystemA:[/] # iscsiadm remove static-config 
iqn.1986-03.com.sun:02:bcc30560-378d-682b-9a98-872fafcc2093

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.

Database snapshots and cloning


The following sections describe the test procedures that were used to create database
snapshots, cloning, and rollback functionality on the Sun Storage 7000 Unified Storage
System.

Snapshots with NFS


The snapshot testing involved these general steps:
1. Generate MySQL data for use in a subsequent snapshot. In this case, data was
obtained from an existing MySQL database.
2. Create a default database on the client system hosting the database server. Take
the first snapshot, which comprises only the default tables. Next, load the data-
base with the data obtained previously. Take the second snapshot, which com-
prises the additional data.
3. Destroy database files on the base volume. Restore the database from the first
snapshot, and verify that the state is the same as that prior to the additional data
load.
4. Again, remove database files on the base volume. Restore the database from the
second snapshot, and verify that the state is the same as that following the addi-
tional data load.

Details of the snapshot testing, including step-by-step directions, follow:


1. Create a small test load from the client via a database backup of an existing
database:
a. Start the database server, and backup a desired database. This example cre-
ates a backup of the specdb database, and saves it as snapload.sql:
mysql> FLUSH TABLES WITH READ LOCK;
> mysqldump -uroot --databases specdb > snapload.sql
14 MySQL Guide for Sun Storage 7000 Unified Storage System Sun Microsystems, Inc.

b. Copy the backup file to the target directory and grant access permissions to the
file:
# cp snapload.sql /export/home/mysql/

2. Shutdown the existing server:


> mysqladmin -uroot shutdown

3. Modify the configuration file parameters (/etc/my.cnf), and update the 


datadir entry to specify the file system directory that should be used for the new
database.
4. Create a user named mysql. As user mysql, install the grant tables and create a
default database:
% mysql_install_db --basedir=/export/home/mysql/studio64-5124-rc 
--datadir=/diskam_nfs
$ mysqld &

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

$ mysql -uroot < snapload.sql

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.

b. On the GUI, click on Shares Tab to display a list of all shares.


c. Select the desired share (nfsvol1 in this example), and double-click to display
details for this share.
d. On the next screen, click on Snapshots.
e. On the next screen, click the + button against Snapshots to add a snapshot.
f. On the next screen, which prompts for a snapshot name, type in the name
(secondsnap in this example) and press Apply or the Enter key.
g. The new snapshot entry is now listed on the screen.
h. Take the database out of hot-backup mode.
8. Destroy some base database files, including those of the specdb database:
$ rm -rf /export/nfsvol1/ib* /export/nfsvol1/specdb

9. Restore the database from the first snapshot:


a. On the GUI, click on Shares Tab.
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. Select the desired snapshot to restore (firstsnap in this example).
e. Click on Restore.
10. Restart the database server to verify the existence of the restored data. Then, shut-
down the database server.
11. Repeat Step 8, and destroy some database files. Ensure that the specdb directory
itself is not deleted.
12. Repeat Step 9, choosing secondsnap as the snapshot name. After the restore,
repeat Step 10 to verify the existence and accessing of the specdb database.

Cloning with NFS


This section describes the procedures used to test cloning on the Sun Storage 7000
Unified Storage System using NFS. This example assumes that the volume
nfstest/nvsvol1 and the snapshot secondsnap have already been created.

The first step is to create a clone of an existing snapshot.


1. As user mysqlk, login to the Sun Storage 7000 Unified Storage System GUI, and
navigate to the desired share. For example, the following command navigates to
the volume nfsvol1 in the project nfstest:
https://server_name:215/#shares=nfstest/nfsvol1

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

3. Start up the MySQL server with the clone data directory


$ mysqld &

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

5. Shutdown the server:


$ mysql -uroot shutdown

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

7. Restart the server.


$ mysqld &

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.

Rollback with NFS


The following procedure was used to test the Sun Storage 7000 Unified Storage System
rollback functionality using NFS.
1. Shutdown the MySQL database server:
$ mysql -uroot shutdown

2. Manually delete the ib_logfile0 MySQL data file.


3. Issue the following command on the MySQL database server:
$ ssh -l mysqlk IP-address confirm shares select nfstest
select nfsvol1 snapshots select snapshot_name rollback

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.

Snapshots and cloning with iSCSI


Taking a snapshot and a clone with iSCSI is similar to the procedure taken for an NFS
share.

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.

About the authors


William Aiken works in the Open Source software group at Sun, porting Open Source
applications to the Solaris operating system and interacting with Open Source
communities. Prior to this activity, he worked with several commercial companies to
optimize the performance of their mathematical and finite element modeling codes on
Sun systems.

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

Ordering Sun documents


The SunDocsSM program provides more than 250 manuals from Sun Microsystems, Inc.
If you live in the United States, Canada, Europe, or Japan, you can purchase
documentation sets or individual manuals through this program.

Accessing Sun documentation online


The docs.sun.com web site enables you to access Sun technical documentation
online. You can browse the docs.sun.com archive or search for a specific book title
or subject. The URL is 
http://docs.sun.com/

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

You might also like