1. iscsi Introduction
?
? ISCSI uses port 860 and port 3260 of TCP/IP as the communication channel. The iSCSI protocol is used between two computers to exchange SCSI commands, so that the computer can simulate SAN as a local storage device through a high-speed LAN collection line.
?
?
Although iSCSI can communicate with any type of SCSI device, system administrators use it almost always to connect to server computers (such as database servers) and storage arrays on disk volumes. ISCSI SAN is usually used for the following two purposes:
Storage IntegrationCompanies want to move different storage resources from servers distributed on the network to a unified location (often a data center), which makes storage allocation more effective. Servers in the SAN environment can obtain new disk volumes without any changes to hardware or cable connections.
Disaster recoveryThe company wants to mirror storage resources from one data center to another remote data center, which can be used for hot backup in the case of a long power failure. In particular, iSCSI SAN allows us to migrate the entire disk array on the WAN with minimal configuration changes. In essence, storage is changed to "routable ", just like a normal network communication.
?
? Here we can give an example. Alibaba's server has many accounts. If the account and password are actually on a single server, the information will be lost when the server fails. That is disastrous for both Alibaba and users. Therefore, use a network device instead of a local server hard disk:
?
?
?
? As described in the figure, the customer only accesses the device in the disk cabinet, not the server that provides services. The inventory cabinet is managed by a separate server. The server only provides external assignment tasks, so that the storage separation technology is realized and the functions of each server are unified, makes the entire architecture more secure.
?
? 2. iscsi implementation
?
? After understanding the basic principles of iscsi, we need to implement an iscsi model.
?
? (1) Preparations
?
? There must be two hosts, one providing a network device (equivalent to a disk Cabinet) and the other using a network device (equivalent to a UNIX server ).
?
(2) formal Configuration
?
? 1. Check the server first:
?
? 1) first, you must create a device that is shared externally;
? 2) install the iscsi server;
? 3). enable the Service After configuring the service;
?
? 1). Make the device:
?
?
?
?
?
? After the generation is complete, perform the following operations. The second operation is performed twice:
?
?
?
? 2. Install the iscsi Server:
?
?
? 3) set the main configuration file:
?
?
? Share the device. The server name is westos.example.com.
?
?
? Enable the service:
?
?
?
? 2. Client
?
? At this time, our server has shared a device, and the client is to obtain it. First, we will install the iscsi client:
?
?
?
? Fortunately, we have installed it.
?
? Find the shared network device of the specified ip address. We can see that we have found:
?
?
? Enable this network device:
?
?
? Enabled successfully!
?
? We listed the currently available devices on this server and found that there is a network device/dev/sda in addition to the local/dev/vda devices. This is a network device shared by westos.example.com. We can operate on it. What actually changes is the device in westos.example.com. When the server fails, the server shared with the device retains data, which is very secure. Does not affect business operations.
?
?
?
?
?
? We can operate on it like using a local hard disk. We can use it to generate new devices and mount and use them.
?
?
?
?
?
? Then you can format the mount:
?
?
?
?
?
? To be permanently mounted, you need to write the/etc/fstab file:
?
?
?
? Note: pay attention to the details here. Add _ netdev after ults; otherwise, it cannot be used.
?
? 3. We have discussed how to use this network device, so we also need to perform a series of operations when we don't want to use it:
?
? 1) uninstall it first. Delete it If/etc/fstab writes;
? 2) disconnect the device from iscsi;
?
? 1) uninstall it first:
?
? 2) disconnect the device from iscsi:
?
? Detach a device:
?
?
? After deletion, exit and find that the network device is indeed missing:
?
?
?
? Summary:
?
? The above is the most basic configuration of iscsi storage separation. Think about this idea and it will be widely used. We will also meet it when talking about clusters and Server Load balancer in the future. I will explain it later. Today's two are even better!
?