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
180
1
Share
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
130
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
160
DevFest2014-Zhuhai-Polymer
zoomquiet
0
480
Other Decks in Technology
See All in Technology
イベントで大活躍する電子ペーパー名札 〜その3〜 / ビジュアルプログラミングIoTLT vol.23
you
PRO
0
170
oracle-to-databricks-migration-with-llm-and-dbt
casek
1
380
Kiro CLI v2.0.0がやってきた!
kentapapa
0
220
GitHub Copilot CLIでWebアクセシビリティを改善した話
tomokusaba
0
140
もりもり新機能を一挙紹介! AgentCoreに入門して、AWS上にAIエージェントを構築しよう
minorun365
PRO
5
330
Datadog 認定試験の概要と対策
uechishingo
0
200
電子辞書Brainをネットに繋げてみた(自力編)
raspython3
0
370
個人の発見を、組織の知恵に 〜生成AI活用を"探索"から"組織の仕組み"へ〜
kintotechdev
2
180
海外カンファレンス「JavaOne」参加レポート ユーザー系IT企業における目的・成果/JavaOne Report Purpose and Results in the User IT Company
muit
0
120
自称宇宙最速で不合格となったAIP-C01にリベンジを果たすべくAIで問題集アプリを作ってみた。
yama3133
0
250
Diagnosing performance problems without the guesswork
elenatanasoiu
0
130
Claude Codeですべての日常業務を爆速化しよう!
minorun365
PRO
16
16k
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
135
9.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
210
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
160
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
Paper Plane (Part 1)
katiecoart
PRO
0
8.1k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Done Done
chrislema
186
16k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Scaling GitHub
holman
464
140k
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/