Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PyCon2013China_Bj_李雨来
Search
Zoom.Quiet
December 20, 2013
Technology
240
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
210
PyCon2014China-Zhuhai-meta programming
zoomquiet
1
180
PyCon2014China-Zhuhai-bpm.py
zoomquiet
0
160
PyCon2014China-Zhuhai-luna kv db
zoomquiet
0
160
PyCon2014China-Zhuhai-seed studio
zoomquiet
0
160
PyCon2014China-Zhuhai-Docker Registry Build By Python
zoomquiet
0
170
PyCon2014China-Zhuhai-jeff
zoomquiet
0
160
PyCon2014China-Zhuhai-pythonic front-end
zoomquiet
0
210
DevFest2014-Zhuhai-Polymer
zoomquiet
0
500
Other Decks in Technology
See All in Technology
Gemini Intelligence 入門 ― AppFunctions と Gemini Nano
takuroabe
0
250
パスキーの自動テストはどこまでいけるのか
teamlab
PRO
0
200
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.6k
DGX Spark でどこまでハッキングができるのか?
kash1064
3
1.3k
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
140
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
150
触りたくないデータに、どう触るか AI時代のRBACアクセスガバナンス
ivry_presentationmaterials
0
260
アウトプット初心者、半年間のふりかえり
4o1sobblue
0
430
[JAWS-UG彩の国埼玉#12]そろそろ準備する?re:Invent2026をやさしく解説 / reinvent2026-sainokuni
sh_fk2
1
340
QA4AI 2026-Oct 生成AI時代の品質保証
tokuty
1
860
AI コーディングと人間の認知スループット / CTO Night & Day 2026 Morning Session / AI Coding and Human Cognitive Throughput
prog893
4
1k
Local CI × GitHub Actions
gogutan
2
180
Featured
See All Featured
Un-Boring Meetings
codingconduct
0
460
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.8k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Are puppies a ranking factor?
jonoalderson
2
4.1k
Accessibility Awareness
sabderemane
1
250
Code Reviewing Like a Champion
maltzj
529
40k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
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/