Lvs-Tun 配置Memo
director:192.168.8.220, vip:192.168.8.224 realserver:192.168.8.221 director.sh [bash] #!/bin/sh VIP=192.168.8.224 RIP=192.168.8.221 modprobe ip_vs modprobe ipip /etc/init.d/iptables stop ifconfig eth0:0 down ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up route add -host $VIP dev eth0:0 ipvsadm -A -t $VIP:80 -s rr ipvsadm -a -t $VIP:80 -r $RIP -i ipvsadm [/bash] realserver.sh [bash] #!/bin/sh VIP=192.168.8.224 RIP=192.168.8.221 modprobe ipip /etc/init.d/iptables stop ifconfig tunl0 down ifconfig tunl0 $VIP broadcast $VIP netmask 255.255.255.255 up route add -host $VIP dev tunl0 echo 0 > /proc/sys/net/ipv4/conf/tunl0/rp_filter echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter arptables -A IN -j DROP -d $VIP arptables -A OUT -j DROP -d $VIP /etc/init.d/arptables_jf save [/bash]
Ubuntu 中把Ppk转换成 Openssh Key
先装putty tool [sh] sudo apt-get install putty-tools [/sh] 然后转换 [sh] #private key puttygen /path/to/puttykey.ppk -O private-openssh -o id_rsa #public key puttygen /path/to/puttykey.ppk -O public-openssh -o id_rsa.pub [/sh]
Smokeping 发送告警邮件
smokeping 默认用sendmail发邮件,这样不好。 改了一下源码 这样可以使用 我QQ的smtp server来发告警邮件了 首先需要安装 Authen::SASL 模块(auth 需要用的) 我用CPAN装的,不细说了 修改 smokeping/lib/Smokeping.pm [perl] #头上加 use Authen::SASL; #定位到sendmail函数,改成下面这样 sub sendmail ($$$){ my $from = shift; my $to = shift; $to = $1 if $to =~ /<(.?)>/; my $body = shift; if ($cfg->{General}{mailhost} and my $smtp = Net::SMTP->new([split /\s,\s*/, $cfg->{General}{mailhost}],Timeout=>5) ){ $smtp->auth(split(/\s*,\s*/, $cfg->{General}{mailusr}),split(/\s*,\s*/, $cfg->{General}{mailpwd})); $smtp->mail($from); $smtp->to(split(/\s*,\s*/, $to)); $smtp->data(); $smtp->datasend($body); $smtp->dataend(); $smtp->quit; } elsif ($cfg->{General}{sendmail} or -x “/usr/lib/sendmail”){ open (M, “|-”) || exec (($cfg->{General}{sendmail} || “/usr/lib/sendmail”),“-f”,$from,$to); print M $body; close M; } else { warn “ERROR: not sending mail to $to, as all methodes failed\n”; } } #找到 ‘_vars =>’ ,把 mailusr mailpwd 加进去。不然不能启动哦!General configuration values valid for the whole SmokePing setup. DOC _vars => [ qw(owner imgcache imgurl datadir dyndir pagedir piddir sendmail offset smokemail cgiurl mailhost mailusr mailpwd snpphost contact display_name syslogfacility syslogpriority concurrentprobes changeprocessnames tmail changecgiprogramname linkstyle precreateperms ) ], [/perl] 然后修改配置文件 /etc/config [perl] mailhost = smtp.qq.com mailusr = [email protected] mailpwd = xxxxxxxxx [/perl]
Twitter It!
这两天在研究twitter,赶脚有点晚:)
AIMD
Additive Increase Multiplicative Decrease: 当TCP发送方感受到端到端路径无拥塞时就线性的增加其发送速度,当察觉到路径拥塞时就乘性减小其发送速度。 TCP拥塞控制协议的线性增长阶段被称为避免拥塞。 当TCP发送端收到ACK,并且没有检测到丢包事件时,拥塞窗口加1;当TCP发送端检测到丢包事件后,拥塞窗口除以2。 [cpp] While(Sending_Not_Finish){ if(Not_Loss_Packet){ CongWin++; }else CongWin=[CongWin/2]; //[]的意思是取整 } [/cpp]
解决Thunderbird不自动接收子目录的问题
菜单路径 编辑-》首选项-》高级-》常规-》配置编辑器 搜索 mail.server.default.check_all_folders_for_new 把值改成true