╭( ▔▽▔)╮变章鱼!
╭( ▔▽▔)╯要开始了~
╰( ≧﹏≦)╯恩……
( ▔◎▔) 喔耶~~厉害吧
╱│││╲
(∥▔◎▔) 喔…
╱│││╲
(∥= ◎ = ) 喔 ,变不回去了…
╱│││╲
╭( ▔▽▔)╮变章鱼!
╭( ▔▽▔)╯要开始了~
╰( ≧﹏≦)╯恩……
( ▔◎▔) 喔耶~~厉害吧
╱│││╲
(∥▔◎▔) 喔…
╱│││╲
(∥= ◎ = ) 喔 ,变不回去了…
╱│││╲
这边有个需求是替换adobe fms 热点文件的时候防止删除正在访问的文件,保证用户请求不中断
但是发现adobe fms open的文件lsof看不到,但是iostat能证实该磁盘是在读取的,很奇怪
尝试用inotify去捕捉事件,可以发现:
[@dg_80_65 inotify-tools-3.14]# inotifywait -m \ --timefmt '%d/%m/%y %H:%M' --format '%T %e %w%f' \ /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
Setting up watches.
Watches established.
01/11/10 18:37 OPEN /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 CLOSE_NOWRITE,CLOSE /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 OPEN /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:37 CLOSE_NOWRITE,CLOSE /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 OPEN /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 CLOSE_NOWRITE,CLOSE /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 OPEN /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 ACCESS /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
01/11/10 18:38 CLOSE_NOWRITE,CLOSE /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
所有文件迅速的打开,读取,关闭,所以lsof捕捉不到
adobe的文档是这么说的:
When a stream is requested from the server, segments of the stream are stored in a cache on the server. As long as the cache has not reached capacity, the server places segments in the cache. Each time a stream attempts to access a segment, the server checks the cache. If the segment is available, the server gives the stream a reference to the segment for playback. If the segment is not available, the server retrieves the segment from its source, inserts it into the cache, and returns a reference to that segment to the stream.
When the cache is full, the server removes unused segments, starting with the least recently used. After removing all unused segments, if there still isn’t enough room for a new segment, the server notifies the client that the stream is not available and makes an entry in the core log file.
大意是说fms是从缓存区取文件的,如果不存在该文件的这一部分,就会从源文件读取,放入缓存区,再给用户
因此,比较可以接受的办法是删除文件之前判断下access time的时间戳
stat -c %X /data/video/ssdcached/stream/20100525/57d4f5a6-fc8d-4f8f-b0f7-c00020f6c7ac.mp4
新西兰彩票创意广告: lucky dog
最后那只狗狗历尽千辛叼着彩票回来…那失望的眼神实在是销魂啊
最近公司的服务器配置做了更改,LVS+双公网策略路由出了问题,所以干脆改成bonding来做
按照卢瑟同学的介绍,bonding有7种模式:
Mode=0(balance-rr) 表示负载分担round-robin,和交换机的聚合强制不协商的方式配合。 Mode=1(active-backup) 表示主备模式,只有一块网卡是active,另外一块是备的standby 这时如果交换机配的是捆绑,将不能正常工作,因为交换机往两块网卡发包,有一半包是丢弃的。 Mode=2(balance-xor) 表示XOR Hash负载分担,和交换机的聚合强制不协商方式配合。(需要xmit_hash_policy) Mode=3(broadcast) 表示所有包从所有interface发出,这个不均衡,只有冗余机制...和交换机的聚合强制不协商方式配合。 Mode=4(802.3ad) 表示支持802.3ad协议,和交换机的聚合LACP方式配合(需要xmit_hash_policy) Mode=5(balance-tlb) 是根据每个slave的负载情况选择slave进行发送,接收时使用当前轮到的slave Mode=6(balance-alb) 在5的tlb基础上增加了rlb。 5和6不需要交换机端的设置,网卡能自动聚合。4需要支持802.3ad。0,2和3理论上需要静态聚合方式 但实测中0可以通过mac地址欺骗的方式在交换机不设置的情况下不太均衡地进行接收。
决定使用最简单的模式6来做
在这个文件加入
alias bond0 bonding
options bond0 miimon=100 mode=5
DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
DEVICE=eth2
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
DEVICE=bond0
IPADDR="Your IP Adress"
NETMASK="Your NetMask"
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
/etc/init.d/network stop;modprobe -r bonding;/etc/init.d/network start
附录:转发方式
layer2 (1): (source MAC XOR destination MAC) modulo slave count layer2+3 (2): (((source IP XOR dest IP) AND 0xffff) XOR ( source MAC XOR destination MAC )) modulo slave count layer3+4 (3): ((source port XOR dest port) XOR ((source IP XOR dest IP) AND 0xffff) modulo slave count 为了能更加均衡,可采用 mac ip 异或 哈希:xmit_hash_policy=2