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
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
300
ストレスなくAIと付き合いたい!こんなときどうしてる?
namiki64
4
630
ソフトウェア ファクトリー - 再現性のあるソフトウェアの工場づくり / Software factory
iktakahiro
7
5.1k
古い指輪から広がった JAVA コミュニティ とのつながり
yamad
0
130
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
180
Code for Security プロジェクト紹介 2026年10月
yu23ki14
0
110
JAWSUG TOHOKU 青森支部 「LoGoチャット」のAWS移行で 乗り越えたこと
taketakekaho
0
350
CloudWatch Logsのコスト最適化:どこまでAIに任せてどこから人間が承認すべきか
yama3133
0
120
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
5
1.2k
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces
pfn
PRO
0
140
価値について
gree_tech
PRO
0
110
Featured
See All Featured
It's Worth the Effort
3n
188
29k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
710
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
HDC tutorial
michielstock
2
960
エンジニアに許された特別な時間の終わり
watany
109
250k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Fireside Chat
paigeccino
43
4.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
The browser strikes back
jonoalderson
0
1.8k
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/