{"id":563,"date":"2013-02-19T10:44:59","date_gmt":"2013-02-19T10:44:59","guid":{"rendered":"http:\/\/10sa.com\/sql_stories\/?p=563"},"modified":"2014-08-26T13:02:44","modified_gmt":"2014-08-26T13:02:44","slug":"iscsi-with-mysql","status":"publish","type":"post","link":"http:\/\/10sa.com\/sql_stories\/?p=563","title":{"rendered":"iscsi with MySQL"},"content":{"rendered":"<p>When the economy meets the performance the iScsi comes into play!<br \/>\nI am using 1Gb ethernet between the target and the initiator (both on CentOs 6.3).<br \/>\nThe target consists of the 3ware controller with 4 SSD Ocz Vertex 3. So, the backing-store is the device \/dev\/sda\/ (\/etc\/tgt\/targets.conf).<br \/>\nNext, Parted and LVM configured on the target with xfs.<\/p>\n<pre lang=\"bash\">parted \/dev\/sde\r\nmklabel gpt\r\nmkpart \r\n\r\n[name] primary\r\n[fs] xfs\r\n[start] 0%\r\n[stop] 100%\r\n\r\nset 1 lvm on<\/pre>\n<pre>pvcreate \/dev\/sde1\r\nvgcreate vg_s7v0_ssd \/dev\/sde1\r\nlvcreate -C y -n data -l 98%FREE vg_s7v0_ssd # rest for snapshot\r\nmkfs.xfs -f -d su=256k,sw=3 \/dev\/vg_s7v0_ssd\/data\r\nsu = &lt; RAID controllers stripe size in BYTES (or KiBytes when used with k) &gt;\r\nsw = &lt;# of data disks (don't count parity disks)&gt;\r\n\r\nxfx_info  \/dev\/vg_s7v0_ssd\/data<\/pre>\n<p>The problem I encountered was that after target reboot it used isci device (configured on target) locally. So it was impossible to connect it to the initiator&#8230; The solution was to set the filters on the target. However, it did NOT work when the rule &#8220;a\/.*\/&#8221; was in the config. This is my case (only one &#8220;variable&#8221; filter is used):<\/p>\n<pre lang=\"bash\"># By default we accept every block device:\r\nfilter = [ \"r|\/dev\/sda1|\", \"r|\/dev\/sda|\", \"a|\/dev\/sdd|\", \"a|\/dev\/sdc|\" ]<\/pre>\n<p>You have to ensure that the initiator connect to the target on startup, you do it with the following command<\/p>\n<pre lang=\"bash\">iscsiadm -m node --target iqn.2012.local.fs07:ssd.lun0 -p 10.0.0.1 --op update -n node.startup -v automatic<\/pre>\n<p>Add to the grub.conf elevator=noop (io scheduling mode) and mount with the options noatime,nodiratime,nobarrier.<br \/>\nIf you use iscsi &#8211; add &#8220;_netdev&#8221; (device requires network to be available) &#8211; thank God! \ud83d\ude42<\/p>\n<pre lang=\"bash\">UUID=\"79a594d6-de0b-477c-bad5-8f4bc77267be\" \/db_storage_ssd xfs noatime,nodiratime,nobarrier,_netdev 0 0<\/pre>\n<p>Finally, I obtained the following numbers on SSD RAID 10 (measured with sysbench)<\/p>\n<pre lang=\"bash\">200Mb total file size\r\nBlock size 16Kb\r\nNumber of random requests for random IO: 10000\r\nRead\/Write ratio for combined random IO test: 1.50\r\nCalling fsync() at the end of test, Enabled.\r\nOperations performed:  0 Read, 10000 Write, 1 Other = 10001 Total\r\nRead 0b  Written 156.25Mb  Total transferred 156.25Mb  (80.4Mb\/sec)\r\n 5145.57 Requests\/sec executed\r\n\r\nOperations performed:  10000 Read, 0 Write, 0 Other = 10000 Total\r\nRead 156.25Mb  Written 0b  Total transferred 156.25Mb  (110.72Mb\/sec)\r\n 7085.88 Requests\/sec executed<\/pre>\n<p>Common administration tasks on target:<br \/>\nDynamic initiator management:<\/p>\n<pre lang='bash'>\r\n# add ACL\r\ntgtadm --lld iscsi --mode target --op bind --tid 4 --initiator-address 10.0.15.206\r\n# del ACL\r\ntgtadm --lld iscsi --mode target --op unbind --tid 4 --initiator-address 10.0.15.206\r\n\r\ninsert new initiator and then start it (w\/o restarting services)\r\n\r\n\t# Update configuration for targets. Only targets which\r\n        # are not in use will be updated.\r\n\/etc\/init.d\/tgtd reload \r\n<\/pre>\n<p>Common administration tasks on initiator:<br \/>\nDisconnect initiator on lvm (clean)<\/p>\n<pre lang='bash'>\r\numount \/db_storage_ssd1\r\numount \/db_storage_ssd2\r\nvgchange -ay vg_mysql_ssd1 && vgchange -ay vg_mysql_ssd2\r\niscsiadm -d 1 --mode node -p 10.0.15.233 --logout all\r\n# or separately\r\niscsiadm -d 1 --mode node --target iqn.2012.local.fs05:ssd.lun0 -p 10.0.15.233 --logout\r\n\r\n# active sessions\r\niscsiadm -m session\r\n# detailed\r\niscsiadm -m session -P1\r\n\r\nYou can find very interesting information in one of Oracle'a White Paper about\r\n<a href=\"http:\/\/10sa.com\/sql_stories\/wp-content\/uploads\/2013\/02\/mysql-and-linux-wp-2158217.pdf\">sun Flash Accelerator f80 PCIe Card<\/a><\/pre>\n<p> (another elevator and with another fs &#8211; ext4).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When the economy meets the performance the iScsi comes into play! I am using 1Gb ethernet between the target and the initiator (both on CentOs 6.3). The target consists of the 3ware controller with 4 SSD Ocz Vertex 3. So, the backing-store is the device \/dev\/sda\/ (\/etc\/tgt\/targets.conf). Next, Parted and LVM configured on the target [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,18],"tags":[],"_links":{"self":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts\/563"}],"collection":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=563"}],"version-history":[{"count":34,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts\/563\/revisions"}],"predecessor-version":[{"id":888,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=\/wp\/v2\/posts\/563\/revisions\/888"}],"wp:attachment":[{"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=563"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/10sa.com\/sql_stories\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}