linode 真是让人火大,没有任何通知的情况下,扣除了我信用卡 40 usd ,但是事出有因
因为我超过每个月200G流量了,前几天一直收到 linode 的报警邮件,说我的 VPS 流量比较大 超过了了 平均 5M/s, 但是没有提示超流量的后果. 看看我的 blog 能正常访问 ,也就没管它,后来被扣了 40 美元,真让人火大,FUCK LINODE!,越来越讨厌linode了,随便举几个例子:
1,时常会停电
2,ip偶尔被和谐
3,后台 经常session error 和 硬盘使用量 始终显示100%
4,,价格 偏贵
5,超流量 扣费非常严重
6,….
为什么流量这么大,这个可能是大家关心的
我用iftop实时监控流量,发现 下行流量最高达到 20M/s 确实吓人,下图:
linode 后台也可以看出:
由于个人运维经验有限,没发现什么,只发现了 连到我 80 端口nginx 上的ip数很多,下图:
我把nginx 重启了 ,重启后 还是很多 ,流量依然很大,后来我没办法就 关机了 ,隔了一天后 重启了 机器 ,系统正常了 。。。目前还是不知道 解决办法!
最后看下我这两天被扣的钱,你就知道 超过流量 有多么 惨了

让全球人 都来 fuck linode吧!摸下面网址:
今天 push project 到 heroku ,可是怎么都出现下面这个错误:
Permission denied (publickey). fatal: The remote end hung up unexpectedly
不解,push 到github 就没有问题, 网上搜了下 说是 publickey 问题 , 可是看了 heroku 上 和本地的 就是一样的 。。
wxianfeng@ubuntu:/usr/local/system/projects/git/fucklinode$ heroku keys === 1 key for wang.fl1429@gmail.com ssh-dss AAAAB3NzaC...ZALatGdA== wang.fl1429@gmail.com
本地的
~/.ssh/id_rsa.pub 也是这个key
如果发现不一样的 可以 添加一个新的 key
>heroku keys:add ~/.ssh/id_rsa.pub
更多关于keys的命令可以
>heroku help
继续研究,后来发现 heroku 找的 不是 id_rsa.pub ,而是 id_dsa.pub ,通过 ssh -v git@heroku.com 查出
>ssh -v git@heroku.com ... debug1: Trying private key: /home/wxianfeng/.ssh/id_dsa ...
好 , 那我就给你生成 dsa 加密的
>cd ~/.ssh
>rm -rf *
>ssh-keygen -C "wang.fl1429@gmail.com" -t dsa # rsa 加密的 -t rsa 即可上传 key
>heroku keys:add ~/.ssh/id_dsa.pub
再
>git push heroku master
就ok了
按照官方的教程 就应该是 id_rsa.pub , 之前也一直好好的,可是 今天 找的怎么是 id_dsa.pub 呢 , 如果你同样遇到这个问题,看看是不是 也是这里的问题 ….
SEE:
http://stackoverflow.com/questions/3481973/heroku-error-permission-denied-public-key
http://devcenter.heroku.com/articles/quickstart
http://help.github.com/troubleshooting-ssh/
想把个人的一个项目放到 github上的 ,但是发现不能设置为 private的 , private 是付费用户 。。。
于是把代码 托管到了 https://bitbucket.org ,bitbucket.org 使用的是 hg 版本控制 ,也叫 mercurial , 和 git 很相似 , 也是分布式版本控制系统 关键是 可以设置为 private 的 ,并且free用户 还可以有5个人的协同开发
使用:
0 , 上传 publickey
1,config 配置用户
>vim ~/.hgrc
[ui]
username = wxianfeng <wang.fl1429@gmail.com>
verbose = True2,init 初始化项目
>cd project >hg init
3,add files 添加文件
>hg add .
4,commit file to config commit 文件 ,这时只是放到了 config中 ,并没有到服务器上,和 svn 不一样
>hg commit -m "import project"5,push 上传
>hg push https://bitbucket.org/user/projectSEE:
http://www.oschina.net/p/mercurial
http://www.infoq.com/cn/news/2010/10/atlassian-bitbucket
环境:centos5.5 + ubuntu 10.10
最近我的VPS的流量超级大,平均达到了 5m/s , 不知道怎么回事 ,怎么流量这么大 ,最后找到了一个不错的工具 iftop 监控流量
和 top 命令相似,很实用,很方便
1,安装
ubuntu:
>sudo apt-get install iftop
centos:
yum install flex byacc libpcap ncurses ncurses-devel wget ftp://fr2.rpmfind.net/linux/dag/redhat/el5/en/i386/dag/RPMS/iftop-0.17-1.el5.rf.i386.rpm rpm -ivh iftop-0.17-1.el5.rf.i386.rpm
2,使用
>iftop
3,查看帮助
iftop 后 ? 查看
4,截图

更详细的摸下面网址:
http://www.vpser.net/manage/iftop.html
目前 rails的稳定版本是 rails3.0.5,但是rails3.1的新特性已经出来了 , 来看看 。。。
1,Scopes
rails 3.0 我们使用scope,常这样使用:
class Product < ActiveRecord::Base scope :nokia, lambda { where(:name => 'Nokia') } scope :category, lambda { |value| where(:category => value) } scope :combined, lambda { |value| nokia.category(value) } end
$ @nokia = Product.nokia.all # to get all the products with name Nokia $ Product.category("Mobile").all # to get all the products with category Mobile $ Product.nokia.category("Mobile").all #Combined : to get all the products with name = Nokia and category = Mobile
发现scope 只能使用在一个Class中,那么有多个Class 怎么办,rails 3.1 你可以创建一个类 作为 通用的 filter
class Filter < Struct.new(:klass) def call(*args); end end module NameFilter def call(*args) klass.where(:name => args.shift) super(*args) end end module CategoryFilter def call(category, *args) klass.where(:category => args.shift) super(*args) end end class Product < ActiveRecord::Base scope :combined, Filter.new(self).extend(CategoryFilter).extend(NameFilter) end class User < ActiveRecord::Base scope :combined, Filter.new(self).extend(CategoryFilter).extend(NameFilter) end Product.combined('Nokia','Mobile').all User.combined('John','Manager').all
2,Automatic Flushing
Automatic Flushing 是改善性能的一项技术,例如 之前rails渲染页面的机理是这样的,第一步 rails 生成 静态页面 ,例如css,图片,js文件 ,页面html ,然后在一个一个的下载
添加了 Automatic Flushing 这个技术后 ,将会 大大提高性能 , 服务器端一边 生成静态文件 ,浏览器一边就下载了 ,改善了用户体验 和性能
3,css sprites(图片拼合)
rails 3.1 默认支持 icons sprite , 多个icon放在一张图片上 ,显示icon通过css来控制,这样有利于减少http请求数
4,js,css文件可以放到views 下面
#Preprocess: app/views/js/item.js.erb app/views/css/style.css.erb #This code will be compiled to the files like this: #Compiles: public/application.js public/style.css
5,一些旧的用法将不被支持,例如 :conditions
旧的写法:
class User scope :name, :conditions => { :name => 'David' } scope :age, lambda {|age| {:conditions => ["age > ?", age] }} end
新的写法:
class User scope :name, where(:name => 'David') scope :age, lambda {|age| where("age > ?", age) } end
SEE:
http://hemju.com/2011/02/23/rails-3-1-release-rumors-and-news-about-features/


