This commit is contained in:
liaoishere 2015-01-03 14:25:11 +08:00
commit f481c2995d

View File

@ -1,46 +1,47 @@
Centralized Secure Storage (iSCSI) “Initiator Client” Setup on RHEL/CentOS/Fedora Part III
中心化存储iSCSI- “初始器客户端” 在RHEL/CentOS/Fedora上的设置 - 第三部分
================================================================================
**iSCSI** Initiator are the clients which use to authenticated with iSCSI target servers to access the LUNs shared from target server. We can deploy any kind of Operating systems in those locally mounted Disks, just a single package need to be install to get authenticate with target server.
**iSCSI** 初始化器是一种用于与iSCSI target服务器认证并访问服务器上共享的的LUN的客户端。我们可以在本地挂载的硬盘上部署任何操作系统只需要安装一个包来与target服务器验证。
![Client Initiator Setup](http://www.tecmint.com/wp-content/uploads/2014/07/Client-Initiator-Setup.jpg)
Client Initiator Setup
初始器客户端设置
#### Features ####
#### 功能 ####
- Can handle any kind of file systems in locally mounted Disk.
- No need of restating the system after partition using fdisk.
- 可以处理本地挂载磁盘上的任意文件系统
- 在使用fdisk命令后不需要重启系统
#### Requirements ####
#### 要求 ####
- [Create Centralized Secure Storage using iSCSI Target Part 1][1]
- [Create LUNs using LVM in Target Server Part 2][2]
- [使用iSCSI Target创建集中化安全存储- 第一部分][1]
- [在Target服务器中使用LVM创建LUN - 第二部分][2]
#### My Client Setup for Initiator ####
#### 我的客户端设置 ####
- Operating System CentOS release 6.5 (Final)
- 操作系统 CentOS release 6.5 (最终版)
- iSCSI Target IP 192.168.0.50
- Ports Used : TCP 3260
- 使用的端口 : TCP 3260
**Warning**: Never stop the service while LUNs Mounted in Client machines (Initiator).
**Warning**永远不要在使用LUN的时候在客户端中初始化器停止服务。
### Initiator Client Setup ###
**1.** In Client side, we need to install the package **iSCSI-initiator-utils**, search for the package using following command.
### 客户端设置 ###
**1.** 在客户端,我们需要安装包‘**iSCSI-initiator-utils**‘,用下面的命令搜索包。
# yum search iscsi
**Sample Output**
**示例输出**
============================= N/S Matched: iscsi ================================
iscsi-initiator-utils.x86_64 : iSCSI daemon and utility programs
iscsi-initiator-utils-devel.x86_64 : Development files for iscsi-initiator-utils
**2.** Once you locate the package, just install the initiator package using yum command as shown.
**2.** 一旦定位了包就用下面的yum命令安装初始化包。
# yum install iscsi-initiator-utils.x86_64
**3.** After installing the package, we need to discover the share from **Target server**. The client side commands little hard to remember, so we can use man page to get the list of commands which required to run.
**3.** 安装完毕后,我们需要发现**Target 服务器**上的共享。客户端的命令有点难记因此我们使用man来的到需要运行的命令列表
# man iscsiadm
@ -48,47 +49,47 @@ Client Initiator Setup
man iscsiadm
**4.** Press **SHIFT+G** to Navigate to the Bottom of the man page and scroll little up to get the login example commands. We need to replace our **Target servers IP** address in below command Discover the Target.
**4.** 按下**SHIFT+G** 进入man页的底部并且稍微向上滚动来的到登录的示例命令。下面的发现命令中需要用我们的**服务器IP地址**来替换。
# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.0.200 --discover
**5.** Here we got the iSCSI (iqn) qualified name from above command execution.
**5.** 这里我们从下面的命令中得到了iSCSIi限定名iqn
192.168.0.200:3260,1 iqn.2014-07.com.tecmint:tgt1
![Discover Target](http://www.tecmint.com/wp-content/uploads/2014/07/Discover-Target.jpg)
Discover Target
发现服务器
**6.** To log-in use the below command to attach the LUN to our local System, this will authenticate with target server and allow us to log-in into LUN.
**6.** 要登录就用下面的命令来连接一台LUN到我们本地系统中这会与服务器验证并允许我们登录LUN。
# iscsiadm --mode node --targetname iqn.2014-07.com.tecmint:tgt1 --portal 192.168.0.200:3260 --login
![Login To Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Login-To-Target-Server.jpg)
Login To Target Server
登录到服务器
**Note**: Use the login command and replace login with logout at end of command.
**注意**登出使用登录命令并在命令的最后使用logout来替换。
# iscsiadm --mode node --targetname iqn.2014-07.com.tecmint:tgt1 --portal 192.168.0.200:3260 --logout
![Logout from Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Logout-from-Target-Server.jpg)
Logout from Target Server
等出服务器
**7.** After login to the LUN, list the records of Node using.
**7.** 登录服务器后,使用下面的命令列出节点的记录。
# iscsiadm --mode node
![List Node](http://www.tecmint.com/wp-content/uploads/2014/07/List-Node.jpg)
List Node
列出节点
**8.** Display all data of a particular node.
**8.** 显示特定节点的所有数据
# iscsiadm --mode node --targetname iqn.2014-07.com.tecmint:tgt1 --portal 192.168.0.200:3260
**Sample Output**
**示例输出**
# BEGIN RECORD 6.2.0-873.10.el6
node.name = iqn.2014-07.com.tecmint:tgt1
@ -108,33 +109,33 @@ List Node
iface.linklocal_autocfg = <empty>
....
**9.** Then list the drive using, fdisk will list every authenticated disks.
**9.** 接着列出使用的磁盘fdisk会列出所有的认证过的磁盘。
# fdisk -l /dev/sda
![List Disks](http://www.tecmint.com/wp-content/uploads/2014/07/List-Disks.jpg)
List Disks
列出磁盘
**10.** Run fdisk to create a new partition.
**10.** 运行fdisk命令来创建一个新的分区
# fdisk -cu /dev/sda
![Create New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Create-New-Partition.jpg)
Create New Partition
创建新分区
**Note**: After Creating a Partition using fdisk, we dont need to reboot, as we used to do in our local systems, Because this is a remote shared storage mounted locally.
**注意**在使用fdisk创建新分区之后我们无需重启就像使用我们本地的文件系统一样就行。因为这个将远程共享存储挂载到本地了。
**11.** Format the newly created partition.
**11.** 格式化新创建的分区
# mkfs.ext4 /dev/sda1
![Format New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Format-New-Partition.jpg)
Format New Partition
格式化新分区
**12.** Create a Directory and mount the formatted partition.
**12.** 创建一个目录来挂载新创建的分区
# mkdir /mnt/iscsi_share
# mount /dev/sda1 /mnt/iscsi_share/
@ -142,9 +143,9 @@ Format New Partition
![Mount New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Mount-New-Partition.jpg)
Mount New Partition
挂载新分区
**13.** List the Mount Points.
**13.** 列出挂载点
# df -Th
@ -153,45 +154,45 @@ Mount New Partition
![List New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/List-New-Partition.jpg)
List New Partition
列出新分区
**14.** If we need to permanently mount the Drive use fstab entry.
**14.** 如果需要永久挂在使用fdtab文件
# vim /etc/fstab
**15.**Append the following Entry in fstab.
**15.**在fstab后追加下面行
/dev/sda1 /mnt/iscsi_share/ ext4 defaults,_netdev 0 0
**Note:** Use _netdev in fstab, as this is a network device.
**注意:** 在fdtab中使用_netdev说明这是一个网络设备。
![Auto Mount Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Auto-Mount-Partition.jpg)
Auto Mount Partition
自动挂载分区
**16.** Finally check whether our fstab entry have any error.
**16.** 最后检查我们fstab文件是否有错误。
# mount -av
- **-a** all mount point
- **-v** Verbose
- **-a** 所有挂载点
- **-v** 繁琐模式
![Verify fstab Entries](http://www.tecmint.com/wp-content/uploads/2014/07/Verify-fstab-Entries.jpg)
Verify fstab Entries
验证fstab文件
We have Completed Our client side configuration Successfully. Start to use the drive as we use our local system disk.
我们已经成功完成了我们的客户端配置。现在让我们像本地磁盘一样使用它吧。
--------------------------------------------------------------------------------
via: http://www.tecmint.com/iscsi-initiator-client-setup/
作者:[Babin Lonston][a]
译者:[译者ID](https://github.com/译者ID)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.tecmint.com/author/babinlonston/
[1]:http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-targetin-linux/
[2]:http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/
[2]:http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/