这篇文章主要讲解了“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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。