XenServer server
OS:XenServer 6.2
Hostname:xsr01
IP:192.168.0.241/24
Gateway:IP:192.168.0.1/24
NFSserver
OS:CentOS 6.4
Hostname:nfs01
IP:192.168.0.204/24
Gateway:IP:192.168.0.1/24
Running software: nfs, rpcbind
1. About XenServer storage
The installation process of XenServer, without partition operation, after the system installation is completed, viewdiskIn this case, you will find that even a 1T hard drive only leaves 4G of space, and the XenServer system file has occupied 1.9G of it, leaving only a pitifully small space of 2G, and even a CentOS6.5 system image cannot be placed. If you can't put the ISO image file, how can you install a virtual machine? This is a headache for beginners.
So, how does XenServer scale storage? The concept of storage repositories (SR - Storage Repositories) is introduced in XenServer, which is used to store ISOs or VIDs. Citrix officially recommends using shared storage, which is also the original intention and goal of XenServer design, which is very different from VMWare's product design. Currently, XenServer supports three storage types: FC SAN, ISCSI SAN, and NFS, and divides different LUN types according to different virtualization types to meet the requirements. This involves storage servers, and there are requirements for equipment costs.
The text mainly uses NFS as an example to explain how to add sharesstorage。 The specific implementation is not difficult to operate, because most of the operations are carried out on the graphical interface on XenCenter.
XenServer installation matters have been discussed in the article "XenServer Deployment History - System Installation and Licensing", and will not be listed here.
2. Build an NFS server
First, let's briefly understand what NFS is.
NFS is an abbreviation for Network File System, which is a network file system. A protocol for distributed file systems, developed by Sun Corporation and published in 1984. The function is to allow different machines and different operating systems to share individual data with each other through the network, and to allow applications to access data located on the server disk through the network on the client, which is implemented between Unix-like systemsdiskA method of file sharing.
The basic principle of NFS is "Allow for differencesclientand the server shares the same file system through a set of RPCs", which is independent of the operating system and allows different hardware and operating systems to share files together. By using NFS, users and programs can access files on the remote system just as they would local files.
Let's start building an NFS server, which is an easy task for IT who are familiar with Linux.
In this case, NFS is locatedserverThe system information is as follows:
OS:CentOS release 6.4 (Final)
IP:192.168.0.204/24
Partitions: /boot(500M), /(50G), /home(955G), swap(4G)
Note: In this case, the system is a virtual machine running on another XenServer, which is installed using the CentOS 6.4 template in XenServer and adopts the default partitioning method. This approach is to minimize installation, many software packages are not installed, including NFS, which has to be installed manually, which is more troublesome.
In Red Hat Linux/CentOS systems, NFS installation is very simple, requiring only two packages, and is usually installed as the default package for the system.
nfs-utils-*: Includes basic NFS commands and monitors
rpcbind: Supports connections for secure NFS RPC services (Note, this is a package under CentOS6, portmap in CentOS 5)
The relationship between RPC and NFS can be understood in this way: NFS is a file system, and RPC is responsible for the transmission of information.
Check if NFS is installed on the system with the following command,
# rpm -qa | grep nfs
# rpm –qa | grep rpcbind
If it is not in the current systemInstallationThe packages required for NFS need to be installed manually and set up to start.
# yum install rpcbind*
# yum install nfs-utils-*
# service rpcbind start
# service nfs start
# chkconfig rpcbind on
# chkconfig nfs on
Create iso and data folders in the /home directory and share them via nfs, which are used as XenServer imagesstorageWarehouses and virtual machine storage warehouses.
# mkdir -p /home/iso
# mkdir -p /home/data
# vi /etc/exports (Note, the following two lines are edited)
/home/data *(rw,sync,no_root_squash)
/home/iso *(rw,sync,no_root_squash)
# exportfs –a
Check the sharing status with the following command, and if the shared directory is listed, the sharing is successful.
# showmount -e 192.168.0.204
Export list for 192.168.0.204:
/home/data *
/home/iso *
After the sharing settings are completed, you need to open the relevant port in iptables (this is a bit complicated) or close iptables directly (this is the easiest), otherwise the other party will not be able to access it.
3. Add NFS VHD
atclientUse XenCener to connect the remote xsr01 host. The following operations are performed on XenCenter.
Right-click the xsr01 host, select "New SR" in the pop-up menu, and the "New Storage Repository" dialog box will pop up, and then make relevant settings in it. As shown in the figure below.
Select the NFS VHD type.
Set a name for the SR, which is the default name.
Fill in the path to the NFS shared directory. Notice, there is a colon in the middle.
After the addition is successful, you can see that an item named "NFS virtual disk storage" has been added under xsr01, and it will automatically become the default local storage.
Select "NFS virtual disk storage", and in the "General, Storage, Logs" tab on the right side of the interface, you can see its capacity, storage content, logs, and other information.
If the addition is unsuccessful, the message "The SR failed to complete the operation. Check your setting and try again.” Check the firewall.
4. Add NFS ISO
The operation process is similar to adding an NFS VHD, as shown in the following image.
In the Storage tab, you can see that the ISO at this timestorageThere are two ISO images available in the repository.
5. Add CIFS ISO
CIFS, also mention the concept. CIFS (Common Internet File System) is a network file system launched by Microsoft. In Win OS, CIFS is integrated into the OS, no additional software is required, all machines are peer-to-peer, playing dual roles, can be Sever or Client. In contrast, NFS requires the client to must:InstallationDedicated software.
NFS is transport-independent and can use TCP or UDP; CIFS is a shared protocol for network connections, which requires high reliability of network transmission and often uses TCP/IP. NFS retains the file format characteristics of unix, such as owners, groups, etc.; CIFS is done in the style of Win OS.
CIFS is not often used in production environments, but it is still commonly used in the early stage of project deployment and some temporary operations. Here's how to add a CIFS ISO.
First of all, of course, there must be one with Win OSserverShare files outward.
In this case, the operating system where CIFS is located is the system where XenCenter is located in this case, a very ordinary PC, the information is as follows:
OS:Windows XP SP3
IP:192.168.0.102/24
Gateway:IP:192.168.0.1/24
Here set the ISO folder under the E drive to share. This is the basic skill of IT, so I won't say much. As shown in the figure. (Note, in this case, there is no domain control environment.) If the Windows XP is joined to domain control, access permissions need to be set here. )
The following operations are performed on XenCenter. The operation process is similar to adding an NFS VHD, as shown in the following image.
Note that this path is written differently than the previous NFS path. If the Windows XP is joined to the domain control, you need to fill in the username and password that are allowed to access, and of course, you can also use the Windown XP local administrator account and password to verify.
6. Others
After the above operations are successfully completed, when creating a new virtual machine, you can use the ISO image (such as CentOS 6.4) from the "CIFS ISO library" or "NFS ISO library" as the new virtual machineInstallationsource.
The virtual disk of the virtual machine is stored in the NFS virtual disk storage repository by default, or you can choose the original local storage "Local storage on xsr01".
As far as stand-alone machines are concerned, the storage is the same everywhere, but if there are multiple XenServer hosts, resource pools, and high-availability operations such as XMotion are required, the powerful advantages of NFS shared storage are reflected.
In the actual production site, due to the usestorage devices, more often using ISCSI to addstorage, the advantages are greater.
|