您好,登錄后才能下訂單哦!
這篇文章主要講解了“Centos7怎么安裝iscsi”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“Centos7怎么安裝iscsi”吧!
搭建數據庫RAC環境,使用ISCSI服務模擬存儲服務器,之前使用的是Linux 6系列所以發現7不同,特此記錄:
服務器安裝targetcli
# yum -y install targetcli
啟動target服務
# systemctl start target
設置開機啟動服務
# systemctl enable target
開始創建
進入targetcli
#targetcli
步驟1:建立一個塊存儲
注意:server1.disk(名稱server1可自定義),/dev/sdb1為上面新建的分區名稱。
/backstores/fileio> /backstores/block create disk_ocr1 /dev/sdb
Created block storage object disk_ocr1 using /dev/sdb.
/backstores/fileio> /backstores/block create disk_ocr2 /dev/sdc
Created block storage object disk_ocr2 using /dev/sdc.
/backstores/fileio> /backstores/block create disk_ocr3 /dev/sdd
Created block storage object disk_ocr3 using /dev/sde.
/backstores/fileio> /backstores/block create disk_data1 /dev/sde
Created block storage object disk_data1 using /dev/sde.
/backstores/fileio> /backstores/block create disk_data2 /dev/sdf
Created block storage object disk_data2 using /dev/sdf.
/backstores/fileio> /backstores/block create disk_data3 /dev/sdg
Created block storage object disk_data3 using /dev/sdg.
/backstores/fileio> /backstores/block create disk_data4 /dev/sdh
Created block storage object disk_data4 using /dev/sdh.
步驟2:配置ISCSITarget命名
注意:命名在同一子網內確保是唯一的,命名格式為:iqn.yyyy-mm.<主機名反寫>:自定義名稱(自定義名稱內不能有下劃線)
/backstores/fileio> /iscsi create iqn.2019-04.com.rac18cc:server
Created target iqn.2019-04.com.rac18cc:server.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
步驟3:創建ACL允許ISCSI客戶機連接
注意:iqn.2019-04.com.rac18cc:server:client1為客戶機ISCSI名稱。
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/acls create iqn.2019-04.com.rac18cc:beijing
Created Node ACL for iqn.2019-04.com.rac18cc:beijing
步驟4:創建lun(target塊設備的邏輯單元)
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_ocr1
Created LUN 0.
Created LUN 0->0 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_ocr2
Created LUN 1.
Created LUN 1->1 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_ocr3
Created LUN 2.
Created LUN 2->2 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data1
Created LUN 3.
Created LUN 3->3 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data2
Created LUN 4.
Created LUN 4->4 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data3
Created LUN 5.
Created LUN 5->5 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
/backstores/fileio> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data4
Created LUN 6.
Created LUN 6->6 mapping in node ACL iqn.2019-04.com.rac18cc:beijing
步驟5:創建ip與端口
/> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/portals create 192.168.8.88
或
/>cd /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/portals
/>create 192.168.8.88:3260
注:192.168.8.88為服務器IP;不指定端口默認為3260
步驟6:配置驗證用戶名和密碼(這里可以省略)
/>cd
/iscsi/iqn.2017-05.com.mwdserver:iscsimwd1/tpg1/acls/iqn.2017-05.com.mwdinit:initmwd1
/>set auth userid=test
/>set auth password=test
步驟7:配置完成后查看配置信息,并退出。
/>cd /
/>ls
/>exit
客戶端:
安裝:
# yum -y install iscsi-initiator-utils
注:Ubuntu下比較方便好用的initiator是open iscsi:
apt-get install -y open-iscsi
啟動iscsi服務:
# systemctl start iscsi
設置為開機自啟動服務:
# systemctl enable iscsi
配置ISCSIInitiator名稱(此處InitiatorName須與服務端配置的ACL允許ISCSI客戶機連接的名稱一致):
# vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:d36e6c6eb661
修改為:
InitiatorName=iqn.2019-04.com.rac18cc:beijing
此處定義的Initiator名字要和在存儲節點中定義ACL時使用的主機名字一致。
#vi /etc/iscsi/iscsid.conf
# line 57: 取消注釋
node.session.auth.authmethod = CHAP
# line 61,62: 取消注釋 and specify the username and password you set on the iSCSI target server
node.session.auth.username = username
node.session.auth.password = password
# 發現target
[root@rac18c1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.8.88
192.168.8.88:3260,1 iqn.2019-04.com.rac18cc:server
[root@rac18c1 ~]# iscsiadm -m node -o show
# BEGIN RECORD 6.2.0.874-10
node.name = iqn.2019-04.com.rac18cc:server
node.tpgt = 1
node.startup = automatic
node.leading_login = No
iface.hwaddress = <empty>
iface.ipaddress = <empty>
iface.iscsi_ifacename = default
iface.net_ifacename = <empty>
iface.gateway = <empty>
iface.subnet_mask = <empty>
iface.transport_name = tcp
iface.initiatorname = <empty>
iface.state = <empty>
iface.vlan_id = 0
iface.vlan_priority = 0
iface.vlan_state = <empty>
iface.iface_num = 0
iface.mtu = 0
iface.port = 0
iface.bootproto = <empty>
iface.dhcp_alt_client_id_state = <empty>
iface.dhcp_alt_client_id = <empty>
iface.dhcp_dns = <empty>
iface.dhcp_learn_iqn = <empty>
iface.dhcp_req_vendor_id_state = <empty>
iface.dhcp_vendor_id_state = <empty>
iface.dhcp_vendor_id = <empty>
iface.dhcp_slp_da = <empty>
iface.fragmentation = <empty>
iface.gratuitous_arp = <empty>
iface.incoming_forwarding = <empty>
iface.tos_state = <empty>
iface.tos = 0
iface.ttl = 0
iface.delayed_ack = <empty>
iface.tcp_nagle = <empty>
iface.tcp_wsf_state = <empty>
iface.tcp_wsf = 0
iface.tcp_timer_scale = 0
iface.tcp_timestamp = <empty>
iface.redirect = <empty>
iface.def_task_mgmt_timeout = 0
iface.header_digest = <empty>
iface.data_digest = <empty>
iface.immediate_data = <empty>
iface.initial_r2t = <empty>
iface.data_seq_inorder = <empty>
iface.data_pdu_inorder = <empty>
iface.erl = 0
iface.max_receive_data_len = 0
iface.first_burst_len = 0
iface.max_outstanding_r2t = 0
iface.max_burst_len = 0
iface.chap_auth = <empty>
iface.bidi_chap = <empty>
iface.strict_login_compliance = <empty>
iface.discovery_auth = <empty>
iface.discovery_logout = <empty>
node.discovery_address = 192.168.8.88
node.discovery_port = 3260
node.discovery_type = send_targets
node.session.initial_cmdsn = 0
node.session.initial_login_retry_max = 8
node.session.xmit_thread_priority = -20
node.session.cmds_max = 128
node.session.queue_depth = 32
node.session.nr_sessions = 1
node.session.auth.authmethod = CHAP
node.session.auth.username = <empty>
node.session.auth.password = <empty>
node.session.auth.username_in = <empty>
node.session.auth.password_in = <empty>
node.session.timeo.replacement_timeout = 120
node.session.err_timeo.abort_timeout = 15
node.session.err_timeo.lu_reset_timeout = 30
node.session.err_timeo.tgt_reset_timeout = 30
node.session.err_timeo.host_reset_timeout = 60
node.session.iscsi.FastAbort = Yes
node.session.iscsi.InitialR2T = No
node.session.iscsi.ImmediateData = Yes
node.session.iscsi.FirstBurstLength = 262144
node.session.iscsi.MaxBurstLength = 16776192
node.session.iscsi.DefaultTime2Retain = 0
node.session.iscsi.DefaultTime2Wait = 2
node.session.iscsi.MaxConnections = 1
node.session.iscsi.MaxOutstandingR2T = 1
node.session.iscsi.ERL = 0
node.session.scan = auto
node.conn[0].address = 192.168.8.88
node.conn[0].port = 3260
node.conn[0].startup = manual
node.conn[0].tcp.window_size = 524288
node.conn[0].tcp.type_of_service = 0
node.conn[0].timeo.logout_timeout = 15
node.conn[0].timeo.login_timeout = 15
node.conn[0].timeo.auth_timeout = 45
node.conn[0].timeo.noop_out_interval = 5
node.conn[0].timeo.noop_out_timeout = 5
node.conn[0].iscsi.MaxXmitDataSegmentLength = 0
node.conn[0].iscsi.MaxRecvDataSegmentLength = 262144
node.conn[0].iscsi.HeaderDigest = None
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD
連接ISCSI設備:
iscsiadm -m node --login
# cat /proc/partitions
# iscsiadm --mode node --targetname iqn.2019-04.com.rac18cc:server --portal 192.168.8.88 --login
感謝各位的閱讀,以上就是“Centos7怎么安裝iscsi”的內容了,經過本文的學習后,相信大家對Centos7怎么安裝iscsi這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。