Linux Storage technologies and applications: Configuring iSCSI Services and application examples

Source: Internet
Author: User

Experiment: Configure the iSCSI service, (service 4.103, customer 4.254/4.100)

Add a new hard disk first

FDISK-CU/DEV/SDB # Enter disk partition mode

Enter the following information in the partition mode: partition

-N #新建分区

-P #创建主分区

1 #第一个分区

Enter

+1G #第一个分区大小

W #保存并退出

LSBLK can discover that a new partition already exists

Mount/dev/sdb1/var/lib/mysql #挂载新分区到mysql数据库

Start the MySQL service to create a library table and other information

Configure the service side:

Server-side installation of iSCSI packages (requires three hosts, one service side, two clients)

Yum -y install SCSI-target-utils

Vim/etc/tgt/targets.conf

<target iqn.2016-03.com.haha.xixi:lele> #定义存储名
BACKING-STORE/DEV/SDB1 #定义存储设备
Initiator-address 192.168.4.100 #定义客户端IP
Initiator-address 192.168.4.254 #定义客户端IP
</target>

/ETC/INIT.D/TGTD start Chkconfig TGTD on #启动并设置开机启动服务

Tgt-admin-s View effective information (appears LUN1 indicates success and has ACL client IP record)

Configure two clients: (need to use MySQL to do the experiment, so to install mysql-server)

Yum-y Install Scsi-initiator-utils #安装mysql和scsi包

Man Iscsadm #由于命令过长用man Open the Help file to find the commands under the examples list
Iscsiadm--mode Discovery--type sendtargets--portal 192.168.4.103--discover #客户端探测服务器共享 (fill the server-side IP)

Iscsiadm--mode node--targetname iqn.2016-03.com.haha.xixi:lele--portal 192.168.4.103:3260--login #登入共享存储

/ETC/INIT.D/TGTD lsblk #发现共享存储/DEV/SDB1 can be formatted and used for partition mount (note:

Note: It is absolutely impossible to mount the shared store on both hosts, or it will cause a file system crash!!! )

iSCSI Service Application instance (MySQL)

First, configure the application server

1 , install on two storage clients MySQL

# yum Install-y mysql-server

2 , the ISCSI shared storage Mounts to MySQL The Data directory

Mount/dev/sdb1/var/lib/mysql

/etc/init.d/mysql start

Create a database table and add content

Second, the simulation of the first database server failure

1 , stop the first server mysqld Service

# Service Mysqld Stop

2 , uninstalling shared storage

# UMOUNT/DEV/SDB1

Third, start the mysqld on the second server

1 , Mount shared storage

Mount/dev/sdb1/var/lib/mysql

2 , start the service

# service Mysqld Start

3 , test whether the database created by the first server can be used


Linux Storage technologies and applications: Configuring iSCSI Services and application examples

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.