oVirt管理端高可用模式搭建(hosted-engine)

oVirt管理端高可用模式搭建

oVirt是一个分布式虚拟化解决方案,旨在管理整个企业基础架构,oVirt使用受信任的KVM管理程序
操作系统版本:centos7.5
ovirt版本:ovirt4.2
安装模式:hosted-engine管理端高可用模式,其中engine作为一台虚拟机漂在所有的node节点上,如果当engine所在的node节点锁坏,那么会自动迁移到另一个node节点上。
硬件要求:engine作为管理端,CPU不低于四核,内存不低于16G,硬盘不低于50GB以及至少为1Gbps的网络接口;因为engine端作为虚拟机漂移在所有节点,那么所有node节点硬件配置均大于engine端的硬件配置。

步骤:

一、关闭selinux(所有节点)

[root@node1 ~]#sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config
[root@node1 ~]#setenforce 0

二、设定好 engine 虚拟机的 ip(所有节点)

虚拟机的 ip 要提前定好,并将对应的ip和域名写到主机的/etc/hosts中(因为 Hosted-Engine 中,和 engine 虚拟机的交互使用的是 FQDN)

[root@node1 ~]# vi /etc/hosts
192.168.40.110 engine.lxkj.com engine
192.168.40.111 node1.lxkj.com node1
192.168.40.112 node2.lxkj.com node2
192.168.40.113 node3.lxkj.com node3
192.168.40.114 node3.lxkj.com node4

三、ssh互信

[root@node1 ~]#ssh-keygen
[root@node1 ~]#ssh-copy-id node1
[root@node1 ~]#ssh-copy-id node2
[root@node1 ~]#ssh-copy-id node3
[root@node1 ~]#ssh-copy-id node4

四、添加 ovirt-4.2 的源(所有节点)

[root@node1 ~]#yum install http://resources.ovirt.org/pub/yum-repo/ovirt-release42.rpm -y

五、配置存储Glusterfs服务

1. 安装glusterfs(所有节点)

[root@node1 ~]#yum install -y vdsm-gluster 

2. 启动glusterfs(所有节点)

[root@node1 ~]#systemctl enable --now glusterd

3. 创建挂载目录并授权(所有节点)

[root@node1 ~]#mkdir -p /glusterfs/database/
[root@node1 ~]#chown -R vdsm:kvm /glusterfs/database/ # 为了ovirt挂载使用

4. 添加防火墙规则(所有节点)

[root@node1 ~]#firewall-cmd --add-service=glusterfs --permanent  
[root@node1 ~]#firewall-cmd --reload

5. 配置信任池(仅node1)

[root@node1 ~]#gluster peer probe node2
[root@node1 ~]#gluster peer probe node3
[root@node1 ~]#gluster peer probe node4

6. 设置gluster卷(仅node1)

[root@node1 ~]#gluster volume create gfs1 replica 2 transport tcp node1:/glusterfs/database/ node2:/glusterfs/database/ node3:/glusterfs/database/ node4:/glusterfs/database/ force

7. 启动gluster卷(仅node1)

[root@node1 ~]#gluster volume start gfs1

8. 确认gluster卷状态(所有节点)

[root@node1 ~]#gluster volume info

六、安装 ovirt-hosted-engine-setup 的包(仅node1)

[root@node1 ~]#yum install -y ovirt-hosted-engine-setup

七、配置 ovirt-hosted-engine(仅node1)

使用屏幕窗口管理器来运行脚本,以避免在网络或终端中断时丢失会话。
注意:可使用Ctrl+D键盘组合中止部署。如果会话超时或连接中断,请运行screen -d -r以恢复部署会话。

[root@node1 ~]#screen

启动部署脚本

[root@node1 ~]#ovirt-hosted-engine-setup

选择“ yes”开始部署:

Are you sure you want to continue? (Yes, No)[Yes]: 

配置网络,该脚本检测可能的NIC以用作环境的管理桥

Please indicate a pingable gateway IP address [192.168.40.1]: 
Please indicate a nic to set ovirtmgmt bridge on: (eth0) [eth0]: 

将此字段留空以使用oVirt Engine Appliance。

(leave it empty to skip, the setup will use ovirt-engine-appliance rpm installing it if missing): 

指定Engine虚拟机的FQDN

Engine VM FQDN:  []: engine.lxkj.com
Engine VM domain: [lxkj.com]

输入Engine的root密码:

Enter root password that will be used for the engine appliance: 
Confirm appliance root password: 

输入一个SSH公钥,允许您以root用户身份登录Engine,并指定是否为root用户启用SSH访问:

Enter ssh public key for the root user that will be used for the engine appliance (leave it empty to skip)
Do you want to enable ssh access for the root user (yes, no, without-password) [yes]: 

输入虚拟机的CPU和内存配置:

Please specify the number of virtual CPUs for the VM (Defaults to appliance OVF value): [4]: 
Please specify the memory size of the VM in MB (Defaults to appliance OVF value): [16384]: 

输入Engine虚拟机的MAC地址,或接受随机生成的虚拟机

You may specify a unicast MAC address for the VM or accept a randomly generated default [00:16:3e:2c:2c:39]:

输入虚拟机的网络详细信息

How should the engine VM network be configured (DHCP, Static)[DHCP]? static

静态IP地址必须与主机属于同一子网

Please enter the IP address to be used for the engine VM [192.168.40.2]: 192.168.40.110
Engine VM DNS (leave it empty to skip) [61.139.2.69,119.6.6.6]: 

指定是否将Engine虚拟机和基本主机的条目添加到虚拟机的/etc/hosts文件中。

Note: ensuring that this host could resolve the engine VM hostname is still up to you (Yes, No)[No] yes

提供SMTP服务器的名称和TCP端口号,用于发送电子邮件通知的电子邮件地址以及用于接收这些通知的逗号分隔的电子邮件地址列表:

Please provide the name of the SMTP server through which we will send notifications [localhost]: 
Please provide the TCP port number of the SMTP server [25]: 
Please provide the email address from which notifications will be sent [root@localhost]: 
Please provide a comma-separated list of email addresses which will get notifications [root@localhost]: 

输入admin @ internal用户的密码以访问管理门户:

Enter engine admin password: 
Confirm engine admin password:

选择要使用的存储类型:

Please specify the storage you would like to use (glusterfs, iscsi, fc, nfs)[nfs]: glusterfs

对于glusterfs,请输入完整地址和路径以及任何装载选项:

Please specify the full shared storage connection path to use (example: host:/path): 192.168.40.111:/gfs1

输入引擎磁盘大小:

Please specify the size of the VM disk in GiB: [50]: 100

清理失败的自托管引擎部署

如果自托管引擎部署中断,后续部署将失败并显示错误消息。错误将根据部署失败的阶段而有所不同。如果收到错误消息,请运行清理脚本以清除失败的部署。

运行清理脚本

运行/usr/sbin/ovirt-hosted-engine-cleanup并选择y删除失败的自托管引擎部署遗留的任何内容。

 # /usr/sbin/ovirt-hosted-engine-cleanup
 This will de-configure the host to run ovirt-hosted-engine-setup from scratch.
 Caution, this operation should be used with care.
 Are you sure you want to proceed? [y/n]

清理存储域

定义是在同一共享存储设备上重新安装还是选择其他共享存储设备。
要在同一存储域上部署安装,请通过在NFS,Gluster,PosixFS或本地存储域的服务器上的相应目录中运行以下命令来清理存储域:

  # rm -rf storage_location/*

重新部署自托管引擎。

猜你喜欢

转载自blog.csdn.net/lxypeter521/article/details/86082749