Author: jpuyy

  • 管理多个ssh主机

    现在ubuntu desktop是主力,用过SecureCRT及PAC Manager后,才发现熟悉命令操作后,最单的termial结合ssh config才是最安全好用的。

    在配置文件:

    /home/jpuyy/.ssh/config

    写入以下内容,并设置权限设置为600

    Host 别名
    HostName 主机名
    Port 端口
    User 用户名
    IdentityFile 密钥文件的路径

    如果使用密码登陆需手动输入密码

    例子:

    将本地的/ptwatch放到vps用户目录下(打包->传输->解压)

    tar -vczf - /ptwatch/ | ssh jpuyy@blog 'cd ~; tar vxzf -'

    另外一种方式可以在~/.bashrc使用alias方式定义一个连接某主机的命令

    如:

    alias sshblog='ssh [email protected]'

    设置好之后用source ~/.bashrc使其生效。

    下面是9个非常棒的ssh技巧,个个精妙:

    http://tychoish.com/rhizome/9-awesome-ssh-tricks/

    补充 @2015-1-12

    对于 ssh 客户端不希望启用 key 检测,也不进行提示,在 ~/.ssh/config 中添加如下几行

    UserKnownHostsFile /dev/null
    StrictHostKeyChecking no
    LogLevel ERROR
    

     

    测试 ssh 连通性

    ssh -q aliyun-prod9-ecs-0 exit;
    
  • nginx 504 Gateway Time-out

    在单纯php-fpm+ nginx的情况下,出现这个问题

    说明fastcgi设置超时时间太短

    在fastcgi_params中加入如下语句,问题解决

    fastcgi_buffers 8 128k;
    fastcgi_buffer_size 128k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_connect_timeout 300;
    fastcgi_send_timeout 300;
    fastcgi_read_timeout 300;
  • 使用cpuburn-in与memtester对linux服务器进行压测

    如何将linux下的cpu与内存跑满从而测试其稳定性,用电量等。这里使用cpuburn-in与memtester。

    cpuburn-in(http://cpuburnin.com/)的使用方法

    首先要查看cpu的核心数,然后运行对应数量的多个实例,后面只要跟需要测试的分钟数即可,一天为1440分钟,自己在测试过程中CentOS6.4 x86_64需要安装好glibc.i686包。

    nohup ./cpuburn-in 1440 &

    每个cpu的使用百分比可以通过htop查看

    memtester(http://pyropus.ca/software/memtester/)的使用方法

    下载解压,编译 make之后得到memtester,后面跟参数为测试的内存大小,可以trial and error的方法得到最大的可测内存,比如32GB的总内存,可以填31000测试

    nohup ./memtester 31000 &

    同样可以使用htop查看内存的使用率

    2014-11-26

    unixbench

    直接运行

    nohup ./Run

  • xenserver备份与恢复虚拟机

    由于装好的xenserver空余的磁盘很小,所以这里挂载移动硬盘并将文件存放到移动硬盘中。这里使用的是xenserver的Command Line Interface. xenserver版本为6.1.0 .

    插上usb移动硬盘之后,最好是分区为ext3系统

    mkfs -t ext3 /dev/sdc5

    并挂载到/mnt/usb目录下

    mount /dev/sdc5 /mnt/usb

    切换到/mnt/usb

    cd /mnt/usb

    备份操作为:

    xe vm-export vm=<Name of VM> filename=<Name of file ending in “.xva”>

    将来如果需要恢复时,只需

    xe vm-import filename=abc.xva
  • 更换手机号需要做的

    招商银行(信用卡,专业版)

    淘宝
    支付宝
    QQ (财付通)
    京东
    新蛋
    亚马逊
    谷歌
    dropbox

    12306.cn

    美团
    拉手
    满座
    糯米

    凡客
    监控宝

    公司(oa,邮件签名)

    朋友

  • 美国企业家宣言

    转自:http://baike.baidu.com/view/4756221.htm

    我是不会选择做一个普通人的。
    如果我能够做到的话,我有权成为一位不寻常的人。
    我寻找机会,但我不寻求安稳,
    我不希望在国家的照顾下成为一名有保障的国民,那将被人瞧不起而使我感到痛苦不堪。

    我要做有意义的冒险。
    我要梦想,我要创造,我要失败,我也要成功。

    我拒绝用刺激来换取施舍;
    我宁愿向生活挑战,而不愿过有保证的生活;
    宁愿要达到目的时的激动,而不愿要乌托邦式毫无生气的平静。

    我不会拿我的自由与慈善作交易,也不会拿我的尊严去与发给乞丐的食物作交易。
    我决不会在任何一位大师面前发抖,也不会为任何恐吓所屈服。

    我的天性是挺胸直立,骄傲而无所畏惧。
    我勇敢地面对这个世界,自豪地说:在上帝的帮助下,我已经做到了。

    英文原版:

    I do not choose to be a common person.
    It is my right to be uncommon—if I can.
    I seek opportunity—not security.
    I do not wish to be a kept citizen,
    humbled and dulled by having the state look after me.
    I want to take the calculated risk,
    to dream and to build,
    to fail and to succeed.
    I refuse to barter incentive for a dole;
    I prefer the challenges of life to the guaranteed existence;
    the thrill of fulfillment to the stale calm of Utopia.
    I will not trade my freedom for beneficence
    nor my dignity for a handout.
    I will never cower before any master
    nor bend to any threat.
    It is my heritage to stand erect, proud, and unafraid;
    to think and act for myself;
    to enjoy the benefit of my creations;
    and to face the world boldly
    and say:
    “This, with God’s help, I have done.”

    —Entrepreneur’s Credo of the American