PPTV分布式装机系统

上传人:新** 文档编号:567354053 上传时间:2024-07-20 格式:PPT 页数:45 大小:748KB
返回 下载 相关 举报
PPTV分布式装机系统_第1页
第1页 / 共45页
PPTV分布式装机系统_第2页
第2页 / 共45页
PPTV分布式装机系统_第3页
第3页 / 共45页
PPTV分布式装机系统_第4页
第4页 / 共45页
PPTV分布式装机系统_第5页
第5页 / 共45页
点击查看更多>>
资源描述

《PPTV分布式装机系统》由会员分享,可在线阅读,更多相关《PPTV分布式装机系统(45页珍藏版)》请在金锄头文库上搜索。

1、PPTV分布式装机系统KenZhu10/9 2012AgendaPPTV分布式装机系统介绍实际面临的问题解决方案系统部署系统组件介绍系统实现Cobbler 配置文件同步Cobbler 自动部署应用实例Cobbler Quick-StartCobbler 动态ks fileCobbler Tips二次开发实际面临的问题服务器系统安装处于半手工状态,有些isp机房甚至需要现场通过光盘安装,耗费大量人力和时间非标准化的系统安装,导致业务部署时遇到这样那样的奇怪问题系统安装是瓶颈,由于以上问题导致业务需要快速部署时,无机器可用的现象实际面临的问题众多机房,由于网络互通互联的问题,只在核心机房架设kic

2、kstart server完全无法解决问题;如采用分布式架构,每个机房部署一台kickstart server;如何统一配置,安装模板以及安装源等业务众多,每个业务对应静态安装模板,不便于管理对于某些机房没有可以独立使用机器,在业务机如何复用的问题解决方案Cobbler 开源项目;基于kickstart,方便快速的网络安装操作系统Git 分布式版本控制;静态配置文件的同步Django 框架;动态配置文件的同步Rsyncd;安装源同步编译Cobbler依赖服务apache, python并打包;解决复用的问题使用ControlTie自动部署 系统部署系统部署BGP机房搭建一台Cobbler Ma

3、ster;该服务器管理系统的配置,安装模板以及cobbler部署包;并同时作为该机房的cobbler server提供安装服务所有核心机房部署Cobbler Secondary;作为本机房的安装服务器并提供安装源同步其他机房的Cobbler,由ControlTie自动部署,可以复用业务机器系统组件系统组件Cobbler 主要服务,提供kickstart serverGit Repository 静态配置文件同步源 Git git客户端,用于同步源上的配置文件Django调用cobbler API, 同步动态配置文件Nginx发布Git repository & Django applicati

4、onRsync用于安装源同步Python包含cobbler依赖模块的pythonApache发布cobbler安装源系统实现CobblerCobbler 介绍Cobbler modelsCobbler 动态KS配置文件同步Git 静态配置文件同步Django 动态配置文件同步配置文件同步脚本Cobbler 自动部署Cobbler部署包ControlTie部署Cobbler基于kickstart, linux系统网络快速安装按不同对象组合动态生成kickstart template, 通过ksmeta, snippets实现Koan方便实现重装系统,安装虚拟机统一管理dhcp, tftp, dn

5、s这些网络安装依赖的服务支持大部分主流linux发行版本,RHEL, Debian, Suse, Ubuntu, Fedora etc.Cobbler ModelsCobbler ModelsDistro 定义安装源,kernel, initrdProfile 定义KS file等信息,可以认为该对象是对应一个业务的templateSystem 定义系统信息,比如hostname, ip地址等信息Cobbler 动态KSKS file 使用snippet模块化,便于管理通过cobbler models中不同参数,动态生成标准化的ks fileCheetah实现模板中变量替换,以及逻辑的运算;其

6、中的伪代码通过python编译器解析Git 静态配置文件同步所谓静态配置文件是指每台cobbler server上基本一致的配置文件,比如kickstart files, snippets 等Cobbler Master上建立git repositoryCobbler部署时通过git clone同步kickstarts, snippets, triggers 这些静态配置文件Crontab定期从Master那里git pull回最新的配置Git目前流行的版本控制工具分布式版本控制软件对比集中式,分布式提供离线版本控制为应用提供配置文件的版本控制&分布式同步方式配置文件部署Git clone生成

7、生成kickstart, snippets, triggers这些配置文件,并和些配置文件,并和git repository上的同步上的同步.test -x /var/lib/cobbler & cd /var/lib/cobbler/ | echo -ne cobbler directory doesnt exist! nexit 0rm -rf kickstartsrm -rf snippetsrm -rf triggersgit clone http:/cobbler-git/kickstarts.gitgit clone http:/cobbler-git/snippets.gitgi

8、t clone http:/cobbler-git/triggers.git.同步脚本使用git pull命令从git repository拉取配置更新echo -ne Kickstarts sync cd $CB_DATA_PATH/kickstartsgit pull & echo -ne OKn | echo -ne FAILEDnecho -ne Snippets sync cd $CB_DATA_PATH/snippetsgit pull & echo -ne OKn | echo -ne FAILEDnecho -ne Triggers sync cd $CB_DATA_PATH/

9、triggersgit pull & echo -ne OKn | echo -ne FAILEDnDjango 动态配置文件同步所谓动态配置文件是指由于不同cobbler配置,而产生的配置文件;比如每台cobbler上的profile对象,由所在cobbler server的distro对象决定通过django调用cobbler api使用nginx发布django 应用,可通过http远程调用Crontab定期调用,通过传入参数,获取配置文件列表并同步Profile对象查询接口.from cobbler.api import BootAPI#cobbler api#传入入distro参数,

10、返回参数,返回profile配置文件列表配置文件列表def profile_list(request, distro): cb_api = BootAPI() profiles = cb_api.find_profile(return_list=True, distro=distro) data = for profile in profiles: profile_url = %s/%s.json % (settings.PROFILES_URL, profile.name) data.append(profile_url) return HttpResponse(|.join(data),

11、text/html).同步脚本.DISTROS=$(cobbler distro list) #取得此取得此cobbler的所有的所有distro对象象for distro in $DISTROSdo PROFILES=$(curl http:/profile_list/$distro/ 2/dev/null | tr | )#访问Profile对象象查询接口接口 for profile in $PROFILES do echo -ne Download $profile tt wget -q $profile & echo -ne OKn | echo -ne FAILEDn donedon

12、e.Cobbler 自动部署Cobbler 部署包ControlTie Task Cobbler 部署Cobbler 配置Cobbler 安装源同步Cobbler 部署包自动部署时包含cobbler源码以及依赖模块,服务的包Cobbler源码Apache2.2.21 编译时必须包含wsgi_module模块Python2.7Cheetah, yaml, pykickstart 相应python模块CT - Cobbler 部署步骤设置相应环境变量,系统设置(关闭iptables, selinux, yum设置)通过yum安装所需服务的rpm包下载 cobbler部署包,并在本机进行编译安装同步

13、配置文件部署完成CT Cobbler 部署#install required rpmsyum install createrepo dhcp curl-devel tftp-server yum-utils mkisofs git -y#fetch cobbler packagecd /tmpwget http:/#cobbler installationcd /home/toolscd /home/tools/package; rpm -ihv *.rpmcd /home/tools/cobbler-2.2.0; make; make install;grep tools /etc/ld.s

14、o.conf | sed -i a/home/tools/python/lib/ /etc/ld.so.conf & echo -ne CT Cobbler设置对于cobbler参数进行设置 Cobbler server, next_serverdhcp 参数设置;这些参数通过ControlTie传入CT Cobbler设置.COBBLER_SETTING=/etc/cobbler/settingsDHCP_SETTING=/etc/cobbler/dhcp.template#Cobbler settingssed -i /server:/ cserver: $option.server_ip

15、 $COBBLER_SETTINGsed -i /next_server:/ cnext_server: $option.server_ip $COBBLER_SETTING#DHCP settingssed -i /subnet.*/ csubnet $id netmask $mask $DHCP_SETTINGsed -i /option domain-name-servers/ coption domain-name-servers 8.8.8.8; $DHCP_SETTINGsed -i /option subnet-mask/ coption subnet-mask $mask; $

16、DHCP_SETTINGsed -i /range dynamic-bootp/ crange dynamic-bootp $option.pool_range; $DHCP_SETTINGsed -i /option routers/ coption routers $option.gateway; $DHCP_SETTING.CT 安装源同步选择ISP和所需同步的系统版本CT 安装源同步if $option.isp = C1 then case $option.release in 5.4) echo -ne sync 5.4 from T1 n cobbler import -path=

17、rsync:/RHEL5.4 -name=RHEL_Server_5.4_PPLive -arch=x86_64 ; 5.8) echo -ne sync 5.8 from T1 n cobbler import -path=rsync:/RHEL5.8 -name=RHEL_Server_5.8_PPLive -arch=x86_64 ; esac应用实例Cobbler Quick-Start物理机安装物理机重装虚拟机安装Cobbler 动态ks file实例YUM configuration snippetCobbler tipsMachine without OSAccess idrac

18、 interface with web browser J2EE installedStart remote consoleReboot or startup machine via idracPress “F12” to enter PXE mode when machine bootingChoose 1 profile you want to apply on this machine in cobbler menuStarting unattended installationConfigure network interface on the machine when install

19、ation finishedCobbler MenuMachine with OS1.Use koan to reinstallyum install koan y2.Create a new system on cobbler servercobbler system add -name=JA03469D1201 -profile=cob_5.4_base -ip-address= -gateway= 3.Execute koan on this machine to replace itself koan -server= -system=JA03469D1201 -replace-sel

20、fXen Virtual-machine installationCobbler server: 1.首先在cmdb中通过IP确认宿主机资产编号,然后生成虚拟机资产编号,并在cobbler server生成system信息。以这台机器为例,宿主机为,资产编号JA03469D1201,由于该机器为D1,故该虚拟机资产编号为JA03469D1201-1,cobbler system name和资产编号一致。2.在cobbler server输入如下命令,添加systemcobbler system add -name=JA03469D1201-1 -profile=vs_5.4 -ip-addre

21、ss= -gateway= -3.安装koanYum install koan yXen Virtual-machine installation4.在宿主机上,执行命令安装虚拟机koan -server= -virt -system=JA03469D1201-1 -virt-name=D1 -virt-path=/dev/sdb -virt-bridge=xenbr0 -=nogfxserver: cobbler servervirt-system: system name you appended beforevirt-name: xen virtual server namevirt-p

22、ath: disk device virt-bridge: network bridge动态ks file 实例RHEL5.4 KS file - distro:RHEL5.4 profile:vs_5.4#SNIPPET yum_configuration$SNIPPET(pptv/yum_configuration)RHEL5.8 KS file - distro:RHEL5.8 profile:vs_5.8#SNIPPET yum_configuration$SNIPPET(pptv/yum_configuration)Snippet/yum_confiuration#set distr

23、o=$getVar(distro_name,)定义distro变量,该变量值为该机器所属distro的name#if 5.4 in $distro判断是否distro为5.4,为真则写入相应配置#Start of YUM Configuration#End of YUM Configurationcat /etc/yum.repos.d/PPLive.repo /etc/yum.repos.d/PPLive.repo /etc/yum.repos.d/PPLive.repo EOFRHEL 6.2 YUM sourceEOF#End of 6.2 YUM Configuration#end i

24、f生成ks file访问Cobbler Server的相应URL,可以验证生成的ks fileProfile:/cblr/svc/op/ks/profile/System: :/cblr/svc/op/ks/system/Cobbler tips dhcp设置subnet 10.x.0.0 netmask 255.255.0.0 pool allow members of pxe; allow members of etherboot; allow members of anaconda; option routers ; option domain-name-servers 8.8.8.8;

25、 option subnet-mask 255.255.0.0; range dynamic-bootp ; filename /pxelinux.0; default-lease-time 600; max-lease-time 600; next-server x.x.x.x; Base OS kernel options# kernel options that should be present in every cobbler installation.# kernel options can also be applied at the distro/profile/system#

26、 level.kernel_options: ksdevice: bootif dhcpclass: Anaconda#对应dchp中的tag设置 lang: en_US text: sshd: vnc: vncpassword: cobblervnc noipv6: 二次开发Cobbler APICobbler xmlrpc远程调用PPTV 虚拟机自动安装应用Cobbler API通过Cobbler.api 模块可以操作cobbler里所有对象研究cli.py这个命令接口模块,可以很快了解API的使用Cobbler xmlrpc远程调用默认cobbler xmlrpc服务绑定在localhost:25151通过修改utils.py模块,可以绑定在外部借口,远程进行cobbler对象的操作也可通过方向代理工具,转发至该端口;对外开放该服务PPTV 虚拟机自动安装应用The End

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 研究生课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号