Implementation of ISCSI shared storage on RHEL5

Source: Internet
Author: User
Recently, Sun summarized the documents for installing RAC in the VMware environment and did not involve the concept of shared storage, which was a little inadequate. So I pushed forward to the layer and used ISCSI to simulate shared storage disk arrays, after a thorough study, I sorted out the notes as follows. The script was from Tang SIR. I continued my work, haha... Environment: SERVER: RHEL5.464-bit, IP Address: 192.168.50.7 client 1: REHL6.064-bit, IP Address: 192.1

Recently, Sun summarized the documents for installing RAC in the VMware environment and did not involve the concept of shared storage, which was a little inadequate. So I pushed forward to the layer and used ISCSI to simulate shared storage disk arrays, after a thorough study, I sorted out the notes as follows. The script was from Tang SIR. I continued my work, haha...

Environment Introduction:
Server: RHEL5.4 64-bit, IP Address: 192.168.50.7
Client 1: REHL6.0 64-bit, IP Address: 192.168.50.4
Client 2: REHL5.4 64-bit, IP Address: 192.168.50.195

I. server side:
First, install the scsi-target-utils toolkit, set the tgtd service to automatically start upon startup, and then specify a gb lvm as a shared disk array. The name of LVM is data.
[Root @ rhel5 ~] # Yum-y install scsi-target-utils.x86_64
[Root @ rhel5 ~] # Service tgtd start
Starting SCSI target daemon: Starting target framework daemon
[Root @ rhel5 ~] # Chkconfig tgtd on
[Root @ rhel5 ~] # Lvs
Lv vg Attr LSize Origin Snap % Move Log Copy % Convert
Data VolGroup00-wi-ao 100.00G
Lv_data VolGroup00-wi-ao 50.00G
Lv_root VolGroup00-wi-ao 29.28G
Oracle10g_1 VolGroup00-wi-ao 100.00G

Every time you restart the tgtd service, the target and logicalunit bound with tgtdadmin will be invalid. Therefore, a script is written to simplify the operation.
IQN naming convention: iqn. date. reverse. domain. name: optional name, for example: iqn.2011-06-01.com. 766.rac: shareddisk
All IP addresses are allowed to be mounted. To unbind a target, you need to cancel logicalunit and then cancel target.

  1. [Root @ rhel5 ~] # Cat/etc/init. d/tgtdrules
  2. #! /Bin/sh
  3. #/Etc/rc. d/init. d/oracle
  4. # Chkconfig:-59 85
  5. # Description: oracle10g is meant to run under Linux Oracle Server
  6. # Source function library.
  7.  
  8. ./Etc/rc. d/init. d/functions
  9.  
  10. Start (){
  11. Echo-e "Starting Tgtdrules Server: \ n"
  12.  
  13. # Target
  14. Tgtadm -- lld iscsi -- op new -- mode target -- tid 1-T iqn.2011-06-01.com. 766.rac: shareddisk
  15.  
  16. # Lun
  17. Tgtadm -- lld iscsi -- op new -- mode logicalunit -- tid 1 -- lun 1-B/dev/VolGroup00/data
  18.  
  19. # Init
  20. # Tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-I 192.168.50.191
  21. # Tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-I 192.168.50.192
  22. Tgtadm -- lld iscsi -- op bind -- mode target -- tid 1-I ALL
  23. }
  24.  
  25. Stop (){
  26. Echo-e "Stopping Tgtdrules Server: \ n"
  27.  
  28. # Lun
  29. Tgtadm -- lld iscsi -- op delete -- mode logicalunit -- tid 1 -- lun 1
  30.  
  31. # Target
  32. Tgtadm -- lld iscsi -- op delete -- mode target -- tid 1
  33.  
  34. # Init
  35. # Tgtadm -- lld iscsi -- op unbind -- mode target -- tid 1-I 192.168.50.191
  36. # Tgtadm -- lld iscsi -- op unbind -- mode target -- tid 1-I 192.168.50.192
  37. Tgtadm -- lld iscsi -- op unbind -- mode target -- tid 1-I ALL
  38. }
  39.  
  40.  
  41. Status (){
  42. Tgtadm -- lld iscsi-o show-m target}
  43.  
  44.  
  45. Case "$1" in
  46.  
  47. Start)
  48. Start
  49. ;;
  50.  
  51. Stop)
  52. Stop
  53. ;;
  54.  
  55. Status)
  56. Status
  57. ;;
  58.  
  59. *)
  60. Echo $ "Usage: tgtdrules {start | stop | status }"
  61. ;;
  62.  
  63. Esac
  64.  
  65. Exit 0
  66.  
  67. Server test:
  68. [Root @ rhel5 ~] # Service tgtd status
  69. Tgtd (pid 2943 2942) is running...
  70.  
  71. [Root @ rhel5 ~] # Netstat-ntpl | grep: 3260
  72. Tcp 0 0 0.0.0.0: 3260 0.0.0.0: * LISTEN 2942/tgtd
  73. Tcp 0 0: 3260: * LISTEN 2942/tgtd
  74.  
  75. [Root @ rhel5 ~] # Service tgtdrules start
  76. Starting Tgtdrules Server:
  77.  
  78. [Root @ rhel5 ~] # Service tgtdrules status
  79. Target 1: iqn.2011-06-01.com. 766.rac: shareddisk
  80. System information:
  81. Driver: iscsi
  82. State: ready
  83. I _T nexus information:
  84. I _T nexus: 1
  85. Initiator: iqn.1994-05.com. RedHat: b1beb63e2617
  86. Connection: 0
  87. IP Address: 192.168.50.4
  88. LUN information:
  89. LUN: 0
  90. Type: controller
  91. Scsi id: IET 00010000
  92. Scsi sn: beaf10
  93. Size: 0 MB
  94. Online: Yes
  95. Removable media: No
  96. Backing store type: null
  97. Backing store path: None
  98. Backing store flags:
  99. LUN: 1
  100. Type: disk
  101. Scsi id: IET 00010001
  102. Scsi sn: beaf11
  103. Size: 107374 MB
  104. Online: Yes
  105. Removable media: No
  106. Backing store type: rdwr
  107. Backing store path:/dev/VolGroup00/data
  108. Backing store flags:
  109. Account information:
  110. ACL information:
  111. ALL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.