Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

KVM and GFS set up deployment clusters

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Brief introduction

KVM is the abbreviation of Keyboard Video Mouse. KVM can access and control the computer by directly connecting the keyboard, video, and mouse (KVM) ports. KVM technology does not require the target server to modify the software. This means that the target computer can be accessed at any time in the BIOS environment. KVM provides true motherboard-level access and supports multi-platform servers and serial devices. KVM technology has developed from the initial basic SOHO office type to the enterprise IT basic computer room facility management system. Servers and devices located in multiple remote locations can be easily accessed directly from the kvm client management software. The KVM over IP solution has complete multi-location failover capabilities, a direct interface that complies with the New Server Management Standard (IPMI), and the ability to map local storage media to remote locations.

GFS is an extensible distributed file system for large, distributed applications that access large amounts of data. It runs on cheap ordinary hardware, but it can provide fault tolerance. It can provide high-performance services to a large number of users.

Experimental topology diagram:

Experimental demand

In order to build a KVM virtual platform, we need to create a stripe replication volume to provide the virtual host with building environment and distributed storage capabilities.

Construction of GFS Cluster

On GFS we need to add a hard disk for each node and use them as load space for stripe replication volumes.

Build the environment 1. 4 node nodes, each add a 20g mobile hard disk, and start the virtualization engine on the client

2. Modify the name of the node node

Modified to node1, node2, node3, node4 respectively

[root@localhost ~] # hostnamectl set-hostname node1 [root@localhost ~] # su3, format and mount the disks on four servers

Here we use scripts to perform mounts

# enter the opt directory [root@node1 ~] # cd / opt# disk formatting and mounting script [root@node1 opt] # vim a.shallows! / bin/bashecho "the disks exist list:" fdisk-l | grep 'disk / dev/sd [a murz]' echo "= =" PS3= "chose which disk you want to create:" select VAR in `disk / dev/sd* | grep-o'sd [BMZ]'| Uniq`quitdo case $VAR in sda) fdisk-l / dev/sda break Sd [bmerz]) # create partitions echo "n p w" | fdisk / dev/$VAR # make filesystem mkfs.xfs-I size=512 / dev/$ {VAR} "1" & > / dev/null # mount the system mkdir-p / data/$ {VAR} "1" & > / dev/null echo-e "/ dev/$ { VAR} "1" / data/$ {VAR} "1" xfs defaults 0\ n "> > / etc/fstab mount-a & > / dev/null break ; quit) break;; *) echo "wrong disk,please check again";; esacdone# gives script execution permission [root@node1 opt] # chmod + x a.sh

Push the script to the other three servers via scp

Scp a.sh root@192.168.45.134:/optscp a.sh root@192.168.45.130:/optscp a.sh root@192.168.45.136:/opt

This is just a sample.

[root@node1 opt] #. / a.shthe disks exist list:===1) sdb2) quitchose which disk you want to create:1 / / Select the disk Welcome to fdisk (util-linux 2.23.2) .Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Device does not contain a recognized partition tableBuilding a new DOS disklabel with disk identifier 0x37029e96.Command (m for help): Partition type: P primary (0 primary, 0 extended) 4 free) e extendedSelect (default p): Partition number (1-4, default 1): First sector (2048-41943039, default 2048): Using default value 2048Last sector, + sectors or + size {K of type Linux and of size M pencil G} (2048-41943039, default 41943039): Using default value 41943039Partition 1 of type Linux and of size 20 GiB is setCommand (m for help): The partition table has been altered calling ioctl () to re-read partition table.Syncing disks.4, set hosts file

Modify it on the first node1

# add vim / etc/hosts192.168.45.133 node1192.168.45.130 node2192.168.45.134 node3192.168.45.136 node4 at the end of the file

Push hosts files to other servers and clients through scp

# push the / etc/hosts file to another host [root@node1 opt] # scp / etc/hostsroot@192.168.45.130: / etc/hostsroot@192.168.45.130's password: hosts 100% 242 23.6KB/s 00:00 [root@node1 opt] # scp / etc/hostsroot@192.16 8.45.134:/etc/hostsroot@192.168.45 .134s password: hosts 100242 146.0KB/s 00:00 [root@node1 opt] # scp / etc/hostsroot@192.168.45.136: / etc/hostsroot@192.168.45.136's password: hosts

Check the push status on other servers

Turn off the firewalls of all servers and clients [root@node1 ~] # systemctl stop firewalld.service [root@node1 ~] # setenforce 0 build yum repositories on clients and node servers # enter the yum file path [root@node1 ~] # cd / etc/yum.repos.d/# create an empty folder [root@node1 yum.repos.d] # mkdir abc# and move all CentOS- files to abc [root@node1 yum.repos.d ] # mv CentOS-* abc# create private yum source [root@node1 yum.repos.d] # vim GLFS.repo [demo] name=demobaseurl= http://123.56.134.27/demogpgcheck=0enable=1[gfsrepo]name=gfsrepobaseurl=http://123.56.134.27/gfsrepogpgcheck=0enable=1# reload yum source [root@node1 yum.repos.d] # yum list install the necessary software package [root@node1 yum.repos.d] # yum-y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma start glusterd on four servers And set it to boot [root@node1 yum.repos.d] # systemctl start glusterd.service [root@node1 yum.repos.d] # systemctl enable glusterd.service to add node information [root@node1 yum.repos.d] # gluster peer probe node2peer probe: success. [root@node1 yum.repos.d] # gluster peer probe node3peer probe: success. [root@node1 yum.repos.d] # gluster peer probe node4peer probe: success.

View node information on other servers

[root@node1 yum.repos.d] # gluster peer status create distributed replication volume # create distributed replication volume [root@node2 yum.repos.d] # gluster volume create dis-rep replica 2 node1:/data/sdb1 node2:/data/sdb1 node3:/data/sdb1 node4:/data/sdb1 forcevolume create: dis-rep: success: please start the volume to access data# start replication volume [root@node2 yum.repos.d] # gluster volume start dis-rep volume start: dis-rep: successKVM virtual host operation 1, Mount the system image package we need to install to the virtual machine # Mount package mount.cifs / / 192.168.100.3/lzp / mnt# first copy the installation image package to the / opt/ directory cp-r / mnt/CentOS-7-x86_64-DVD-1708.iso / opt/ & 2, Configure your own source # enter the yum file path [root@node1 ~] # cd / etc/yum.repos.d/# delete the private source just created on the client [root@node1 yum.repos.d] # rm-rf GLFS.repo# move all CentOS- files to yum.repos.d [root@node1 abc] # mv CentOS-*.. / # reload public source root@node1 yum.repos.d] # 3, Configure KVM must environment package # install desktop environment yum groupinstall "GNOME Desktop"-y#KVM module yum install qemu-kvm- y # debug tool yum install qemu-kvm-tools-y # build virtual host command tool yum install virt-install-y#qemu component Create a disk, start the virtual machine yum install qemu-img-y # network support tool yum install-y bridge-utils# virtual machine management tool yum install libvirt-y # graphical management of virtual machine yum install virt-manager-y4, determine whether cpu supports virtualization. And check the virtual machine module egrep'(vmx | svm)'/ proc/cpuinfo#, module lsmod | grep kvm5, enable the service, and set the boot self-boot # boot service systemctl start libvirtd# boot self-startup systemctl enable libvirtd mobile package Move the mounted software package to the / data/ directory # create the mount point mkdir / data/# mount the stripe replication volume you just created to the data directory mount.glusterfs node3:dis-rep / data/# create two files mkdir vdisk viso# copy and transfer to the background to run cp-r / mnt/CentOS-7-x86_64-DVD-1708.iso / data/viso & configure the virtual machine bridge network card # enter the network card text cd / etc/sysconfig/network-scripts/# copy to create br0 network card cp-p ifcfg-ens33 ifcfg-br0# enter ens33 network card Set bridging commands vim ifcfg-ens33# bridging commands BRIDGE=br0# configure bridging network card, set bridge network card to static address vim ifcfg-br0TYPE=bridgePROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=br0DEVICE=br0ONBOOT=yesIPADDR=192.168.45.140NETMASK=255.255.255.0GATEWAY=192.168.45.2# restart network card service network restart to view network card information

Enter the graphical management interface virt-manager

Select Storage, click Select to enter the storage control interface

Select create a new storage pool and enter a name

Then select forward, and then on the page that pops up inside, click Browse. Enter the following interface

Click on the icon

Go to the vdisk folder under the data directory, and then select and click Open.

Click finish after exiting the interface to complete the creation of the new storage pool

Select add new volume on dis, click enter and enter the name, and enter the interval size to be allocated on the storage volume quota below

Using the same steps as above, create an iso storage pool

Select the / image in the viso/ in / data/z here, and then click Open

Then click finish to complete the addition of the address pool, view the created storage pool, and then click exit in the file.

Click on the file and select to generate a new virtual host

Proceed with the above selection, and then, when selecting the system image to install, select the image in iso

Mirror selection completed, click forward

The size of the allocated memory, generally according to the size of your actual memory.

Choose to create custom storage and select the Centos7 file you just created in vdisk

Click Select, customize the configuration before installation, and then click finish

In the boot option, start the virtual machine when you select the host to boot

Click to start the installation, which will be the same as the steps we used to install CentOS.

Then the automatic installation begins, and the virtual usage can be seen on the virtual machine manager.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report