Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Iscsi Network Storage Service Building-Learning Notes

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

1. Overview

ISCSI (Internet Small Computer System Interface), a new storage technology that combines scsi post-section with Ethernet technology, can be used to transmit post-scsi commands and data in the network, so that users can easily access the shared storage resources provided by remote computers through the Internet.

two。 Create a raid disk array on the server side

Using raid, you can ensure the stability and availability of storage resources provided on the server side. Raid5 is used here.

# create md0 [root@localhost Desktop] # mdadm-Cv / dev/md0-n 3-l 5-x 1 / dev/sd [bmure] mdadm: layout defaults to left-symmetricmdadm: layout defaults to left-symmetricmdadm: chunk size defaults to 512Kmdadm: size set to 5238272Kmdadm: Defaulting to version 1.2 metadatamdadm: array / dev/md0 started.# View md0 status [root@localhost Desktop] # mdadm-D / dev/md0. Layout: left-symmetric Chunk Size: 512K Name: localhost.localdomain:0 (local to host localhost.localdomain) UUID: 9e7dc640:37bde867:d3926c0f:0565156e Events: 20 Number Major Minor RaidDevice State 0 8 160 active sync / dev/sdb 1 8 32 1 active sync / dev/sdc 4 8 48 2 active sync / dev/sdd 38 64-spare / dev/sde3. Configure iSCSI server host system ip server rhel 7192.168.137.103.1 use yun to install targetd, targetcli# install [root@localhost Desktop] # yum install targetd targetcli-y # start Set self-boot [root@localhost Desktop] # systemctl restart targetd [root@localhost Desktop] # systemctl enable targetdln-s'/ usr/lib/systemd/system/targetd.service''/ etc/systemd/system/multi-user.target.wants/targetd.service'3.2 to configure shared resources on iscsi server

Use the targetcli command to manage the configuration of iscsi, which provides an interactive configuration interface, similar to the fdisk command

# execute targetcli to enter the configuration interface [root@localhost Desktop] # targetcli Warning: Could not load preferences file / root/.targetcli/prefs.bin.targetcli shell version 2.1.fb34Copyright 2011-2013 by Datera, Inc and others.For help on commands Type 'help'./ > lso- /. [...] O-backstores... [...] | o-block. [Storage Objects: 0] | o-fileio. [Storage Objects: 0] | o-pscsi. [Storage Objects: 0] | o-ramdisk. [Storage Objects: 0] o-iscsi... [Targets: 0] o-loopback... [Targets: 0] / > # go to the / backstores/block directory and add the created md0 to the "resource pool" of the shared device Rename the file to disk0/ > cd / backstores/block / backstores/block > create disk0/ dev/md0 Created block storage object disk0 using / dev/md0./backstores/block > cd / / > lso- /.... [...] O-backstores... [...] | o-block. [Storage Objects: 1] | | o-disk0. [/ dev/md0 (10.0GiB) write-thru deactivated] | o-fileio. [Storage Objects: 0] | o-pscsi. [Storage Objects: 0] | o-ramdisk. [Storage Objects: 0] o-iscsi... [Targets: 0] o-loopback... [Targets: 0] / > 3.3.Create iscsi target names and configure shared resources

The iscsi target name is automatically generated by the system, which is a unique string used to describe the shared resource, and the target name is displayed when the user scans the iscsi server.

# go to the / iscsi directory, generate the target name, and create a "directory" with the same name to store shared resources / > cd iscsi / iscsi > create Created target iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d.Created TPG 1./iscsi > lso- iscsi. [Targets: 1] o-iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d [TPGs: 1] o-tpg1. [no-gen-acls, no-auth] o-acls. [ACLs: 0] o-luns. [LUNs: 0] o-portals. [Portals: 0] / iscsi > # enter the newly created directory and add disk0 to the new directory / iscsi > cd iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d/tpg1/luns / iscsi/iqn.20...01d/tpg1/luns > create / backstores/block/disk0 Created LUN 0.3.4 set access control list (ACL)

The iscsi protocol is verified by the name of the client, and users do not need to enter a password to access the shared resources, as long as the name of the iscsi client is consistent with a name entry in the access control list set in the server. The acls parameter directory is used to store the names of clients that can access shared storage resources on the iscsi server.

# write a string of names that can verify user information in the configuration file of the iscsi server. Here, use the target name, plus: client, which is a self-defined string If it is unique, it can be / iscsi/iqn.20...01d/tpg1/luns > cd.. / iscsi/iqn.20...6110e01d/tpg1 > cd acls / iscsi/iqn.20...01d/tpg1/acls > create iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d:clientCreated Node ACL for iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d:clientCreated mapped LUN 0./iscsi/iqn.20...01d/tpg1/acls > 3.5.Settin Check the configuration information of IP and port number / iscsi/iqn.20...01d/tpg1/acls > cd.. / iscsi/iqn.20...6110e01d/tpg1 > cd portals / iscsi/iqn.20.../tpg1/portals > create 192.168.137.10Using default IP port 3260Created network portal 192.168.137.10 iscsi/iqn.20...01d/tpg1/acls 3260.3.6 monitored by iscsi server Exit editing / iscsi/iqn.20.../tpg1/portals > ls / o-/. [...] O-backstores... [...] | o-block. [Storage Objects: 1] | | o-disk0. [/ dev/md0 (10.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.b7056110e01d [TPGs: 1] | o-tpg1. [no-gen-acls, no-auth] | o-acls. [ACLs: 1] | | o-iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d:client [Mapped LUNs: 1] | | o-mapped_lun0. [lun0 block/disk0 (rw)] | o-luns. [LUNs: 1] | | o-lun0. [block/disk0 (/ dev/md0)] | o-portals. [Portals: 1] | o-192.168.137.10 pur3260. [OK] o-loopback... [Targets: 0] / iscsi/iqn.20.../tpg1/portals > exitGlobal pref auto_save_on_exit=trueLast 10 configs saved in / etc/target/backup.Configuration saved to / etc/target/saveconfig.json3.7 restart targetd service, configure firewall [root@localhost Desktop] # systemctl restart targetd [root@localhost Desktop] # firewall-cmd-- permanent-- add-port=3260/tcpsuccess [root@localhost Desktop] # firewall-cmd-- reload success

The iscsi server-side configuration is complete.

4. Configure linux client 4.1 to install client software iscsi-initiator-utils [root@localhost Desktop] # yum install iscsi-initiator-utils-y4.2 to modify the configuration file using yum

Edit the initiator name file in the client, fill in the server-side access control list name (the custom name in the server-side acls directory), and restart the service.

[root@localhost Desktop] # vim / etc/iscsi/initiatorname.iscsiInitiatorName= iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d:client [root@localhost Desktop] # systemctl restart iscsid [root@localhost Desktop] # systemctl enable iscsid4.3 scan the iscsi server to view available shared storage resources

The mantra "discover first, log in, and finally mount and use".

Tools used by iscsiadm to manage, query, insert, update, or delete iscsi database configuration files.

-m discovery scan and discover available storage resources-type of scan operation performed by t st-p 192.168.137.10 parameter is IP address of iscsi server [root@localhost Desktop] # iscsiadm-m discovery-t st-p 192.168.137.10192.168.137.10192.168.137.10 iscsi server login iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d4.4

Use the iscsiadm command

-m node uses the host where the client resides as a node server-T iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d specifies the resource to use-login or-l for login authentication [root@localhost Desktop] # iscsiadm-m node-T iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d-p 192.168.137.10-- login.successful

After the login is successful, there will be an extra storage device / dev/sdb on the client (the device name may be different), and the new device can now be partitioned and mounted.

4.5 uninstall the storage device

Uninstall the device using iscsiadm-u

[root@localhost Desktop] # iscsiadm-m node-T iqn.2003-01.org.linux-iscsi.localhost.x8664:sn.b7056110e01d-p 192.168.137.10-u

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report