首页 > 系统相关 >ubuntu上配置multipath

ubuntu上配置multipath

时间:2023-02-14 10:13:56浏览次数:67  
标签:02 No 配置 192.168 tgtd ubuntu multipath com

参考

步骤

上文中在ubuntu下搭建了iscsi存储,下面基于iscsi存储创建multipath环境。

  • 给Host添加一块存储设备

/dev/nvme0n2

  • 配置tgt
    cat /etc/tgt/conf.d/iscsi.conf
cat /etc/tgt/conf.d/iscsi.conf
<target iqn.2023-02.pendl.com:disk1>
backing-store /dev/nvme0n1
initiator-address 192.168.159.144
</target>

<target iqn.2023-02.pendl.com:disk2>
backing-store /dev/nvme0n2
</target>

上面第二个target是要创建的multipath iscsi存储,对应的是host上的/dev/nvme0n2,这里没有指定IP地址,所有可以通过Host的多个IP访问。

  • 重启tgt,并查看状态
systemctl restart tgt
systemctl status tgt

可以看到如下信息:

➜  x86 sudo systemctl status tgt.service
● tgt.service - (i)SCSI target daemon
     Loaded: loaded (/lib/systemd/system/tgt.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-02-13 17:35:23 PST; 2s ago
       Docs: man:tgtd(8)
    Process: 8403 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline (code=exited, status=0/SUCCESS)
    Process: 8404 ExecStartPost=/usr/sbin/tgt-admin -e -c /etc/tgt/targets.conf (code=exited, status=0/SUCCESS)
    Process: 8455 ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready (code=exited, status=0/SUCCESS)
   Main PID: 8402 (tgtd)
     Status: "Starting event loop..."
      Tasks: 33
     Memory: 1.6M
     CGroup: /system.slice/tgt.service
             └─8402 /usr/sbin/tgtd -f

Feb 13 17:35:23 ubuntu systemd[1]: Starting (i)SCSI target daemon...
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: iser_ib_init(3431) Failed to initialize RDMA; load kernel modules?
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: work_timer_start(146) use timer_fd based scheduler
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: bs_init(387) use signalfd notification
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: device_mgmt(246) sz:18 params:path=/dev/nvme0n1
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: bs_thread_open(409) 16
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: device_mgmt(246) sz:18 params:path=/dev/nvme0n2
Feb 13 17:35:23 ubuntu tgtd[8402]: tgtd: bs_thread_open(409) 16
Feb 13 17:35:23 ubuntu systemd[1]: Started (i)SCSI target daemon.
  • 验证target
sudo tgtadm --mode target --op show

可以看到如下信息:

// 这里省去了Target1的信息
Target 2: iqn.2023-02.pendl.com:disk2
    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, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: disk
            SCSI ID: IET     00020001
            SCSI SN: beaf21
            Size: 21475 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: rdwr
            Backing store path: /dev/nvme0n2
            Backing store flags:
    Account information:
    ACL information:
        ALL

客户端

  • 可以再给客户端增加一块网卡

为了简单,客户端只用了一块网卡,只是服务端有多块网卡。

  • 发现target
root@ubuntu-vm:~# iscsiadm -m discovery -t st -p 192.168.159.130
192.168.159.130:3260,1 iqn.2023-02.pendl.com:disk2
root@ubuntu-vm:~# iscsiadm -m discovery -t st -p 192.168.159.144
192.168.159.144:3260,1 iqn.2023-02.pendl.com:disk1
192.168.159.144:3260,1 iqn.2023-02.pendl.com:disk2
  • 登录
root@ubuntu-vm:~# iscsiadm -m node -l
Logging in to [iface: default, target: iqn.2023-02.pendl.com:disk2, portal: 192.168.159.130,3260] (multiple)
Logging in to [iface: default, target: iqn.2023-02.pendl.com:disk2, portal: 192.168.159.144,3260] (multiple)
Logging in to [iface: default, target: iqn.2023-02.pendl.com:disk1, portal: 192.168.159.144,3260] (multiple)
Login to [iface: default, target: iqn.2023-02.pendl.com:disk2, portal: 192.168.159.130,3260] successful.
Login to [iface: default, target: iqn.2023-02.pendl.com:disk2, portal: 192.168.159.144,3260] successful.
Login to [iface: default, target: iqn.2023-02.pendl.com:disk1, portal: 192.168.159.144,3260] successful.

登录以后,服务端也会有相应的变化:

Target 2: iqn.2023-02.pendl.com:disk2
    System information:
        Driver: iscsi
        State: ready
    I_T nexus information:
        I_T nexus: 7
            Initiator: iqn.2023-02.pendl.com:lun1 alias: ubuntu-vm
            Connection: 0
                IP Address: 192.168.159.130
        I_T nexus: 8
            Initiator: iqn.2023-02.pendl.com:lun1 alias: ubuntu-vm
            Connection: 0
                IP Address: 192.168.159.144
    LUN information:
        LUN: 0
            Type: controller
            SCSI ID: IET     00020000
            SCSI SN: beaf20
            Size: 0 MB, Block size: 1
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: null
            Backing store path: None
            Backing store flags:
        LUN: 1
            Type: disk
            SCSI ID: IET     00020001
            SCSI SN: beaf21
            Size: 21475 MB, Block size: 512
            Online: Yes
            Removable media: No
            Prevent removal: No
            Readonly: No
            SWP: No
            Thin-provisioning: No
            Backing store type: rdwr
            Backing store path: /dev/nvme0n2
            Backing store flags:
    Account information:
    ACL information:
        ALL
  • 查看multipath状态
root@ubuntu-vm:~# multipath -ll
mpathc (360000000000000000e00000000020001) dm-0 IET     ,VIRTUAL-DISK
size=20G features='0' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=1 status=enabled
  |- 2:0:0:1 sda 8:0  active ready running
  `- 3:0:0:1 sdb 8:16 active ready running

标签:02,No,配置,192.168,tgtd,ubuntu,multipath,com
From: https://www.cnblogs.com/pengdonglin137/p/17118739.html

相关文章

  • Nginx配置文件----- 全局块和event块
    #全局块#指定可以运行nginx服务的用户和用户组,只能在全局块配置#usernobody;#nginx进程,一般数值为cpu核数worker_processes1;#错误日志存放目录#error_loglogs/error.lo......
  • RabbitMQ系列(一)--------安装配置
    安装RabbitMQ 前提先要配置好环境 需要先安装Erlang 1修改主机名    RabbitMQ是通过主机名进行访问的,必须指定能访问的主机名。    命令: #vim......
  • opensips将配置文件中的数据库密码加密
    本来没想着给数据库密码加密,结果当时用的数据库密码中有个@符号,opensips在解析数据库连接串的时候,会将@字符后的数据认为是数据库地址,导致一直连接失败。解决方法:1、配置......
  • springboot自动配置原理以及spring.factories文件的作用详解
    一、springboot自动配置原理先说说我们自己的应用程序中Bean加入容器的办法:packagecom.ynunicom.dc.dingdingcontractapp;importcom.alibaba.druid.spring.boot.au......
  • ubuntu下装显卡驱动装了好久。。。
    用的是菜单中的additionaldrivers安装的推荐驱动。但是nvidia-smi命令一直出不来,nodeivicewerefound;最后是用的第二个不带open的解决的~~~https://forums.develop......
  • python配置虚拟环境
    首先安装pipinstallvirtualenvpipinstallvirtualenvwrapper创建虚拟环境:mkvirtualenv虚拟环境名称列出所有虚拟环境:lsvirtualenv切换虚拟环境:workon 虚拟环境......
  • Ubuntu cmake 安装以及问题解决(muduo库编译)
    1、安装cmakesudoapt-getinstallcmake 2、安装之后查看是否安装成功:cmake--version3、出现 NoCMAKE_C_COMPILERcouldbefound.如何解决使用cmake命令时发......
  • 【Linux】查看Linux服务器配置概况/CPU/GPU/内存
    ✨配置概况在有GUI界面的Linux服务器可以上直接点击右上角选择Setting>AboutCPU:36核心,主频3.00Ghz,x84_64架构内存:125.5G硬盘:5T✨CPUCPU:36核心,主频3.00Ghz,x84_64......
  • Pytorch快速使用手册 01基本配置
    importosimporttqdmimporttorchimportrandomimportshutilimportnumpyasnp1.BaseConfig1.1Checkversionofpytorchprint("torchversion",torch.__......
  • Mybatis04 - 核心配置文件 mybatis-config.xml
    mybatis-config.xml<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEconfigurationPUBLIC"-//mybatis.org//DTDConfig3.0//EN""http://mybatis.......