虚拟化MH搭建
虚拟化概念:
虚拟机安装分为2块:RHEVM 、RHEVH
RHEVM:负责管理角色
RHEVH:负责运算角色
2016-09-23_0-52-54.png
hypervisor:
提供运算的机器,对应VMware ESXI的角色
2016-09-23_0-53-19.png
2016-09-23_0-51-35.png
虚拟化概念:单独能在单一的计算机上,能虚拟出多台虚拟机,且每台虚拟机能运行独立的操作系统,相互之间都是隔离的。
系统虚拟化:单独能在单一的计算机上,能虚拟出多台虚拟机,且每台虚拟机能运行独立的操作系统,相互之间都是隔离的。
系统虚拟化分为:重量级虚拟化、轻量级虚拟化
重量级虚拟化:在底层都是消耗硬件及CPU、内存
轻量级虚拟化:应用程序虚拟化(docker)
hypervisor:负责提供运算的机器,在实际生产环境中,这台机器是独立的,且应该拥有很多台机器,提供统一运算。
RHEV-M也可以是RHEV-H中的一台机器,同时能管理其他的H(host)。
guest:运行在hypervisor中的虚拟机角色叫guest,真机叫host。
virtualization type:
1.全虚拟化:
在物理机上直接部署虚拟化,且不需要修改内核的方式,叫完全虚拟化。
kernel-based virtual machine (KVM)
OS > rhel5.4 bit cpu full virtualzation
2.半虚拟化(paravirtualized)
需要修改操作系统内核,使其支持虚拟化,所以windows无法支持半虚拟化
3.本地虚拟化
通过软件厂商拦截内核发送的19条敏感指令集进行对操作系统的执行,达到 实现虚拟化效果的做法叫本地虚拟化。
CPU架构图:
2016-09-23_0-53-41.png
MMU:内存管理单元,CPU中分层一个单元,负责把虚拟内存映射到物理内存。
inter中叫EPT
AMD中叫RVI
VT-d直接虚拟化:很多时候我们的真实机8196的网卡被虚拟成e1000的网卡,如果有VT-d,那么虚拟化可以直接让虚拟机调用真实
SR-IOV:多个虚拟化设备可以同时调用一个真实的硬件设备
KVM:Qumranet(now part of Redhat),是从Ovirt开发形成的。
Thick vs thin virtualization host:Thick,没有被定制过的虚拟化;thin,被定制过的虚拟化
nx:防止缓冲区溢出的指令集
ksm:相同内存页整合,当通过模板创建的虚拟机,调用同样的内存。(/sys/kernel/mm/ksm/pages_shared)
VirtIO:在全虚拟化中添加半虚拟化驱动。
虚拟化M安装
M的安装对硬件的需求:
最低配置:双核CPU、4G内存、25G硬盘、一根千兆网卡
标配配置:多个CPU、16G内存、50G 硬盘、一根千兆网卡
在搭建M环境内[[email protected] ~]为真实机,[[email protected] ~]为M机
[[email protected] ~]# wget http://classroom.example.com/materials/rhevm.repo -P /etc/yum.repos.d/ 在真机下下载一个yum配置文件放在本地
--2016-09-23 06:56:18-- http://classroom.example.com/materials/rhevm.repo
Resolving classroom.example.com... 172.25.254.254
Connecting to classroom.example.com|172.25.254.254|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 846
Saving to: “/etc/yum.repos.d/rhevm.repo”
100%[======================================>] 846 --.-K/s in 0s
2016-09-23 06:56:18 (105 MB/s) - “/etc/yum.repos.d/rhevm.repo” saved [846/846]
[[email protected] ~]# yum repolist 查看您拥有的仓库
[[email protected] ~]# yum -y update 升级所有包同时也升级软件和系统内核
[[email protected] ~]# yum -y install rhevm rhevm-dwh rhevm-reports 安装并配置RHEV-M,并长生报表页面使用。
[[email protected] ~]# engine-setup --generate answer=/root/answers.txt 配置RHEV-M的文件
[ INFO ] Stage: Initializing
[ INFO ] Stage: Environment setup
--== PRODUCT OPTIONS --
Configure Engine on this host (Yes, No) [Yes]: //回车
Configure Data Warehouse on this host (Yes, No) [Yes]: //回车
Configure Reports on this host (Yes, No) [Yes]://回车
Configure WebSocket Proxy on this host (Yes, No) [Yes]: //回车
Do you want Setup to configure the firewall? (Yes, No) [Yes]: no 不考虑防火墙
Host fully qualified DNS name of this server [rhevm.pod0.example.com]: //回车
-- DATABASE CONFIGURATION --
Where is the Reports database located? (Local, Remote) [Local]:
Setup can configure the local postgresql server automatically for the Reports to run. This may conflict with existing applications.
Would you like Setup to automatically configure postgresql and create Reports database, or prefer to perform that manually? (Automatic, Manual) [Automatic]:
Where is the DWH database located? (Local, Remote) [Local]:
Setup can configure the local postgresql server automatically for the DWH to run. This may conflict with existing applications.
Would you like Setup to automatically configure postgresql and create DWH database, or prefer to perform that manually? (Automatic, Manual) [Automatic]:
Where is the Engine database located? (Local, Remote) [Local]:
Setup can configure the local postgresql server automatically for the engine to run. This may conflict with existing applications.
Would you like Setup to automatically configure postgresql and create Engine database, or prefer to perform that manually? (Automatic, Manual) [Automatic]:
-- OVIRT ENGINE CONFIGURATION ==--
Engine admin password: 这里使用admin用户的密码为redhat
Confirm engine admin password: 重复上面密码
[WARNING] Password is weak: it is based on a dictionary word
Use weak password? (Yes, No) [No]: yes 提示密码为弱口令
Application mode (Virt, Gluster, Both) [Both]:
--== SYSTEM CONFIGURATION ==--
Configure an NFS share on this server to be used as an ISO Domain? (Yes, No) [Yes]: ISO域配置,这里使用rhevm本机作为ISO域
Local ISO domain path [/var/lib/exports/iso]: /exports/rhevisos
Local ISO domain ACL - note that the default will restrict access to rhevm.pod0.example.com only, for security reasons [rhevm.pod0.example.com(rw)]:
Local ISO domain name [ISO_DOMAIN]: iso0
--== MISS CONFIGURATION ==--
Reports power users password: 报表的密码
Confirm engine admin password: 重复上面密码
[WARNING] Password is weak: it is based on a dictionary word
Use weak password? (Yes, No) [No]: yes 提示密码为弱口令
Would you like transactions from the Red Hat Access Plugin sent from the RHEV Manager to be brokered through a proxy server?(Yes,No) [No]:
Please confirm installation settings(OK,Cancel) [OK]:
当上面的配置完成后,会跳出配置确认信息,确认完成后,会进行安装。
在安装完成后就可以Tab出一下2条命令
[[email protected] ~]# engine-
engine-backup engine-image-uploader engine-manage-domains
engine-cleanup engine-iso-uploader engine-setup
engine-config engine-log-collector engine-upgrade-check
[[email protected] ~]# rhevm-
rhevm-cleanup rhevm-iso-uploader rhevm-setup
rhevm-config rhevm-log-collector rhevm-shell
[[email protected] ~]# engine-setup --config-append=/root/answers.txt 调用answer进行配置做自动化(answer文件在制作engine-appliance时已经放到appliance中),采用离线模式rpm包已安装
登陆admin管理员用户和日记查看
****在图形化配置后不需要重新启动
****在命令行每做一条命令都需要/etc/init.d/ovirt-engine restart重启
查看admin的信息
[[email protected] ~]# engine-config -a | grep -i(不区分大小写) admin
LocalAdminPassword: Set version: general
VmGracefulShutdownMessage: System Administrator has initiated shutdown of this Virtual Machine. Virtual Machine is shutting down. version: general
AdminPassword: Set version: general
[[email protected] ~]# engine-config -g AdminPassword
AdminPassword: Set version: general
上面2条都可以查看admin信息
修改admin用户的密码
[[email protected] ~]# engine-config -s(修改密码) AdminPassword=interactive(本地)
[[email protected] ~]# /etc/init.d/ovirt-engine restart 重启服务
Stopping oVirt Engine: [ OK ]
Starting oVirt Engine: [ OK ]
同步时间服务
[[email protected] ~]# service ntpd stop
Shutting down ntpd: [ OK ]
[[email protected] ~]# ntpdate classroom.example.com
22 Sep 19:54:13 ntpdate[2699]: adjust time server 172.25.254.254 offset 0.000242 sec
[[email protected] ~]# /etc/init.d/ovirt-engine restart
Stopping oVirt Engine: [ OK ]
Starting oVirt Engine: [ OK ]
[[email protected] ~]# service ntpd restart
Shutting down ntpd: [FAILED]
Starting ntpd: [ OK ]
[[email protected] ~]# hwclock --systohc 将时间跟bios时间同步及更新内核
日记查询
[[email protected] ~]# cd /var/log/ovirt-engine 目录下属于虚拟化的所有日记记录
[[email protected] ovirt-engine]# ls
boot.log engine.log ovirt-image-uploader redhat-support-plugin-rhev.log
console.log host-deploy ovirt-iso-uploader server.log
dump notifier ovirt-log-collector setup
[[email protected] ovirt-engine]# engine-log-collector collect 虚拟化工具
This command will collect system configuration and diagnostic
information from this system.
The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before
being passed to any third party.
No changes will be made to system configuration.
Please provide the REST API password for the [email protected] oVirt Engine user (CTRL+D to skip): 管理员密码
INFO: Gathering oVirt Engine information...
INFO: Gathering PostgreSQL the oVirt Engine database and log files from localhost...
INFO: No hypervisors were selected, therefore no hypervisor data will be collected.
Creating compressed archive...
INFO: Log files have been collected and placed in /tmp/sosreport-LogCollector-20160922200120.tar.xz.
The MD5 for this file is 3018b47832488ca60eb611d037f0dd08 and its size is 6.8M
当收集完后就会在/tmp/下生成一个sosrepot-LogCollector-当时时间编号.tar.xz 文件发送给官方帮助解决,前提你需要购买红帽的服务
用户管理与添加
[[email protected] ~]#engine-manage-domains add --domain=example.com(添加到域) --user=rhevadmin (用户加入到域) --provider=IPA(指定文件) 添加一个域并将rhevadmin加入其中IPA是官方给的指定文件
Enter password: 输入密码
The domain example.com has been added to the engine as an authentication source but no users from that domain have been granted permissions within the oVirt Manager.
Users from this domain can be granted permissions by editing the domain using action edit and specifying --add-permissions or from the Web administration interface logging in as [email protected] user.
oVirt Engine restart is required in order for the changes to take place (service ovirt-engine restart).
Manage Domains completed successfully 添加成功
You have mail in /var/spool/mail/root
[[email protected] ~]# /etc/init.d/ovirt-engine restart
Stopping oVirt Engine: [ OK ]
Starting oVirt Engine: [ OK ]
1.png
1、刚创建的rhevadmin用户
2、rhevadmin密码
3、刚才是以example.com这个域内创建的用户应该选择域模式
**当用户第一次登陆时后会提示权限不够,之后我们需要先用admin管理员登陆将这个用户加入其中并给与权限就可以登陆了。
2.png
1、admin管理员用户登陆
2、选择interactive本地登陆
先要用admin管理员用户管理登陆在右上角有个设置下系统权限内添加以域搜索勾上RHEV用户分配SuperUser权限确定
3.png
1、已经添加了rhevadmin用户
2、给用户分配SuperUse
在用rhevadmin用户登陆就可以登陆成功
4.png
1、成功登陆rhevadmin用户