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

How to install iscsi for Centos7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly explains "Centos7 how to install iscsi", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Centos7 how to install iscsi" bar!

Build a database RAC environment and simulate the storage server using ISCSI service. Previously, Linux 6 series was used, so 7 was found to be different. Here is a record:

Server installs targetcli

# yum-y install targetcli

Start the target service

# systemctl start target

Set up the boot service

# systemctl enable target

Start creating

Enter targetcli

# targetcli

Step 1: create a block store

Note: server1.disk (the name server1 is customizable), / dev/sdb1 is the name of the newly created partition above.

/ backstores/fileio > / backstores/block create disk_ocr1 / dev/sdb

Created block storage object disk_ocr1 using / dev/sdb.

/ backstores/fileio > / backstores/block create disk_ocr2 / dev/sdc

Created block storage object disk_ocr2 using / dev/sdc.

/ backstores/fileio > / backstores/block create disk_ocr3 / dev/sdd

Created block storage object disk_ocr3 using / dev/sde.

/ backstores/fileio > / backstores/block create disk_data1 / dev/sde

Created block storage object disk_data1 using / dev/sde.

/ backstores/fileio > / backstores/block create disk_data2 / dev/sdf

Created block storage object disk_data2 using / dev/sdf.

/ backstores/fileio > / backstores/block create disk_data3 / dev/sdg

Created block storage object disk_data3 using / dev/sdg.

/ backstores/fileio > / backstores/block create disk_data4 / dev/sdh

Created block storage object disk_data4 using / dev/sdh.

Step 2: configure ISCSITarget naming

Note: make sure the naming is unique within the same subnet. The naming format is: iqn.yyyy-mm.: custom name (no underscores are allowed within the custom name)

/ backstores/fileio > / iscsi create iqn.2019-04.com.rac18cc:server

Created target iqn.2019-04.com.rac18cc:server.

Created TPG 1.

Global pref auto_add_default_portal=true

Created default portal listening on all IPs (0.0.0.0), port 3260.

Step 3: create an ACL to allow ISCSI clients to connect

Note: iqn.2019-04.com.rac18cc:server:client1 is the client ISCSI name.

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/acls create iqn.2019-04.com.rac18cc:beijing

Created Node ACL for iqn.2019-04.com.rac18cc:beijing

Step 4: create the lun (the logical unit of the target block device)

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_ocr1

Created LUN 0.

Created LUN 0-> 0 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_ocr2

Created LUN 1.

Created LUN 1-> 1 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_ocr3

Created LUN 2.

Created LUN 2-> 2 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data1

Created LUN 3.

Created LUN 3-> 3 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data2

Created LUN 4.

Created LUN 4-> 4 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data3

Created LUN 5.

Created LUN 5-> 5 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

/ backstores/fileio > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/luns create/backstores/block/disk_data4

Created LUN 6.

Created LUN 6-> 6 mapping in node ACL iqn.2019-04.com.rac18cc:beijing

Step 5: create ip and port

/ > / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/portals create 192.168.8.88

Or

/ > cd / iscsi/iqn.2019-04.com.rac18cc:server/tpg1/portals

/ > create 192.168.8.88 purl 3260

Note: 192.168.8.88 does not specify a port for the server IP; and defaults to 3260

Step 6: configure the authentication username and password (which can be omitted here)

/ > cd

/ iscsi/iqn.2017-05.com.mwdserver:iscsimwd1/tpg1/acls/iqn.2017-05.com.mwdinit:initmwd1

/ > set auth userid=test

/ > set auth password=test

Step 7: review the configuration information after the configuration is complete, and exit.

/ > cd /

/ > ls

/ > exit

Client:

Installation:

# yum-y install iscsi-initiator-utils

Note: the initiator that is convenient and easy to use under Ubuntu is open iscsi:

Apt-get install-y open-iscsi

Start the iscsi service:

# systemctl start iscsi

Set to boot self-startup service:

# systemctl enable iscsi

Configure the ISCSIInitiator name (here the InitiatorName must be the same as the server-side configured ACL to allow ISCSI client connections):

# vi / etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.1994-05.com.redhat:d36e6c6eb661

Modified to:

InitiatorName=iqn.2019-04.com.rac18cc:beijing

The Initiator name defined here should be the same as the host name used when defining ACL in the storage node.

# vi / etc/iscsi/iscsid.conf

# line 57: uncomment

Node.session.auth.authmethod = CHAP

# line 61J 62: uncomment and specify the username and password you set on the iSCSI target server

Node.session.auth.username = username

Node.session.auth.password = password

# Discovery target

[root@rac18c1] # iscsiadm-m discovery-t sendtargets-p 192.168.88

192.168.8.88 Flux 3260 iqn.2019-04.com.rac18cc:server

[root@rac18c1] # iscsiadm-m node-o show

# BEGIN RECORD 6.2.0.874-10

Node.name = iqn.2019-04.com.rac18cc:server

Node.tpgt = 1

Node.startup = automatic

Node.leading_login = No

Iface.hwaddress =

Iface.ipaddress =

Iface.iscsi_ifacename = default

Iface.net_ifacename =

Iface.gateway =

Iface.subnet_mask =

Iface.transport_name = tcp

Iface.initiatorname =

Iface.state =

Iface.vlan_id = 0

Iface.vlan_priority = 0

Iface.vlan_state =

Iface.iface_num = 0

Iface.mtu = 0

Iface.port = 0

Iface.bootproto =

Iface.dhcp_alt_client_id_state =

Iface.dhcp_alt_client_id =

Iface.dhcp_dns =

Iface.dhcp_learn_iqn =

Iface.dhcp_req_vendor_id_state =

Iface.dhcp_vendor_id_state =

Iface.dhcp_vendor_id =

Iface.dhcp_slp_da =

Iface.fragmentation =

Iface.gratuitous_arp =

Iface.incoming_forwarding =

Iface.tos_state =

Iface.tos = 0

Iface.ttl = 0

Iface.delayed_ack =

Iface.tcp_nagle =

Iface.tcp_wsf_state =

Iface.tcp_wsf = 0

Iface.tcp_timer_scale = 0

Iface.tcp_timestamp =

Iface.redirect =

Iface.def_task_mgmt_timeout = 0

Iface.header_digest =

Iface.data_digest =

Iface.immediate_data =

Iface.initial_r2t =

Iface.data_seq_inorder =

Iface.data_pdu_inorder =

Iface.erl = 0

Iface.max_receive_data_len = 0

Iface.first_burst_len = 0

Iface.max_outstanding_r2t = 0

Iface.max_burst_len = 0

Iface.chap_auth =

Iface.bidi_chap =

Iface.strict_login_compliance =

Iface.discovery_auth =

Iface.discovery_logout =

Node.discovery_address = 192.168.8.88

Node.discovery_port = 3260

Node.discovery_type = send_targets

Node.session.initial_cmdsn = 0

Node.session.initial_login_retry_max = 8

Node.session.xmit_thread_priority =-20

Node.session.cmds_max = 128,

Node.session.queue_depth = 32

Node.session.nr_sessions = 1

Node.session.auth.authmethod = CHAP

Node.session.auth.username =

Node.session.auth.password =

Node.session.auth.username_in =

Node.session.auth.password_in =

Node.session.timeo.replacement_timeout = 120

Node.session.err_timeo.abort_timeout = 15

Node.session.err_timeo.lu_reset_timeout = 30

Node.session.err_timeo.tgt_reset_timeout = 30

Node.session.err_timeo.host_reset_timeout = 60

Node.session.iscsi.FastAbort = Yes

Node.session.iscsi.InitialR2T = No

Node.session.iscsi.ImmediateData = Yes

Node.session.iscsi.FirstBurstLength = 262144

Node.session.iscsi.MaxBurstLength = 16776192

Node.session.iscsi.DefaultTime2Retain = 0

Node.session.iscsi.DefaultTime2Wait = 2

Node.session.iscsi.MaxConnections = 1

Node.session.iscsi.MaxOutstandingR2T = 1

Node.session.iscsi.ERL = 0

Node.session.scan = auto

Node.conn [0] .address = 192.168.8.88

Node.conn [0] .port = 3260

Node.conn [0] .startup = manual

Node.conn [0] .tcp.window _ size = 524288

Node.conn [0] .tcp.type _ of_service = 0

Node.conn [0] .timeo.logout _ timeout = 15

Node.conn [0] .timeo.login _ timeout = 15

Node.conn [0] .timeo.auth _ timeout = 45

Node.conn [0] .timeo.noop _ out_interval = 5

Node.conn [0] .timeo.noop _ out_timeout = 5

Node.conn [0] .iscsi.MaxXmitDataSegmentLength = 0

Node.conn [0] .iscsi.MaxRecvDataSegmentLength = 262144

Node.conn [0] .iscsi.HeaderDigest = None

Node.conn [0] .iscsi.IFMarker = No

Node.conn [0] .iscsi.OFMarker = No

# END RECORD

Connect the ISCSI device:

Iscsiadm-m node-- login

# cat / proc/partitions

# iscsiadm-mode node-targetname iqn.2019-04.com.rac18cc:server-portal 192.168.8.88-login

Thank you for reading, the above is the content of "how to install iscsi in Centos7". After the study of this article, I believe you have a deeper understanding of how to install iscsi in Centos7, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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