Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
PyCon2013China_Bj_李雨来
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Zoom.Quiet
December 20, 2013
Technology
190
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PyCon2013China_Bj_李雨来
李雨来 如何用python开发运维友好的程序
http://cn.pycon.org/2013/beijing
Zoom.Quiet
December 20, 2013
More Decks by Zoom.Quiet
See All by Zoom.Quiet
PyCon2014China-Zhuhai-high performance
zoomquiet
0
190
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
170
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
150
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
140
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
140
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
160
PyCon2014China-Zhuhai-jeff
zoomquiet
0
140
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
170
DevFest2014-Zhuhai-Polymer
zoomquiet
0
480
Other Decks in Technology
See All in Technology
2026 TECHFRESH 畢業分享會 - AI-Native 重塑軟體工程與虛擬講師
line_developers_tw
PRO
0
1.3k
FPGAの開発コンペでZephyrを使ってみた
iotengineer22
0
120
AIのReact習熟度を測る
uhyo
2
650
10年間のブログ発信を振り返って見えたWebアプリケーションエンジニアとしての軌跡
stefafafan
0
160
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
170
Oracle Cloud Infrastructure:2026年6月度サービス・アップデート
oracle4engineer
PRO
0
110
Flow 不死:AI 時代 DevOps 的不變本質
cheng_wei_chen
2
280
AIネイティブな開発のサプライチェーンリスク対策 〜激動の開発現場でリスクに立ち向かう〜【ZennFes】
cscengineer
PRO
2
140
2026TECHFRESH畢業分享會 - Lightning Talk - 打造精準高效的 MCP 設計模式與測試實務
line_developers_tw
PRO
0
1.3k
2026TECHFRESH畢業分享會 - Lightning Talk - 資料也要 CI/CD? 用 Airbyte 自動化資料同步
line_developers_tw
PRO
0
1.3k
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
2k
【セミナー資料】Claude Code をセキュアに使うための考え方と設定の勘どころ / Claude Code Webinar 20260616
masahirokawahara
2
410
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
180
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
340
How Software Deployment tools have changed in the past 20 years
geshan
0
34k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
3.5k
New Earth Scene 8
popppiees
3
2.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
The Invisible Side of Design
smashingmag
302
52k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
320
First, design no harm
axbom
PRO
2
1.2k
Transcript
如何用 python 开 发运维友好的程序 李雨来
运维干什么 部署 监控 处理故障和问题
什么叫运维友好? 看看运维的表情就好了
什么叫运维友好? 是这样?
什么叫运维友好? 还是 ......
该怎么做?
重复的事情让机器做 让运维知道系统在干什么 给运维留条后悔的路
重复的事情让机器做 自动化部署 针对服务器的自动化部署 Puppet, Chef, SaltStack
针对应用的自动化部署 Capistrano 持续集成工具 Jenkins
重复的事情让机器做 让系统自动处理异常 MySQL 的双主自动切换( Zookeeper + kazoo )
消息传送中多条通路的自动切换( py-servicebus ) 网络异常的自动探测和自我修复
重复的事情让机器做 写一些脚本简化运维部署中的操作(把手册变成脚本) Bash, Python, Ruby etc… 写一些工具来操作多台服务器
下发配置,下发或部署程序,批量执行命令或脚本 定义一套 DSL 发挥运维的创造性
让运维知道系统在干什么 监控 为监控系统提供服务的状态信息( Zabbix Agent Plugin )
系统状态的汇报 提供一个各个服务状态的 Dashboard 当系统出现问题时既能保留现场又能保证系统正常运行
让运维知道系统在干什么
日志很重要 了解系统干了什么 了解系统正在干什么 了解系统出错时在干什么 了解是运维犯的错误还是系统出的 Bug
日志很重要 如果日志很大, Rotate ,丢掉一些旧日志 logging.handlers.TimedRotatingFileHandler 如果不能丢掉旧日志,按照数据的冷热程度存放在不同数 据库中
3个月内的数据放在 MySQL 中, 3个月以前的数据放 在 Cassandra 中( Cassandra + pycassa )
给运维留条后悔的路 人会犯错误 新上线的版本有 Bug 某些功能不正常 误删除了不该删除的数据
给运维留条后悔的路 应用程序部署可回滚 cap production deploy:rollback 当运维进行重要操作时进行二次确认
if(!confirm("Are you sure?")) return; 当操作失败时系统能自动回滚到正常状态
给运维留条后悔的路 能不删除数据就不删除数据 为数据库中的记录加上 is_deleted 字段 删除文件时移动文件到 trash
文件夹 限制有删除权限的人数 自动定期备份数据库 通过网络把备份数据传输到不同服务器或不同数据中心
多听听运维的吐槽
谢谢 迅达云成 架构师 李雨来 https://github.com/blacktear23
关注即送 100 元优惠券, 并有机会赢得可用 1年的 1000 元充值卡! 微信公众号: SpeedyCloud 迅达
云 http://www.speedycloud.cn/