重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
配置环境信息:
Redhat7 target:192.168.23.10
Redhat7 initiator:192.168.23.20
Windows10 initiator:192.168.23.1
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名注册、网络空间、营销软件、网站建设、仁化网站维护、网站推广。
问题:在192.168.23.20客户端扫描服务端,没有发现资源。
第一步:检查网络连通性,网络正常。
第二步:检查initiator文件中写入的客户端名称与target目录中acls的参数一致
[root@client Desktop]# cat /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3c9133ae8aee:client
o- iscsi ............................................................................................................ [Targets: 1]
| o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3c9133ae8aee ....................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 1]
| | o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3c9133ae8aee:client ................................... [Mapped LUNs: 1]
检查结果表示一致!
第三步:检查initiator的服务状态
[root@client Desktop]# systemctl restart iscsid
[root@client Desktop]# systemctl status iscsid
iscsid.service - Open-iSCSI
Loaded: loaded (/usr/lib/systemd/system/iscsid.service; enabled)
Active: active (running) since Fri 2020-02-07 08:42:17 EST; 10s ago
Docs: man:iscsid(8)
man:iscsiadm(8)
Process: 3950 ExecStop=/sbin/iscsiadm -k 0 2 (code=exited, status=0/SUCCESS)
Process: 3955 ExecStart=/usr/sbin/iscsid (code=exited, status=0/SUCCESS)
Main PID: 3957 (iscsid)
CGroup: /system.slice/iscsid.service
├─3956 /usr/sbin/iscsid
└─3957 /usr/sbin/iscsid
Feb 07 08:42:17 client systemd[1]: Starting Open-iSCSI...
Feb 07 08:42:17 client systemd[1]: Failed to read PID from file /var/run/iscsid.pid: Invali...ment
Feb 07 08:42:17 client iscsid[3956]: iSCSI daemon with pid=3957 started!
Feb 07 08:42:17 client systemd[1]: Started Open-iSCSI.
Hint: Some lines were ellipsized, use -l to show in full.
检查结果表示,运行正常!
第四步:检查target的服务状态
[root@localhost Desktop]# systemctl status targetd
targetd.service - targetd storage array API daemon
Loaded: loaded (/usr/lib/systemd/system/targetd.service; enabled)
Active: failed (Result: exit-code) since Fri 2020-02-07 07:45:27 EST; 11s ago
Process: 3597 ExecStart=/usr/bin/targetd (code=exited, status=255)
Main PID: 3597 (code=exited, status=255)
Feb 07 07:45:27 localhost.localdomain systemd[1]: Starting targetd storage array API daemon...
Feb 07 07:45:27 localhost.localdomain systemd[1]: Started targetd storage array API daemon.
Feb 07 07:45:27 localhost.localdomain targetd[3597]: CRITICAL:root:password not set in /etc/target/targetd.yaml
Feb 07 07:45:27 localhost.localdomain systemd[1]: targetd.service: main process exited, code=exited, status=255/n/a
Feb 07 07:45:27 localhost.localdomain systemd[1]: Unit targetd.service entered failed state.
iSCSI服务运行有报错,“ CRITICAL:root:password not set in /etc/target/targetd.yaml”。
查看该文件/etc/target/targetd.yaml,网上搜索该文件的相关配置文档,未果,后续待补充。
自我尝试配,未果。
此时,依据现有信息无法判断我的iSCSI target是否配置正常。
但是按照网络一个文档提示,该报错并不影响服务正常使用,initiator依然可以发现target。
第五步:在Windows 客户都尝试扫描 iSCSI共享资源,未果,没有搜索到。
此时,基本可以判断我的iSCSI target配置有问题,列出target所有目录进行检查。
[root@localhost Desktop]# targetcli
targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 1]
| | o- desk0 ........................................................................... [/dev/md0 (40.0GiB) write-thru activated]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 1]
| o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3c9133ae8aee ....................................................... [TPGs: 1]
| o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
| o- acls .......................................................................................................... [ACLs: 1]
| | o- iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3c9133ae8aee:client ................................... [Mapped LUNs: 1]
| | o- mapped_lun0 ................................................................................. [lun0 block/desk0 (rw)]
| o- luns .......................................................................................................... [LUNs: 1]
| | o- lun0 ......................................................................................... [block/desk0 (/dev/md0)]
| o- portals .................................................................................................... [Portals: 1]
| o- 192.168.23.20:3260 ............................................................................................... [OK]
o- loopback ......................................................................................................... [Targets: 0]
逐行检查,问题发现了,提供访问共享资源的网卡地址写错了,正确的应该是192.168.23.10。
第六步:修改正确的TCP/IP地址。
通过help可得删除命令。
/iscsi/iqn.20.../tpg1/portals> help
删除错误的TCP/IP信息:
/iscsi/iqn.20.../tpg1/portals> delete 192.168.23.20 3260
Deleted network portal 192.168.23.20:3260
添加正确的TCP/IP信息:
/iscsi/iqn.20.../tpg1/portals> create 192.168.23.10
Using default IP port 3260
Created network portal 192.168.23.10:3260.
重启服务,initiator再次尝试扫描。
[root@client Desktop]# iscsiadm -m discovery -t sendtargets -p 192.168.23.10
192.168.23.10:3260,1 iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.3c9133ae8aee
总结,targetd.yaml关于root password的保存不影响iSCSI服务的正常运行。