Aim
To set a test environment for MYSQL tests i.e. apache benchmark split from production. To achieve this
FlexClone license at least on the controller having the data must be available.
Check volumes involved. Create clones.
Check that the size and snap reservation is ok, otherwise add some space:
[mysql@dbvrtg046 mysql]$ mount
dbnasg405:/vol/drupal03 on /ORA/dbs03/DRUPAL type nfs (rw,remount,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,timeo=600,addr=172.31.132.3)
dbnasg301:/vol/drupal02 on /ORA/dbs02/DRUPAL type nfs (rw,remount,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,timeo=600,addr=172.31.132.1)
dbnasg406:/vol/drupal04 on /ORA/dbs04/DRUPAL type nfs (rw,remount,hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,timeo=600,addr=172.31.132.4)
dbnasg405> df -Ah # Total space report
Aggregate total used avail capacity
dbdskg409 40TB 16TB 24TB 40%
dbdskg409/.snapshot 0TB 0TB 0TB ---%
dbnasg405> vol size drupal03
vol size: Flexible volume 'drupal03' has size 100g.
-- In case needed use to set a new size: vol size VOLNAME XXXg
dbnasg405> vol autosize drupal03
Volume autosize is currently ON for volume 'drupal03'.
The volume is set to grow to a maximum of 200 GB, in increments of 5 GB.
-- In case needed use to autosize to set a new one: vol autosize VOLNAME -m XXXg -i Xg on
dbnasg405> snap reserve drupal03
Volume drupal03: current snapshot reserve is 20% or 20971520 k-bytes.
-- It not set use: snap reserve VOLNAME PERCENTAGE
-- Please think that if you set i.e. 20% that means that for a volume of 100g the effective size will be 80g plus 20g of snapshot space.
dbnasg405> snap list drupal03 --snapshots available
Volume drupal03
working...
%/used %/total date name
---------- ---------- ------------ --------
2% ( 2%) 0% ( 0%) Jun 09 14:57 snapscript_09062011_170006_56
5% ( 3%) 0% ( 0%) Jun 08 14:57 snapscript_08062011_170010_55
8% ( 3%) 0% ( 0%) Jun 07 14:57 snapscript_07062011_170003_52
10% ( 3%) 1% ( 0%) Jun 06 14:57 snapscript_06062011_170004_50
12% ( 2%) 1% ( 0%) Jun 05 14:57 snapscript_05062011_170004_49
13% ( 1%) 1% ( 0%) Jun 04 14:57 snapscript_04062011_170004_48
If everthing is ok create the clones.
Check the clone license is on:
license
...
flex_clone XXXXXX
....
If set then proceed:
vol clone create clonedrupal03 -b drupal03 snapscript_09062011_170006_56
Naming convention: l any clone should be called like cloneVOLNAME .
You should see sth like when listing snapshots:
dbnasg405> snap list drupal03
Volume drupal03
working...
%/used %/total date name
---------- ---------- ------------ --------
2% ( 2%) 0% ( 0%) Jun 09 14:57 snapscript_09062011_170006_56 (busy,vclone)
5% ( 3%) 0% ( 0%) Jun 08 14:57 snapscript_08062011_170010_55
8% ( 3%) 0% ( 0%) Jun 07 14:57 snapscript_07062011_170003_52
Please repeat for the binary logs. You may need to create an snapshot, then after checking you have enough space do:
snap reserve drupal02 20
snap create drupal02 fortest
And again:
vol clone create clonedrupal02 -b drupal02 fortest
In this way all data needed to open the database is there and independent from production.
Create a mysql instance based on clone volumes.
The recommended way will be to use a server with no mount points on production volumes.
For this run we use a server which is a passive node in a cluster. Therefore extra care must be taken in order to avoid touching the production.
First mount the clones:
mkdir -p /ORA/dbs10/DRUPAL
chown mysql:mysql /ORA/dbs10/DRUPAL
mkdir -p /ORA/dbs13/DRUPAL
chown mysql:mysql /ORA/dbs13/DRUPAL
sudo mount -o hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,timeo=600 dbnasg301:/vol/clonedrupal02 /ORA/dbs10/DRUPAL
sudo mount -o hard,nointr,rsize=32768,wsize=32768,tcp,actimeo=0,timeo=600 dbnasg405:/vol/clonedrupal03 /ORA/dbs13/DRUPAL
Change my.cnf properties at the clone location: /ORA/dbs13/MYSQL/brtest/my.cnf .
IMPORTANT: datadir, log-bin,port, socket, any variable involving a production location:
port=5501
socket=/tmp/drupal.sock
datadir=/ORA/dbs13/DRUPAL/mysql
log-bin=/ORA/dbs10/DRUPAL/mysql/binlog
general-log-file=/ORA/dbs13/DRUPAL/mysql/mysql.log
slow_query_log_file=/ORA/dbs13/DRUPAL/mysql/slow_queries.log
Start/Stop the server:
--start as mysql
mysqld_safe --defaults-file=/ORA/dbs13/MYSQL/brtest/my.cnf
--stop
mysqladmin -u PRIVILAGEUSER -pXXXXXXX -P 5501 -h hostname shutdown
Clean-up
Once you have stop mysqld, please go the the appropiate controller and do:
vol offline cloneVOLNAME
vol destroy cloneVOLNAME
PLEASE consult with a NAS expert before any information destruction/deletion.
--
RubenGaspar - 10-Jun-2011