Centos 7安裝iscsi
搭建資料庫RAC環境,使用ISCSI服務模擬儲存伺服器,之前使用的是Linux 6系列所以發現7不同,特此記錄:
伺服器安裝targetcli
# yum -y install targetcli
啟動target服務
# systemctl start target
設定開機啟動服務
# systemctl enable target
開始建立
進入targetcli
#targetcli
步驟1:建立一個塊儲存
注意:server1.disk(名稱server1可自定義),/dev/sdb1為上面新建的分割槽名稱。
/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.
步驟2:配置ISCSITarget命名
注意:命名在同一子網內確保是唯一的,命名格式為:iqn.yyyy-mm.<主機名反寫>:自定義名稱(自定義名稱內不能有下劃線)
/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.
步驟3:建立ACL允許ISCSI客戶機連線
注意:iqn.2019-04.com.rac18cc:server:client1為客戶機ISCSI名稱。
/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
步驟4:建立lun(target塊裝置的邏輯單元)
/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
步驟5:建立ip與埠
/> /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/portals create 192.168.8.88
或
/>cd /iscsi/iqn.2019-04.com.rac18cc:server/tpg1/portals
/>create 192.168.8.88:3260
注:192.168.8.88為伺服器IP;不指定埠預設為3260
步驟6:配置驗證使用者名稱和密碼(這裡可以省略)
/>cd
/iscsi/iqn.2017-05.com.mwdserver:iscsimwd1/tpg1/acls/iqn.2017-05.com.mwdinit:initmwd1
/>set auth userid=test
/>set auth password=test
步驟7:配置完成後檢視配置資訊,並退出。
/>cd /
/>ls
/>exit
客戶端:
安裝:
# yum -y install iscsi-initiator-utils
注:Ubuntu下比較方便好用的initiator是open iscsi:
apt-get install -y open-iscsi
啟動iscsi服務:
# systemctl start iscsi
設定為開機自啟動服務:
# systemctl enable iscsi
配置ISCSIInitiator名稱(此處InitiatorName須與服務端配置的ACL允許ISCSI客戶機連線的名稱一致):
# vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.1994-05.com.redhat:d36e6c6eb661
修改為:
InitiatorName=iqn.2019-04.com.rac18cc:beijing
此處定義的Initiator名字要和在儲存節點中定義ACL時使用的主機名字一致。
#vi /etc/iscsi/iscsid.conf
# line 57: 取消註釋
node.session.auth.authmethod = CHAP
# line 61,62: 取消註釋 and specify the username and password you set on the iSCSI target server
node.session.auth.username = username
node.session.auth.password = password
# 發現target
[root@rac18c1 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.8.88
192.168.8.88:3260,1 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 = <empty>
iface.ipaddress = <empty>
iface.iscsi_ifacename = default
iface.net_ifacename = <empty>
iface.gateway = <empty>
iface.subnet_mask = <empty>
iface.transport_name = tcp
iface.initiatorname = <empty>
iface.state = <empty>
iface.vlan_id = 0
iface.vlan_priority = 0
iface.vlan_state = <empty>
iface.iface_num = 0
iface.mtu = 0
iface.port = 0
iface.bootproto = <empty>
iface.dhcp_alt_client_id_state = <empty>
iface.dhcp_alt_client_id = <empty>
iface.dhcp_dns = <empty>
iface.dhcp_learn_iqn = <empty>
iface.dhcp_req_vendor_id_state = <empty>
iface.dhcp_vendor_id_state = <empty>
iface.dhcp_vendor_id = <empty>
iface.dhcp_slp_da = <empty>
iface.fragmentation = <empty>
iface.gratuitous_arp = <empty>
iface.incoming_forwarding = <empty>
iface.tos_state = <empty>
iface.tos = 0
iface.ttl = 0
iface.delayed_ack = <empty>
iface.tcp_nagle = <empty>
iface.tcp_wsf_state = <empty>
iface.tcp_wsf = 0
iface.tcp_timer_scale = 0
iface.tcp_timestamp = <empty>
iface.redirect = <empty>
iface.def_task_mgmt_timeout = 0
iface.header_digest = <empty>
iface.data_digest = <empty>
iface.immediate_data = <empty>
iface.initial_r2t = <empty>
iface.data_seq_inorder = <empty>
iface.data_pdu_inorder = <empty>
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 = <empty>
iface.bidi_chap = <empty>
iface.strict_login_compliance = <empty>
iface.discovery_auth = <empty>
iface.discovery_logout = <empty>
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 = <empty>
node.session.auth.password = <empty>
node.session.auth.username_in = <empty>
node.session.auth.password_in = <empty>
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
連線ISCSI裝置:
iscsiadm -m node --login
# cat /proc/partitions
# iscsiadm --mode node --targetname iqn.2019-04.com.rac18cc:server --portal 192.168.8.88 --login
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30327022/viewspace-2644080/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 7配置iSCSI共享儲存案例CentOS
- Centos7-VMware+Centos7安裝配置CentOS
- 【CentOS】CentOS7安裝PostgreSQLCentOSSQL
- CentOS 7安裝RedisCentOSRedis
- CentOS 7 安裝 lnmpCentOSLNMP
- Centos 7安裝FTPCentOSFTP
- Centos 7 安裝JDKCentOSJDK
- Centos 7 安裝NginxCentOSNginx
- CentOS 7 - 安裝NginxCentOSNginx
- CentOS 7安裝MySQLCentOSMySql
- CentOS 7 安裝redisCentOSRedis
- CentOS 7安裝ElasticsearchCentOSElasticsearch
- Centos 7 Docker 安裝CentOSDocker
- CentOS7安裝rabbitmqCentOSMQ
- centos 7 安裝 rabbitMqCentOSMQ
- Centos7安裝安裝部署dockerCentOSDocker
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- CentOS 7 Minimal 安裝 LXQTCentOSQT
- CentOS 7 安裝 MySQL 5.7CentOSMySql
- centos7 安裝pipCentOS
- CentOS7 安裝 MySQLCentOSMySql
- centos7安裝protobufCentOS
- 4.1 CentOS7安裝CentOS
- CentOS7安裝wpsCentOS
- VirtualBox安裝Centos7CentOS
- CentOS 7安裝chroot NamedCentOS
- CentOS 7 - 安裝MySQL 5.7CentOSMySql
- CentOS 7 安裝 PHP 7.2CentOSPHP
- CentOS7 安裝NginxCentOSNginx
- CentOS7安裝OpenvswitchCentOS
- CentOS7-安裝NginxCentOSNginx
- Centos 7 yum 安裝nginxCentOSNginx
- centos7 安裝rocketmqCentOSMQ
- CentOS 7 yum 安裝 NGINXCentOSNginx
- CentOS7 安裝 dockerCentOSDocker
- CentOS 7 yum 安裝 MySQLCentOSMySql
- CentOS 7安裝 hping教程CentOS
- centos7安裝dockerCentOSDocker