rh436 - iscsi服务端配置(rhel5.5)

2024-03-10 00:18

本文主要是介绍rh436 - iscsi服务端配置(rhel5.5),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

iscsi服务端配置


操作系统版本:

[root@ex333server ~]# lsb_release -a
LSB Version:    :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID:    RedHatEnterpriseServer
Description:    Red Hat Enterprise Linux Server release 5.5 (Tikanga)
Release:    5.5


创建如下两个用来共享的逻辑卷:
[root@ex333server ~]# lvs
  /dev/cdrom: open failed: No medium found
  LV            VG       Attr   LSize Origin Snap%  Move Log Copy%  Convert
  lv_iscsi_244  vg_iscsi -wi-a- 4.00M                                      
  lv_iscsi_demo vg_iscsi -wi-a- 4.00M          


安装软件包:
yum install scsi-target-utils

启动服务:
/etc/init.d/tgtd restart
chkconfig tgtd on


1. 通过命令配置iscsi服务端:
创建一个target:
tgtadm --lld iscsi --op new --mode target --tid=1 --targetname iqn.2012-05.com.example.ex333server:rdisks.demo

绑定共享设备到target:
tgtadm --lld iscsi --op new --mode=logicalunit --tid=1 --lun=1 --backing-store /dev/vg_iscsi/lv_iscsi_demo

设置可以访问共享的网段:
tgtadm --lld iscsi --op bind --mode=target --tid=1 --initiator-address=192.168.221.0/24

本地查看共享设备:
tgtadm --lld iscsi --op show --mode target

检查结果:
[root@ex333server init.d]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2012-05.com.example.ex333server:rdisks.demo
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 4 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/vg_iscsi/lv_iscsi_demo
    Account information:
    ACL information:
        192.168.221.0/24
[root@ex333server init.d]# service tgtd restart
Stopping SCSI target daemon: Stopping target framework daemon
                                                           [  OK  ]
Starting SCSI target daemon: Starting target framework daemon

[root@ex333server init.d]# tgtadm --lld iscsi --op show --mode target
[root@ex333server init.d]#

通过命令创建的iscsi共享在系统重启或服务重启后消失。


2. 通过配置文件创建iscsi共享:
vim /etc/tgt/targets.conf
<target iqn.2012-05.com.example:ex333server.demo>
    backing-store /dev/vg_iscsi/lv_iscsi_demo
    initiator-address 192.168.221.0/24
</target>

<target iqn.2012-05.com.example:ex333server.target244>
    backing-store /dev/vg_iscsi/lv_iscsi_244
    initiator-address 192.168.221.244
</target>
         

[root@ex333server tgt]# service tgtd restart
Stopping SCSI target daemon: Stopping target framework daemon
                                                           [  OK  ]
Starting SCSI target daemon: Starting target framework daemon

[root@ex333server tgt]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2012-05.com.example:ex333server.demo
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00010000
            SCSI SN: beaf10
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
        LUN: 1
            Type: disk
            SCSI ID: IET     00010001
            SCSI SN: beaf11
            Size: 4 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/vg_iscsi/lv_iscsi_demo
    Account information:
    ACL information:
        192.168.221.0/24
Target 2: iqn.2012-05.com.example:ex333server.target244
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00020000
            SCSI SN: beaf20
            Size: 0 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: None
        LUN: 1
            Type: disk
            SCSI ID: IET     00020001
            SCSI SN: beaf21
            Size: 4 MB
            Online: Yes
            Removable media: No
            Backing store type: rdwr
            Backing store path: /dev/vg_iscsi/lv_iscsi_244
    Account information:
    ACL information:
        192.168.221.244
[root@ex333server tgt]#


找台244的虚机当客户端测试下:
[root@localhost rules.d]# ifconfig bond0
bond0     Link encap:Ethernet  HWaddr 00:0C:29:F7:5A:00  
          inet addr:192.168.221.244  Bcast:192.168.221.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fef7:5a00/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:11680 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6070 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:6193467 (5.9 MiB)  TX bytes:901920 (880.7 KiB)

yum install iscsi-initiator-utils.x86_64
service iscsi restart
chkconfig iscsi on

[root@localhost init.d]# iscsiadm --mode discovery --type sendtargets --portal 192.168.221.254
192.168.221.254:3260,1 iqn.2012-05.com.example:ex333server.demo
192.168.221.254:3260,1 iqn.2012-05.com.example:ex333server.target244

[root@localhost init.d]# iscsiadm --mode node --targetname iqn.2012-05.com.example:ex333server.target244 --portal 192.168.221.254:3260 --login
Logging in to [iface: default, target: iqn.2012-05.com.example:ex333server.target244, portal: 192.168.221.254,3260]
Login to [iface: default, target: iqn.2012-05.com.example:ex333server.target244, portal: 192.168.221.254,3260]: successful


[root@localhost init.d]# fdisk -l

Disk /dev/sda: 85.8 GB, 85899345920 bytes
255 heads, 63 sectors/track, 10443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26        1330    10482412+  83  Linux
/dev/sda3            1331        1591     2096482+  82  Linux swap / Solaris

Disk /dev/sdb: 4 MB, 4194304 bytes
1 heads, 8 sectors/track, 1024 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/sdb doesn't contain a valid partition table

可以看到4M的sdb已经挂载到本地了。


小贴士:
无论时iscsi客户端还是服务端,包装完后服务都没有启动,在使用前需先启动相关服务;
较长的几个命令可直接在man里找(man tgtd,man iscsiadm);
记不清包的具体名称可通过yum的搜索功能:yum search scsi。


这篇关于rh436 - iscsi服务端配置(rhel5.5)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/792409

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

CentOS7安装配置mysql5.7 tar免安装版

一、CentOS7.4系统自带mariadb # 查看系统自带的Mariadb[root@localhost~]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64# 卸载系统自带的Mariadb[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7

hadoop开启回收站配置

开启回收站功能,可以将删除的文件在不超时的情况下,恢复原数据,起到防止误删除、备份等作用。 开启回收站功能参数说明 (1)默认值fs.trash.interval = 0,0表示禁用回收站;其他值表示设置文件的存活时间。 (2)默认值fs.trash.checkpoint.interval = 0,检查回收站的间隔时间。如果该值为0,则该值设置和fs.trash.interval的参数值相等。

NameNode内存生产配置

Hadoop2.x 系列,配置 NameNode 内存 NameNode 内存默认 2000m ,如果服务器内存 4G , NameNode 内存可以配置 3g 。在 hadoop-env.sh 文件中配置如下。 HADOOP_NAMENODE_OPTS=-Xmx3072m Hadoop3.x 系列,配置 Nam

wolfSSL参数设置或配置项解释

1. wolfCrypt Only 解释:wolfCrypt是一个开源的、轻量级的、可移植的加密库,支持多种加密算法和协议。选择“wolfCrypt Only”意味着系统或应用将仅使用wolfCrypt库进行加密操作,而不依赖其他加密库。 2. DTLS Support 解释:DTLS(Datagram Transport Layer Security)是一种基于UDP的安全协议,提供类似于

【Python编程】Linux创建虚拟环境并配置与notebook相连接

1.创建 使用 venv 创建虚拟环境。例如,在当前目录下创建一个名为 myenv 的虚拟环境: python3 -m venv myenv 2.激活 激活虚拟环境使其成为当前终端会话的活动环境。运行: source myenv/bin/activate 3.与notebook连接 在虚拟环境中,使用 pip 安装 Jupyter 和 ipykernel: pip instal

沁恒CH32在MounRiver Studio上环境配置以及使用详细教程

目录 1.  RISC-V简介 2.  CPU架构现状 3.  MounRiver Studio软件下载 4.  MounRiver Studio软件安装 5.  MounRiver Studio软件介绍 6.  创建工程 7.  编译代码 1.  RISC-V简介         RISC就是精简指令集计算机(Reduced Instruction SetCom

log4j2相关配置说明以及${sys:catalina.home}应用

${sys:catalina.home} 等价于 System.getProperty("catalina.home") 就是Tomcat的根目录:  C:\apache-tomcat-7.0.77 <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" /> 2017-08-10

DM8数据库安装后配置

1 前言 在上篇文章中,我们已经成功将库装好。在安装完成后,为了能够更好地满足应用需求和保障系统的安全稳定运行,通常需要进行一些基本的配置。下面是一些常见的配置项: 数据库服务注册:默认包含14个功能模块,将这些模块注册成服务后,可以更好的启动和管理这些功能;基本的实例参数配置:契合应用场景和发挥系统的最大性能;备份:有备无患;… 2 注册实例服务 注册了实例服务后,可以使用系统服务管理,

配置InfiniBand (IB) 和 RDMA over Converged Ethernet (RoCE) 网络

配置InfiniBand (IB) 和 RDMA over Converged Ethernet (RoCE) 网络 服务器端配置 在服务器端,你需要确保安装了必要的驱动程序和软件包,并且正确配置了网络接口。 安装 OFED 首先,安装 Open Fabrics Enterprise Distribution (OFED),它包含了 InfiniBand 所需的驱动程序和库。 sudo