導航:首頁 > 編程系統 > linux配置iscsi

linux配置iscsi

發布時間:2025-03-17 07:50:09

『壹』 linux下如何搭建SAN系統

ipsan配置:
server端 192.168.1.20
安裝包 scsi-target-utils #yum安裝
vim /etc/tgt/targets.conf
<target iqn.2008-09.com.example:server.target1>
backing-store /dev/sda#你要共享的硬碟或分區
write-cache off
vendor_id xx #client配置udev時使用
proct_id xx #client配置udev時使用
initiator-address 192.168.1.0/24 #訪問列表
</target>
service tgtd start #開啟服務
tgt-admin show #檢查ipsan開啟狀態
client 192.168.1.11
安裝包 iscsi-initiator-utils
service iscsid start #開啟服務
iscsiadm -m discovery -t sendtargets -p 192.168.1.20:3260 #發現server端存儲
iscsiadm -m node -T iqn.2008-09.com.example:server.target1 -l #掛在分區
fdisk -l #查看分區是否掛在成功
iscsiadm -m node -T iqn.2008-09.com.example:server.target1 -u #卸載分區
以上在redhat系系統可用,未配置udev。

『貳』 linux客戶端怎麼啟動iscsi

1:YUM安裝軟體
[root@node2 Packages]# rpm -qa | grep iscsi
iscsi-initiator-utils-6.2.0.873-2.el6.x86_64
[root@node2 Packages]# rpm -qa | grep scsi
iscsi-initiator-utils-6.2.0.873-2.el6.x86_64
scsi-target-utils-1.0.24-2.el6.x86_64
[root@node2 Packages]# lsb_release -a 伺服器版本
LSB
Version:
:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.4 (Santiago)
Release: 6.4
Codename: Santiago
因為這台伺服器是當RAC 資料庫伺服器之一的,所以此伺服器需要安裝客戶端工具和伺服器端工具。
YUM軟體安裝可以參考我的經驗:rhel6.4 yum本地yum源配置
http://jingyan..com/article/59a015e340de67f7948865bc.html

2
2:啟動並設置開機自啟動

[root@node2 Packages]# service tgtd start
Starting SCSI target daemon: [ OK ]
[root@node2 Packages]# chkconfig tgtd on
[root@node2 Packages]# chconfig --list | grep tgtd
-bash: chconfig: command not found
[root@node2 Packages]# chkconfig --list | grep tgtd
tgtd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

3:確定共享磁碟
[root@node2 Packages]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 629G 113G 484G 19% /
tmpfs 3.9G 167M 3.7G 5% /dev/shm
/dev/sda1 194M 33M 152M 18% /boot
/dev/sda3 194M 5.9M 178M 4% /home
/dev/sda2 289G 191M 274G 1% /share
或者使用DD創建一個大文件
dd if=/dev/zero of=/target_scsi bs=2M count=500 //使用dd
共享出來的設備源可以是DD出來的一個文件,或者是/dev/sda2這樣的分區。
如果使用/dev/sda2這個分區,那麼/share目錄將會變成只讀模式
這里我採用DD出一個文件,因為VOTE表決磁碟200M左右大小。

4:編輯配置文件

[root@node2 ~]# cat /etc/tgt/targets.conf
default-driver iscsi
<target iqn.2015-07.wiscom:wiscom20>
<backing-store /targe_scsi>
scsi_id wiscom20
lun 1
</backing-store>
</target>
默認所有用戶都可以訪問
編寫規范:
target iqn.2015-07.wiscom:wiscom20 iqn.年-月.公司名稱:scsi_id號 為後期編寫多路徑規則方便
scsi_id wiscom20 自定義 (客戶端掛載後wwid)經過試驗,我的伺服器必須更改scsi_id,否則多路徑無法指定別名
lun 1 默認為1
注意:
如果配置完文件之後,沒有重啟伺服器,只是重啟了iscsi服務 service tgtd restart 。執行tgt-admin -s 命令查看的時候沒有lun 1 設備。最終發現重啟伺服器才生效

5:重啟伺服器 --至關重要
如果是伺服器中已經跑了RAC,需要將node2集群關閉再重啟伺服器。
在試驗過程中,發現自定義scsi_id無法生效,不管怎麼修改都不行。最終重啟發現生效。

tgt-admin -s 或者tgtadm --lld iscsi --mode target --op show 都可以查看qin號、設備連接信息和scsi_id號

6:本機掛載--node2掛載
[root@node2 ~]# iscsiadm -m discovery -t sendtargets -p 10.10.10.7:3260
10.10.10.7:3260,1 iqn.2015-07.wiscom:wiscom20
[root@node2 ~]# iscsiadm -m discovery -t sendtargets -p 10.10.11.7:3260
10.10.11.7:3260,1 iqn.2015-07.wiscom:wiscom20
[root@node2 ~]# iscsiadm -m node -T iqn.2015-07.wiscom:wiscom20 -p 10.10.10.7:3260 -l
Logging in to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.10.7,3260] (multiple)
Login to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.10.7,3260] successful.
[root@node2 ~]# iscsiadm -m node -T iqn.2015-07.wiscom:wiscom20 -p 10.10.11.7:3260 -l
Logging in to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.11.7,3260] (multiple)
Login to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.11.7,3260] successful.
掃描並掛載存儲
如何掛載iscsi存儲參考我的經驗:rhel 6掛載以及卸載iscsi存儲
http://jingyan..com/article/046a7b3edda53bf9c27fa9a2.html

7:查看scsi_id
scsi_id是設備唯一標識符,類似wwid

[root@node2 ~]# scsi_id -g -u -d /dev/adap
[root@node2 ~]# scsi_id -g -u -d /dev/sdap
1wiscom20
[root@node2 ~]# scsi_id -g -u -d /dev/sdaq
1wiscom20

8:節點2添加磁碟多路徑

[root@node2 mapper]# vi /etc/multipath.conf
[root@node2 mapper]# service multipathd restart
ok
Stopping multipathd daemon: [ OK ]
Starting multipathd daemon: [ OK ]
/etc/multipath.conf 添加如下:
multipath {
wwid "1wiscom20"
alias crsC01
path_grouping_policy multibus
uid 1300
gid 1301
mode 666
}
在配置之前,一旦掛載就會發現/dev/mapper下已經生成了多路徑磁碟mpathm,但是需要在多路徑配置文件中添加以上配置生成統一別名。
磁碟多路徑配置可以參考我的經驗:ASM磁碟多路徑及udev配置
http://jingyan..com/article/aa6a2c14f89b180d4c19c4d3.html

9:節點2 udev修改/dev/mapper/crsC01設備讀寫許可權
[root@node2 dev]# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
添加以下內容:
KERNEL=="dm-20", OWNER="grid", GROUP="asmadmin", MODE="0666"
[root@node2 dev]# /sbin/udevadm control --reload-rules
[root@node2 dev]# /sbin/start_udev
Starting udev: [ OK ]
至此,節點2 添加磁碟成功。但是節點1還需要添加磁碟。

10:節點1掛載共享iscsi設備
節點1掛載:node1
[root@node1 nodes]# iscsiadm -m discovery -t sendtargets -p 10.10.10.7:3260
10.10.10.7:3260,1 iqn.2015-07.wiscom:wiscom20
[root@node1 nodes]# iscsiadm -m discovery -t sendtargets -p 10.10.11.7:3260
10.10.11.7:3260,1 iqn.2015-07.wiscom:wiscom20
[root@node1 nodes]# iscsiadm -m node -T iqn.2015-07.wiscom:wiscom20 -p 10.10.10.7:3260 -l
Logging in to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.10.7,3260] (multiple)
Login to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.10.7,3260] successful.
[root@node1 nodes]# iscsiadm -m node -T iqn.2015-07.wiscom:wiscom20 -p 10.10.11.7:3260 -l
Logging in to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.11.7,3260] (multiple)
Login to [iface: default, target: iqn.2015-07.wiscom:wiscom20, portal: 10.10.11.7,3260] successful.

10:節點1添加磁碟多路徑和udev修改許可權
步驟和添加內容和第8步驟、第9步驟一致。

11:查看ASM中是否識別到該設備
兩個節點均需要查看

[oracle@node1 ~]$ export ORACLE_SID=+ASM1
[oracle@node1 ~]$ export ORACLE_HOME=/u01/app/11.2.0.4/grid/
[oracle@node1 ~]$ export PATH=$PATH:$ORACLE_HOME/bin
[oracle@node1 ~]$ sqlplus sys as sysasm
SQL*Plus: Release 11.2.0.4.0 Proction on Tue Jul 28 16:33:01 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Proction
With the Real Application Clusters and Automatic Storage Management options
SQL>
SQL>
SQL>
SQL> col name for a20
SQL> col name for a20
col path for a30
col mount_status for a10
set linesize 300SQL> SQL> SQL>
SQL>
SQL>
SQL>
SQL> select name,path,failgroup,mount_status from v$asm_disk order by name;

『叄』 Linux系統如何安裝和使用shell編寫的工具supportconfig

supportconfig作為Linux系統shell編寫的工具,其功能是非常強大的,但還是有很多人對supportconfig工具不了解,不知如何使用supportconfig工具,下面小編就簡單的給大家介紹下Linux安裝使用supportconfig的方法。

一、supportconfig的安裝

可以通過yast進行安裝,也可以通過zypper命令進行安裝,安裝命令如下:

直接使用源進行安裝

代碼如下

#zypper install supportutils

也可以將rpm包下載下來使用yast進行安裝或者在yast的管理界面里查找安裝

#yast install supportutils-xxx.rpm

註:根據系統的版本不同,包名也可能是supportconfig 。

安裝完成後可以使用rpm -ql supportutils 查看包中具體包含的文件信息,如下:

代碼如下

# rpm -ql supportutils

/etc/schealth.conf

/etc/supportconfig.conf

/sbin/chkbin

/sbin/supportconfig

/usr/bin/schealth

/usr/share/man/man5/supportconfig.conf.5.gz

/usr/share/man/man8/chkbin.8.gz

/usr/share/man/man8/supportconfig.8.gz

註:上面的結果是在 suse11 sp1企業版上的測試的結果,在opensuse 13上目錄結構會略有不同,其上使用的是新版本的supportconfig。

二、supportconfig用法

以下是supportconfig的幫助輸出

代碼如下

# supportconfig -h

=============================================================================

Support Utilities - Supportconfig

Script Version: 2.25-197

Script Date: 2010 04 02

=============================================================================

Usage: supportconfig [OPTION [OPTION 。。。]]

-h This screen

-A Activates all supportconfig functions with additional logging and full

rpm verification.

-B 《string》 Custom tar ball file name element

-C Creates a new default /etc/supportconfig.conf

-D Use defaults; ignore /etc/supportconfig.conf

-E 《string》 Contact email address

-F Display available supportconfig feature keywords (case-sensitive) used

with -i and -x

-G 《gpg_uid》 The GPG recipient『s user ID used to encrypt the supportconfig tarball

-H 《number》 Limit number of included HA Policy engine files

-I 《number》 Default log file line count

-L Create a full file listing from 』/『

-M 《string》 Contact terminal ID

-N 《string》 Contact name

-O 《string》 Contact company name

-P 《string》 Contact phone number

-Q Run in silent mode

-R 《path》 Log output directory

-S 《number》 Limit number of included SAR files

-T 《seconds》 Binary execution timeout

-U 《URI string》 Sets upload target URL and initiates an upload, supported

services include: ftp, scp, http, https

-M 《string》 Contact store ID

-X 《number》 Max system logs line count

-a Upload the tar ball to the specified alternate target VAR_OPTION_UPLOAD_ALT

-b Screen buffer mode

-d Exclude detailed disk info and scans

-e Search root file system for eDirectory instances; -L implied. Be patient.

-f From directory. Don』t collect report files, just use files in that

directory.

-g Use gzip instead of the default bzip2 compression.

-i 《keyword list》

Include keywords. A comma separated list of feature keywords that specify

which features to include. Use -F to see a list of valid keywords.

-l Gathers additional rotated logs

-m Only gather a minimum amount of info: basic env, basic health, hardware,

rpm, messages, y2logs

-o Toggle listed features on or off

-p Disable all plugins

-q Add a uuid to the tar ball filename to ensure uniqueness

-r 《srnum》

Includes the Novell 11 digit service request number when uploading

the tar ball to Novell

-s Include full SLP service lists

-t Target directory. Just save log files here, do not create tarball.

-u Upload the tar ball to the specified VAR_OPTION_UPLOAD_TARGET.

-v Performs an rpm -V for each installed rpm NOTE: This takes a long time

to complete

-x 《keyword list》

Exclude keywords. A comma separated list of feature keywords that specify

which features to exclude. Use -F to see a list of valid keywords.

-y Only gather the minimum y2log files.

Use Ctrl- to try and skip a function that is hanging.

-----------------------------------------------------------------------------

NOTE:

This tool will create a tar ball in the /var/log directory. Please attach

the log file tar ball to your open Service. Request at the following URL:

https://secure-support.novell.com/eService_enu

If you cannot attach the tar ball to the SR, then email it to the engineer.

Please submit bug fixes or comments via:

http://en.opensuse.org/Supportutils#Reporting_Bugs

=============================================================================

Support Utilities - Supportconfig

Script Version: 2.25-197

Script Date: 2010 04 02

=============================================================================

默認supportconfig或supportconfig -A執行後會將收集後的結果打包為一個nts_主機名_日期.tbz 文件,同時會生成一個以該文件名加.md5後綴的文件。

上一頁1234下一頁共4頁

三、supportconfig常用示例

1、supportconfig -A 收集所有日誌

代碼如下

# supportconfig

=============================================================================

Support Utilities - Supportconfig

Script Version: 2.25-290

Script Date: 2011 07 14

=============================================================================

Gathering system information

Data Directory: /var/log/nts_361way.com_140825_1504

Basic Server Health Check.。。 Done

RPM Database.。。 Done

Basic Environment.。。 Done

Basic Health Report.。。 Done

System Moles.。。 Done

Memory Details.。。 Done

Disk I/O.。。 Done

YaST Files.。。 Done

Auditing.。。 Done

Crash Info.。。 Done

NTP.。。 Done

PROC.。。 Done

Boot Files.。。 Done

SLERT.。。 Skipped

Updates.。。 Done

SMT.。。 Skipped

Novell eDirectory.。。 Please Wait.。。 Skipped

Novell LUM.。。 Skipped

Novell NCP.。。 Skipped

Novell NSS.。。 Skipped

Novell DFS.。。 Skipped

Novell SMS.。。 Skipped

Novell NCS.。。 Skipped

Novell AFP.。。 Skipped

Novell CIFS.。。 Skipped

Novell iManager.。。 Skipped

HA Cluster.。。 Skipped

OCFS2.。。 Skipped

DRBD.。。 Skipped

PAM.。。 Done

LDAP.。。 Done

CIMOM.。。 Done

Open Files.。。 Done

Environment.。。 Done

ETC.。。 Done

SYSCONFIG.。。 Done

SYSFS.。。 Done

System Daemons.。。 Done

CRON.。。 Done

AT.。。 Done

UDEV.。。 Done

LVM.。。 Please Wait.。。 Base Detail Done

EVMS.。。 Skipped

Software Raid.。。 Done

Multipathing.。。 Done

Networking.。。 Done

Web.。。 Done

InfiniBand.。。 Done

DNS.。。 Done

DHCP.。。 Done

SLP.。。 Done

SSH.。。 Done

iSCSI.。。 Done

Samba.。。 Done

NFS.。。 Done

AUTOFS.。。 Done

SAR Files.。。 Done

AppArmor.。。 Done

Xen.。。 Done

KVM.。。 Done

X.。。 Done

Printing.。。 Done

SMART Disks.。。 Excluded

Hardware.。。 Please Wait.。。 Done

File System List.。。 Skipped

Supportability Analysis.。。 Please Wait.。。 Done

System Logs.。。 Done

Creating Tar Ball

==[ DONE ]===================================================================

Log file tar ball: /var/log/nts_361way.com_140825_1504.tbz

Log file size: 4.0M

Log file md5sum:

Please attach the log file tar ball to your open Service Request at the

following URL:

https://secure-support.novell.com/eService_enu

You can also upload the tar ball to ftp.novell.com/incoming, or just use

supportconfig -ur 《srnum》, to upload the tar ball automatically.

If you cannot attach the tar ball to the SR, then email it to the engineer.

=============================================================================

其他常用用法:

//以最小選項搜集所需的信息

# supportconfig -m

//在輸出中包含附加的聯系人信息

# supportconfig -E [email protected] -N 「Tux Penguin」 -O 「Penguin Inc.」 。。。

//要查看完整的功能列表

# supportconfig -F

//僅收集某個模塊的用法,如LVM相的信息

# supportconfig -i LVM

//-x 的功能與-i剛好相反,是排除某個模塊不收集

# supportconfig -x LVM

//使用-U url 可以將收集的結果上傳到伺服器上,直接的服務有ftp, scp, http, https,如:

# supportconfig -A -U http://www.361way.com/files/

具體可以參看官方的 常用的supportconfig選項部分 。

supportconfig收集的系統健康報告:

代碼如下

# supportconfig -A

# cd /var/log

# tar jxvf nts_361way.com_140825_1504.tbz

# more basic-health-report.txt

#==[ Command ]======================================#

# /usr/bin/schealth -q

######################################################################

Supportconfig Health Check Report Tool v1.00-5

Date Checked: 09/12/14 04:40:37

######################################################################

Health Check Files [ Green ]

Processes Waiting for Run Queue [ Green ]

Kernel Taint Status [ Red ]

Kernel Tainted: 64 》 0

CPU Utilization [ Green ]

Interrupts Per Second [ Green ]

Context Switches Per Second [ Green ]

Free Memory and Disk Swapping [ Green ]

Used Disk Space [ Green ]

Uninterruptible Processes [ Green ]

Zombie Processes [ Green ]

######################################################################

Status: Red Flag

Checked: /var/log/nts_361way.com_140825_1504/basic-health-check.txt

Report: /var/log/nts_361way.com_140825_1504/basic-health-report.txt

######################################################################

上面的報告中,我們發現kernel Tainted 狀態為red ,該處是通過cat /proc/sys/kernel/tainted 進行判斷的,如果值不為0,則是內核受到污染 ,顯的值不同,具體可以參看/usr/src/linux/Documentation/sysctl/kernel 文件(具體的值不一樣,代表的意義也不一樣)。64報紅是由於載入了非系統官方或非開源的模塊所致( Unsupported moles loaded)。

四、supportconfig配置文件

supportconfig的默認配置文件是 /etc/supportconfig.conf ,其默認內容如下:

代碼如下

# cat /etc/supportconfig.conf

####################################

# Default Options

####################################

OPTION_AFP=1

OPTION_APPARMOR=1

OPTION_AUDIT=1

OPTION_AUTOFS=1

OPTION_BOOT=1

OPTION_CHKCONFIG=1

OPTION_CIFS=1

OPTION_CIMOM=1

OPTION_CRASH=1

OPTION_CRON=1

OPTION_DFS=1

OPTION_DHCP=1

OPTION_DISK=1

OPTION_DNS=1

OPTION_EDIR=1

OPTION_ENV=1

OPTION_ETC=1

OPTION_EVMS=1

OPTION_HA=1

OPTION_HCREPORT=1

OPTION_IB=1

OPTION_ISCSI=1

OPTION_LDAP=1

OPTION_LUM=1

OPTION_LVM=1

OPTION_MEM=1

OPTION_MOD=1

OPTION_MPIO=1

OPTION_NCP=1

OPTION_NCS=1

OPTION_NET=1

OPTION_NFS=1

OPTION_NSS=1

OPTION_NTP=1

OPTION_OCFS2=1

OPTION_OFILES=1

OPTION_PAM=1

OPTION_PRINT=1

OPTION_PROC=1

OPTION_SAM=1

OPTION_SAR=1

OPTION_SLERT=1

OPTION_SLP=1

OPTION_SMART=0

OPTION_SMB=1

OPTION_SMS=1

OPTION_SMT=1

OPTION_SRAID=1

OPTION_SSH=1

OPTION_SYSCONFIG=1

OPTION_SYSFS=1

OPTION_UDEV=1

OPTION_UP=1

OPTION_UPD=1

OPTION_WEB=1

OPTION_X=1

OPTION_XEN=1

ADD_OPTION_EDIR=0

ADD_OPTION_FSLIST=0

ADD_OPTION_LOGS=0

ADD_OPTION_MINDISK=0

ADD_OPTION_MINYAST=0

ADD_OPTION_RPMV=0

ADD_OPTION_SLP=0

VAR_OPTION_BIN_TIMEOUT_SEC=300

VAR_OPTION_CONTACT_COMPANY=「」

VAR_OPTION_CONTACT_EMAIL=「」

VAR_OPTION_CONTACT_NAME=「」

VAR_OPTION_CONTACT_PHONE=「」

VAR_OPTION_CONTACT_STOREID=「」

VAR_OPTION_CONTACT_TERMINALID=「」

VAR_OPTION_CUSTOM_ARCH=「」

VAR_OPTION_GPG_UID=「」

VAR_OPTION_LINE_COUNT=500

VAR_OPTION_LOG_DIRS=「/var/log /tmp」

VAR_OPTION_MSG_MAXSIZE=500000

VAR_OPTION_PENGINE_FILES_LIMIT=250

VAR_OPTION_SAR_FILES_LIMIT=30

VAR_OPTION_SBM=0

VAR_OPTION_SILENT=0

VAR_OPTION_UNIQUE_FILE=0

VAR_OPTION_UPLOAD_ALT=『https://secure-www.novell.com/upload?appname=supportconfig&file={tarball}』

VAR_OPTION_UPLOAD_TARGET=『ftp://ftp.novell.com/incoming』

配置文件中列出了默認收集的模塊信息,公司信息、郵件、電話及上傳的伺服器目錄等。

五、supportconfig總結

supportconfig是使用shell 編寫的一個功能十分強大的工具,具體可以通過vim /sbin/supportconfig 查看 。同時,由於linux命令上的通用性,我們甚至可以很簡單的進行修改後將其移植到其他linux 發行版上。不過顯然這是沒必要的,因為還有一個比較通的用的開源工具sosreport和其作用差不多,而其適用性更強。

supportconfig在Linux系統的安裝使用就介紹到這里了,supportconfig的用法還有很多,用戶可根據本文的方法舉一反三,掌握更多用法。

閱讀全文

與linux配置iscsi相關的資料

熱點內容
java三年經驗面試題 瀏覽:26
怎麼在所有文件名後加一個字 瀏覽:840
初中編程有什麼好書 瀏覽:932
iphone微信收藏文件過大無法查看 瀏覽:383
linux按按鍵產生中斷 瀏覽:16
微信怎麼刪除頭像 瀏覽:303
銀行列印劃款退款憑證就能列印文件路徑 瀏覽:869
怎麼查看手機以前數據 瀏覽:691
在ipad上編程軟體哪個好用 瀏覽:657
js獲取客戶端cpu 瀏覽:780
文件發至縣處級什麼意思 瀏覽:999
applestore需要國籍嗎 瀏覽:101
ppt教程書籍 瀏覽:253
扒系統文件 瀏覽:971
新版體系文件內容 瀏覽:659
誤刪win10系統引導分區 瀏覽:674
哪些基金投資了游族網路 瀏覽:536
蘋果手機官網聯系電話 瀏覽:18
jsp圖書管理系統製作教程 瀏覽:826
區分黑蘋果系統文件 瀏覽:853

友情鏈接