반응형

안녕하세요.


최근 리눅스의 iSCSI 와 관련된 업무를 진행하고 있습니다.


관련 오픈소스인 LIO와 관련 배경지식 대해 알아보겠습니다.



1. iSCSI


iSCSI(Internet Small Computer System Interface)는 컴퓨팅 환경에서 데이터 스토리지 시설을 이어주는 IP 기반의 스토리지 네트워킹 표준이다. 


iSCSI는 IP 망을 통해 SCSI 명령을 전달함으로써 인트라넷을 거쳐 데이터 전송을 쉽게 하고 먼 거리에 걸쳐 스토리지를 관리하는 데 쓰인다. 


iSCSI는 근거리 통신망과 원거리 통신망, 아니면 인터넷을 통해 데이터를 전송하는 데 쓰이며 위치에 영향을 받지 않는 데이터 보관과 복구를 사용할 수 있게 한다.


(출처 - 위키백과 https://ko.wikipedia.org/wiki/ISCSI)



서버 역할의 iSCSI Target과, 클라이언트 역할의 iSCSI Initiator로 구분됨.




(Typical iSCSI Architecture, http://www.radiomagonline.com/misc/0082/all-about-iscsi/26981)





2. LIO (Linux I/O)


LIO는 iSCSI Target 관리 데몬이다.


사용자 (관리자)는 'targetcli'를 통해 LIO를 설정할 수 있다.



(LIO Architecture, Wikipedia https://en.wikipedia.org/wiki/LIO_(SCSI_target))



2.1. Backstores


(1) FILEIO - Target은 디스크 이미지 파일을 생성. Initiator는 해당 파일을 디스크 처럼 사용.


(2) BLOCK - 물리 / 논리 볼륨 자체를 공유. Initiator 입장에서는 FILEIO와 IBLOCK이 동일.



2.2. IQN (iSCSI Qaulified Name)


iSCSI Target과 Initiator 각각의 고유 이름 포맷 중 하나.


(이름 포맷에는 IQN 이외에 EUI : Extended Unique Identifier, NAA : Network Address Authority 등이 있음)


- 포맷 형태 -


Type.Date.Naming_Auth:String_defined_by_example.com_Naming_authority


 - Type : 'iqn' 으로 고정


 - Date : 'YYYY-MM' 의 형태


 - Naming_Auth : 도메인의 역순 형태 (ex - org.kernel)


 - String_defined_by_example.com_Naming_authority (옵션) : 설명 등)


* Type 과 Date, Date와 Naming_Auth는 '.' 으로 연결하고, Naming_Auth와 설명은 콜론 (':')으로 연결.


->


iqn.YYYY-MM.Naming_Auth:String_defined_by_example.com_Naming_authority


ex 1) iqn.2017-08.com.example:storage.raid


ex 2) iqn.2017-08.com.example



2.3. LIO (iSCSI Target) 설치 (CentOS 7.0 기준)


(1) 다음 명령어로 설치 가능


# yum install -y targetcli



(2) 설치 후 부팅시 자동 실행되도록 등록


# systemctl enable target



(3) 기본 포트 (TCP 3260) 방화벽에 등록


# firewall-cmd --permanent --add-port=3260/tcp


# firewall-cmd --reload



2.4. LIO 설정 (targetcli)


(1) targetcli 실행 (LIO 설정 모듈)


# targetcli


Warning: Could not load preferences file /root/.targetcli/prefs.bin.

targetcli shell version 2.1.fb41

Copyright 2011-2013 by Datera, Inc and others.

For help on commands, type 'help'.


/>



(2) backstore 생성


① FILEIO 사용 시


/> backstores/fileio/ create Backstore_FILEIO_이름 이미지파일_경로_및_파일명 이미지파일_용량




/> backstores/fileio/ create shareddata /mnt/vol/shareddata.img 100M


Created fileio shareddata with size 104857600


/>

 


② BLOCK 사용 시


/> backstores/block/ create Backstore_Block_이름 Block_Device_경로




/> backstores/block/ create sharedblock /dev/sdb


Created block storage object sharedblock using /dev/sdb.


/>

 



(3) iSCSI TPG (Target Portal Group) 생성


iSCSI Target의 포탈 그룹을 생성. (IQN 형태)


/> iscsi/ create 포탈_그룹_명_(IQN형태)




/> iscsi/ create iqn.2017-08.com.gluesys:t1


Created target iqn.2017-08.com.gluesys:t1.


Created TPG 1.


Global pref auto_add_default_portal=true


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


/> 




Target Portal Group 설정을 위해 해당 위치로 이동. (cd 명령어 사용)


ls 명령어 입력 시 설정해야하는 내용 확인 가능.


/> cd iscsi/포탈_그룹_명/tpg1


/> ls



/> cd iscsi/iqn.2017-08.com.gluesys:t1/tpg1/


/iscsi/iqn.20...uesys:t1/tpg1> ls


o- tpg1 ............................................................. [no-gen-acls, no-auth]

  o- acls ........................................................................ [ACLs: 0]

  o- luns ........................................................................ [LUNs: 0]

  o- portals .................................................................. [Portals: 1]

    o- 0.0.0.0:3260 ................................................................... [OK]

/iscsi/iqn.20...uesys:t1/tpg1> 




* acls (access control lists) : 접속을 허용 할 target 리스트


* luns (logical unit number) : 접속을 허용 할 backstores 리스트 


* portals : 접속을 허용 할 IP 리스트 (IP:Port 형태)



(4) TPG의 LUN 추가


① FILEIO 사용 시


/iscsi/...../tpg1> luns/ create /backstores/fileio/Backstore_FILEIO_이름




/iscsi/iqn.20...uesys:t1/tpg1> luns/ create /backstores/fileio/shareddata 


Created LUN 0.


/iscsi/iqn.20...uesys:t1/tpg1>

 



② BLOCK 사용 시


/iscsi/...../tpg1> luns/ create /backstores/block/Backstore_Block_이름



/iscsi/iqn.20...uesys:t1/tpg1> luns/ create /backstores/block/sharedblock 


Created LUN 1.


/iscsi/iqn.20...uesys:t1/tpg1> 




ls 명령어를 사용하여 생성된 LUN 확인



/iscsi/iqn.20...uesys:t1/tpg1> ls


o- tpg1 ............................................................. [no-gen-acls, no-auth]

  o- acls ........................................................................ [ACLs: 0]

  o- luns ........................................................................ [LUNs: 2]

  | o- lun0 .................................. [fileio/shareddata (/mnt/vol/shareddata.img)]

  | o- lun1 ................................................. [block/sharedblock (/dev/sdb)]

  o- portals .................................................................. [Portals: 1]

    o- 0.0.0.0:3260 ................................................................... [OK]


/iscsi/iqn.20...uesys:t1/tpg1> 

 



(5) TPG의 ACL 추가 및 설정


/iscsi/...../tpg1> acls/ create Initiator_이름_(IQN형태)




/iscsi/iqn.20...uesys:t1/tpg1> acls/ create iqn.2017-08.com.gluesys:chpark


Created Node ACL for iqn.2017-08.com.gluesys:chpark

Created mapped LUN 1.

Created mapped LUN 0.


/iscsi/iqn.20...uesys:t1/tpg1>  




ACL 설정을 위해 cd명령어 사용하여 이동하여 User ID & Password 설정


/iscsi/...../tpg1> cd acls/Initiator_이름


/iscsi/......> set auth userid=USER_ID


/iscsi/......> set auth password=USER_PASSWORD



'info' 명령어를 통해 설정 내용 확인 가능




/iscsi/iqn.20...uesys:t1/tpg1> cd acls/iqn.2017-08.com.gluesys:chpark/


/iscsi/iqn.20...luesys:chpark> set auth userid=chpark


Parameter userid is now 'chpark'.


/iscsi/iqn.20...luesys:chpark> set auth password=123456


Parameter password is now '123456'.


/iscsi/iqn.20...luesys:chpark> info


chap_password: 123456

chap_userid: chpark

wwns:

iqn.2017-08.com.gluesys:chpark


/iscsi/iqn.20...luesys:chpark> 




(6) 설정 저장


exit 명령어로 설정 저장.


설정 내용은 /etc/target/saveconfig.json 에 json 형태로 저장됨.



/iscsi/iqn.20...luesys:chpark> exit


Global pref auto_save_on_exit=true

Last 10 configs saved in /etc/target/backup.

Configuration saved to /etc/target/saveconfig.json


#

 


반응형
Posted by 해리팍
BLOG main image

Chanhyun Park (해리팍)
Software Engineer @ SK hynix

Contact Info.
parkch0708@hanmail.net
chanhyun0708@gmail.com
chanhyun.park@sk.com

카테고리

All (1501)
Profile (2)
Park's Life (599)
Computer System (165)
Computer Programming (39)
Computer Study (54)
Computer Etc. (189)
Scuba Diving (137)
Golf (8)
Traveling (245)
생활 정보 (12)
Pokemon GO (50)