okbuy 李小红 好乐买自动化运维实践
DESCRIPTION
中国互联网运维高峰论坛TRANSCRIPT
![Page 1: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/1.jpg)
好乐买自动化运维实践李小红
Monday, June 27, 2011
![Page 2: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/2.jpg)
新资源上线流程
安装系统
资源性能监控
安装软件配置系统
发布产品代码
准备数据
修改运行配置
Monday, June 27, 2011
![Page 3: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/3.jpg)
好乐买公司简介
• 成立于2007年
• 国内最大的B2C正品鞋网上商城
• www.okbuy.com
Monday, June 27, 2011
![Page 4: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/4.jpg)
装系统很容易
Monday, June 27, 2011
![Page 5: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/5.jpg)
多来点怎么样?
Monday, June 27, 2011
![Page 6: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/6.jpg)
结果五花八门
Monday, June 27, 2011
![Page 7: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/7.jpg)
自动安装
• 基于python的开源软件
• 快速(<10分钟)设置安装服务器
• 支持Linux,不支持BSD
• Dell,Redhat等公司在用它
Monday, June 27, 2011
![Page 8: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/8.jpg)
本地自动安装
• 登记MAC地址
• 设置主机名称、IP、安装模板
• 网络启动,自动完成安装
Monday, June 27, 2011
![Page 9: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/9.jpg)
远程自动安装
Monday, June 27, 2011
![Page 10: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/10.jpg)
远程重装或升级系统
• ssh+koan/远程自动安装
• 下载kernel/initrd,修改grub
• reboot重启后开始安装
Monday, June 27, 2011
![Page 11: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/11.jpg)
自动安装虚拟机
• koan/kvm
• cobbler上设置RAM/CPU/DISK
• 支持xen/vmware
Monday, June 27, 2011
![Page 12: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/12.jpg)
还要配好多东西呢• 安装软件
• 起动/停止服务
• 增加用户
• 修改系统配置文件
• 修改应用程序的配置文件
• ... ...
Monday, June 27, 2011
![Page 13: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/13.jpg)
自动化配置管理
Monday, June 27, 2011
![Page 14: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/14.jpg)
puppet配置管理
配置文件配置文件配置文件
puppet maser
puppet
puppet
puppet
puppet
puppetCA客户证书客户证书 puppet
服务器端 客户端
Monday, June 27, 2011
![Page 15: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/15.jpg)
软件自动安装
pp master pp masterpp管理集群
服务器
soft repo
Monday, June 27, 2011
![Page 16: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/16.jpg)
软件自动安装
pp master pp masterpp管理集群
服务器
soft repo
1 为节点增加软件配置
Monday, June 27, 2011
![Page 17: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/17.jpg)
软件自动安装
pp master pp masterpp管理集群
服务器
soft repo
1 为节点增加软件配置
2 获取资源列表
Monday, June 27, 2011
![Page 18: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/18.jpg)
软件自动安装
pp master pp masterpp管理集群
服务器
soft repo
1 为节点增加软件配置
2 获取资源列表
3 返回资源列表
Monday, June 27, 2011
![Page 19: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/19.jpg)
软件自动安装
pp master pp masterpp管理集群
服务器
soft repo
1 为节点增加软件配置
2 获取资源列表
3 返回资源列表
4 下载软件并安装
Monday, June 27, 2011
![Page 20: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/20.jpg)
软件自动升级
pp master pp masterpp管理集群
服务器
soft repo
Monday, June 27, 2011
![Page 21: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/21.jpg)
软件自动升级
pp master pp masterpp管理集群
服务器
soft repo
1 上传软件并更新repo
Monday, June 27, 2011
![Page 22: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/22.jpg)
软件自动升级
pp master pp masterpp管理集群
服务器
soft repo
1 上传软件并更新repo
2 获取资源列表
Monday, June 27, 2011
![Page 23: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/23.jpg)
软件自动升级
pp master pp masterpp管理集群
服务器
soft repo
1 上传软件并更新repo
2 获取资源列表
3 返回资源列表
Monday, June 27, 2011
![Page 24: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/24.jpg)
软件自动升级
pp master pp masterpp管理集群
服务器
soft repo
1 上传软件并更新repo
2 获取资源列表
3 返回资源列表
4 查询最新版本下载并升级
Monday, June 27, 2011
![Page 25: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/25.jpg)
自动删除软件
pp master pp masterpp管理集群
服务器
soft repo
Monday, June 27, 2011
![Page 26: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/26.jpg)
自动删除软件
pp master pp masterpp管理集群
服务器
soft repo
1 修改节点软件配置
Monday, June 27, 2011
![Page 27: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/27.jpg)
自动删除软件
pp master pp masterpp管理集群
服务器
soft repo
1 修改节点软件配置
2 获取资源列表
Monday, June 27, 2011
![Page 28: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/28.jpg)
自动删除软件
pp master pp masterpp管理集群
服务器
soft repo
1 修改节点软件配置
2 获取资源列表
3 返回资源列表
Monday, June 27, 2011
![Page 29: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/29.jpg)
自动删除软件
pp master pp masterpp管理集群
服务器
soft repo
1 修改节点软件配置
2 获取资源列表
3 返回资源列表
4 删除软件
Monday, June 27, 2011
![Page 30: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/30.jpg)
系统帐号自动管理
pp master pp masterpp管理集群
服务器
Monday, June 27, 2011
![Page 31: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/31.jpg)
系统帐号自动管理
pp master pp masterpp管理集群
服务器
1 修改节点用户配置
Monday, June 27, 2011
![Page 32: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/32.jpg)
系统帐号自动管理
pp master pp masterpp管理集群
服务器
1 修改节点用户配置
2 获取资源列表
Monday, June 27, 2011
![Page 33: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/33.jpg)
系统帐号自动管理
pp master pp masterpp管理集群
服务器
1 修改节点用户配置
2 获取资源列表
3 返回资源列表
Monday, June 27, 2011
![Page 34: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/34.jpg)
系统帐号自动管理
pp master pp masterpp管理集群
服务器
1 修改节点用户配置
2 获取资源列表
3 返回资源列表
4 增加或删除用户
Monday, June 27, 2011
![Page 35: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/35.jpg)
自动推送文件到多个节点
pp master pp masterpp管理集群
服务器
Monday, June 27, 2011
![Page 36: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/36.jpg)
自动推送文件到多个节点
pp master pp masterpp管理集群
服务器
1 修改文件推送配置
Monday, June 27, 2011
![Page 37: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/37.jpg)
自动推送文件到多个节点
pp master pp masterpp管理集群
服务器
1 修改文件推送配置
2 上传文件到pp master指定的目录
Monday, June 27, 2011
![Page 38: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/38.jpg)
自动推送文件到多个节点
pp master pp masterpp管理集群
服务器
1 修改文件推送配置
2 获取资源列表
2 上传文件到pp master指定的目录
Monday, June 27, 2011
![Page 39: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/39.jpg)
自动推送文件到多个节点
pp master pp masterpp管理集群
服务器
1 修改文件推送配置
2 获取资源列表
3 返回资源列表
2 上传文件到pp master指定的目录
Monday, June 27, 2011
![Page 40: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/40.jpg)
自动推送文件到多个节点
pp master pp masterpp管理集群
服务器
1 修改文件推送配置
2 获取资源列表
3 返回资源列表
2 上传文件到pp master指定的目录
4 比对并拉取文件
Monday, June 27, 2011
![Page 41: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/41.jpg)
全面的配置管理
pp master pp master
pp管理集群
服务器
cobbler subversion
Monday, June 27, 2011
![Page 42: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/42.jpg)
全面的配置管理
pp master pp master
pp管理集群
服务器
IP/主机名/分区等配置
cobbler subversion
Monday, June 27, 2011
![Page 43: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/43.jpg)
全面的配置管理
pp master pp master
pp管理集群
服务器
IP/主机名/分区等配置
cobbler
软件/用户/配置文件等
subversion
Monday, June 27, 2011
![Page 44: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/44.jpg)
全面的配置管理
pp master pp master
pp管理集群
服务器
IP/主机名/分区等配置
cobbler
软件/用户/配置文件等
subversion
产品代码
Monday, June 27, 2011
![Page 45: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/45.jpg)
全面的配置管理
pp master pp master
pp管理集群
服务器
IP/主机名/分区等配置
cobbler
软件/用户/配置文件等
数据除外10分钟内恢复
subversion
产品代码
Monday, June 27, 2011
![Page 46: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/46.jpg)
全配置管理的优势
• 灾难恢复
• 快速扩容
• 方便系统重构
• 资源自动调度
Monday, June 27, 2011
![Page 47: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/47.jpg)
Puppet集群
puppet master
nginx
mongrel
配置从SVN上发布到各个puppet master节点上
SVN有所有节点的所有配置
mongrel mongrel mongrel
puppet master
nginx
mongrel mongrel mongrel mongrel
subversion
Monday, June 27, 2011
![Page 48: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/48.jpg)
Puppet优势
• cfengine/chef优势对比
• google/twitter/zynga
Monday, June 27, 2011
![Page 49: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/49.jpg)
Capistrano
• ruby gem
• 产品代码发布与回滚
• 集群命令工具
Monday, June 27, 2011
![Page 50: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/50.jpg)
产品代码发布
subversion管理机
服务器服务器服务器服务器
Monday, June 27, 2011
![Page 51: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/51.jpg)
产品代码发布
subversion管理机
服务器服务器服务器服务器
1 从SVN同步最新或指定的版本
Monday, June 27, 2011
![Page 52: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/52.jpg)
产品代码发布
subversion管理机
服务器服务器服务器服务器
1 从SVN同步最新或指定的版本
2 上传并应用到所有相关的服务器
Monday, June 27, 2011
![Page 53: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/53.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
shared system config.inc
code...
config
Monday, June 27, 2011
![Page 54: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/54.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
current
shared system config.inc
code...
config
Monday, June 27, 2011
![Page 55: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/55.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
current
shared system config.inc
code...
config
Monday, June 27, 2011
![Page 56: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/56.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
current
shared system config.inc
code...
config
Monday, June 27, 2011
![Page 57: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/57.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
current
shared system config.inc
code...
config config.inc
Monday, June 27, 2011
![Page 58: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/58.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
current
shared system config.inc
code...
config config.inc
Monday, June 27, 2011
![Page 59: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/59.jpg)
代码发布目录结构
deploy releases
20110619001122
20110618001122
20110617001122
current
shared system config.inc
code...
config config.inc
Monday, June 27, 2011
![Page 60: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/60.jpg)
产品代码回滚
管理机
服务器服务器服务器服务器
Monday, June 27, 2011
![Page 61: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/61.jpg)
产品代码回滚
管理机
服务器服务器服务器服务器
链接到上一版本,删除当前代码目录
Monday, June 27, 2011
![Page 62: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/62.jpg)
ganglia
• 分布式监控
• 高扩展性
• 容易增加监控指标
Monday, June 27, 2011
![Page 63: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/63.jpg)
ganglia监控架构
Monday, June 27, 2011
![Page 64: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/64.jpg)
服务质量监控
Monday, June 27, 2011
![Page 65: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/65.jpg)
nagios
• 跟ganglia集成
• 主要记录可用性数据
• 报警条件少
Monday, June 27, 2011
![Page 66: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/66.jpg)
新资源上线流程
安装系统
资源性能监控
安装软件配置系统
发布产品代码
准备数据
修改运行配置
新资源下线流程
运行配置系统(zookeeper) cmdb
公用资源池
服务集群 服务集群 服务集群 服务集群 服务集群 服务集群
未来
Monday, June 27, 2011
![Page 67: Okbuy 李小红 好乐买自动化运维实践](https://reader034.vdocuments.site/reader034/viewer/2022052205/558cc16fd8b42af9198b45a7/html5/thumbnails/67.jpg)
问题?• weibo:@槛内小红
• blog.sina.com.cn/lixiaohong
• twitter: @lixiaohong
Monday, June 27, 2011