实战: 配置一个IP SAN 存储服务器

随笔2个月前发布 谭玲
32 0 0

IP-SAN的运行模式:C/S模式,工作端口3260

服务端:host1

客户端:host2,host3

 

base环境配置

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

hostnamectl set-hostname host1
hostnamectl set-hostname host2
hostnamectl set-hostname host3
 
cat>>/etc/hosts<<EOF
192.168.40.130 host1
192.168.40.131 host2
192.168.40.132 host3
EOF
 
setenforce 0
 
sed -i "s#enforcing#disabled#g" /etc/selinux/config
 
systemctl stop firewalld
systemctl disable firewalld
init 0

服务端

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

yum install -y scsi-target-utils
查看配置文件
ls  /etc/tgt/targets.conf
查看服务端启动命令路径
find / -name "*tgtd"
/etc/sysconfig/tgtd
/etc/selinux/targeted/active/modules/100/tgtd
/usr/sbin/tgtd
 
 
启动
/usr/sbin/tgtd start
netstat -antup | grep 3260
systemctl enable tgtd.service
 
fdisk /dev/sdb 创建/dev/sdb1 /dev/sdb2
 
重启
 
vim /etc/tgt/targets.conf
 
<target iqn.2024-04.host1:target_san1>
backing-store /dev/sdb1
initiator-address 192.168.40.131
initiator-address 192.168.40.130
vendor_id host1
product_id target1
</target>
 
 
 
<target iqn.2024-04.host1:target_san2>
backing-store /dev/sdb2
initiator-address 192.168.40.131
initiator-address 192.168.40.130
vendor_id host1
product_id target2
</target>
 
 
 
initiator-address 设置可以访问的客户端的ip地址
systemctl restart tgtd
systemctl status tgtd

  

客户端

 

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

yum install -y iscsi-initiator-utils
 
iscsiadm -m discovery -t sendtargets -p 192.168.40.130:3260
192.168.40.130:3260,1 iqn.2024-04.host1:target_san1
192.168.40.130:3260,1 iqn.2024-04.host1:target_san2
systemctl start iscsid
systemctl start iscsi
ls /dev/sdb
 
关闭:
systemctl stop iscsi
systemctl stop iscsid
 
卸载
iscsiadm -m node -T iqn.2024-04.host1:target_san1 -u
iscsiadm -m node -T iqn.2024-04.host1:target_san2 -u
 
登录存储存储设备
iscsiadm -m node -T iqn.2024-04.host1:target_san1 -l
iscsiadm -m node -T iqn.2024-04.host1:target_san2 -l

  

 

 

 

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...