ARP攻击对策(for Linux)

Posted by 曹宇伟 on 九月 29th, 2008

不了解ARP的同学,看下面来自http://www.oxid.it/的演示:

全屏显示

简单点儿说:之所以有ARP攻击是因为ARP协议本身设计的缺陷。网络设备在动态更新系统的ARP表时,会被恶意欺骗。ARP协议是在2层设备(数据链路层:交换机)之间传递的协议,ARP包可以在整个“冲突域”中传递。而一般而言,一个冲突域就是一个子网。VLAN就是设计用来隔离“冲突域”的,所以VLAN可以隔离ARP攻击。简单点说,就是不要和攻击者在一个子网。可惜不是所有的IDC都提供单独的子网(VLAN)给用户,因为划分子网会浪费IP地址。

解决ARP攻击,有几种方法:

第一:使用独立的VLAN(子网)。VLAN(子网)实际上划分了一个ARP安全域,在这个VLAN里的机器之间逻辑上是互相信任的,VLAN将其他不信任、不安全的设备隔离在ARP协议发挥作用的区域之外,这样便可以不用担心“邻居”中毒而受到连累。这是最保险的做法。但是,假如自家VLAN(网段)里有机器中毒进行攻击,则网络仍然会乱作一团。

第二:网关与服务器双双使用静态ARP记录。之前写过一篇《防止ARP中间人攻击的一个技巧》提到过。简单的点儿说就是在网关(路由器)上设定服务器网卡的MAC,在服务器上设定网关的MAC为静态。这样,路由器和服务器就不会再更新对应的ARP记录,就不会被欺骗。这个方法可以隔离每一台设备,而不用划VLAN(划子网浪费IP),比较适合单设备托管的用户。然而,绝大多数ISP都不会为用户做MAC绑定。而对于设备比多的用户,网关绑定MAC后,每次设备换IP都需要ISP重新设定MAC绑定,比较麻烦;而使用了某些用到ARP机制的应用,在绑定的环境下,则可能会运行不起来,比如HA集群中的failover切换。

第三,被动侦测,以毒攻毒。之前写过一篇关于send_arp的blog,其中无意间提到过这个方法。就是使用send_arp程序,纠正错误的ARP记录。之所以说是以毒攻毒,是因为send_arp程序本身就是一个利用ARP协议缺陷的程序。

另外,需要说明的是。有些ISP以端口保护为技术手段,认为可以阻止ARP攻击,实际上,这种技术是不能完全阻止ARP攻击的。

端口保护(有的称为PVLAN,不知道是不是相同的技术)之后,交换机上的端口下连接的设备只能和网关通信,不可以和“邻居”通信。这样可以起到一定的保护作用。但是,你的“邻居”,仍然是可以访问你的网关的(你们是同一个网关)。它只要欺骗网关,告诉网关你的MAC地址为一个错误的地址,或者干脆改成自己的MAC,那么,你的服务器就会断网,因为网关发给你的服务器的包,发到了错误的MAC地址上。

解决办法,就以毒攻毒。使用send_arp,强制让网关更新关于你的ARP(MAC)记录:send_arp  你的IP地址   你绑定该IP网络接口的MAC   你网关的IP   你网关的MAC

这个命令十分有用。管理员可能都会有这么一种经历,将一个IP地址调整到另一台服务器上的时候,会有一段时间这个IP是不通的。这个时候,这个工具又可以发挥作用了:使用相同的命令格式。

需要说明的是,send_arp命令是不需要必须在本地运行的,在网一网段(VLAN)内的任意主机上执行即可。

解决问题的基本思想是在同网段的机器上,执行两个send_arp,一个是发给网关的,一个是发给被攻击的主机的。

实际上,可以写一个角本,放在本地,使用crontab每两分钟运行一次,假如被ARP攻击,则自行通知网关更新相应的ARP记录。

首先将网关MAC绑定成静态:将下面的命令添加到/etc/rc.local

arp -s  网关IP  网关MAC

cat /opt/cron/moniter_gw.sh
#!/bin/bash
# gw_ip=网关地址
# gw_hw=网关MAC
gw_ip=192.168.0.1
local_ip=192.168.0.45
local_hw= 00:14:78:07:23:00

if ping -c1 -w5 ${gw_ip} ; do
:
else
/usr/local/bin/send_arp   ${local_ip} ${local_hw}   ${gw_ip}   ${gw_hw}
done

crontab :
*/2  *  *  *  *     /bin/bash  /opt/cron/moniter_gw.sh

send_arp.c下载

禁止对数据分区的locate数据库更新

Posted by 曹宇伟 on 九月 28th, 2008

我们的/srv/分区相当的大,图片服务器的就更大了。

所以是不能允许对这个分区的文件进行(locate)索引的,即使系统使用的renice +19的方式运行,也是仍然是对系统资源的浪费。一来浪费CPU资源,二来浪费硬盘I/O,三,会使updatedb的数据库巨大,规划不当的话会使/var分区满掉(或者/分区满掉,假如var不是单独分区的话)。

使用cfengine更新了所有系统的配置文件,排除了对/srv分区的索引。

#/etc/updatedb.conf
PRUNEFS = “auto afs iso9660 sfs udf”
PRUNEPATHS = “/afs /media /net /sfs /tmp /udev /var/spool/cups /var/spool/squid /var/tmp /srv /mnt”

好书推荐:《高性能网站建设指南》

Posted by 曹宇伟 on 九月 27th, 2008

书封面前两天买了两本书,其中一本《高性能网站建设指南》,看了一眼之后,便一发不可收拾,一直看到深夜三点,一口气看完。

对于系统管理员和前端开发、设计工程师来说,书中的技术非常实用。

作者在这本书中分享了14项需要丰富的实践经验才可以积累和获得的技巧,看得我激动不已。

第二天,发现公司技术部有N本这样的书,早上 博文视点 的人刚送过来的,说是和他们搞了个什么合作。世上就真有这么巧的事儿。

随便在公司的邮件列表里推荐了一下,结果已经有两个人拥有这本书,N个人好过,反应相当强烈,一致好评,于是维护给做系统管理和开发、设计的朋友们看看。

书封面写着“前端工程师技能精髓”,不过系统管理员看看也是相当有好处的,至少有三项,是跟后端服务器配置相关的。

笔记备忘一下书中技巧:

规则1:减少http请求

规则2:使用内容分发网络(CDN)

规则3:添加Expries头

规则4:压缩输出

规则5:将样式表放在顶站

规则6:将脚本放在底部

规则7:避免CSS表达式

规则8:使用外部JavaScript和CSS

规则9:减少DNS查询

规则10:简单JavaScript

规则11:避免重定向

规则12:移除重复脚本

规则13:配置Etag

规则14:使用Ajax可缓存

从网上,看到对此技巧的补充,将14条法规,扩展到22条,虽然吹毛求疵,但也算是精益求精(有人说系统管理人员和程序员都是完美主义者,对事情总是精益求精是有道理的),也整理如下:

规则15:Flush the header

规则16:Split static content Across Multiple Hostname

规则17:Reduce the size of cookies

规则18:Host static content on a Different Top-level Domain

规则19:Minify css

规则20:Use GET for XHR

规则21:Avoid Iframe

规则22:Optimize Images

PR变成3了

Posted by 曹宇伟 on 九月 27th, 2008

刚刚发现bsdmap.com的PR变成3了,直接由1变成3,欣喜一下,纪念一下。

wput技巧

Posted by 曹宇伟 on 九月 27th, 2008

今天要将自己的备份,从一个ftp导到另一个ftp里去。还好可以登录其中一台服务器。

本来想使用lftp的mirror功能,无耐只能登录“local”,不能登录remote,而lftp的mput貌似依然不支持put目录。(谁知道有什么参数可以用来put目录?)

还好有wput可以使用。

然而在wput( wput /home/myname ftp://ftpusername:password@ip/myname )的时候,发现文件名、目录名中包含的空格和汉字,总是报错。

于是有了下面的方法:

$find /home/myname -type f >> ~/list.txt
$while read i ; do wput “$i”  ftp://ftpusername:password@ip/myname ; done < ~/list.txt

这样就支持了空格,不再报错。shell内部的处理,还真是复杂。

神州七号

Posted by 曹宇伟 on 九月 27th, 2008

神州七号第一季

神州七号第二季

神州七号第三季

Firefox 3.0.2 无法保存密码

Posted by 曹宇伟 on 九月 26th, 2008

Firefox升级到3.0.2之后,发现原来保存的密码都不能用了,而且也不能重新保存……

木溪 帮忙,试了很多种方法,网上找了很久,终于找到问题:原来是3.0.2将存密码的文件编码由ANSI转换成了UTF-8,造成了编码错误。

解决办法,就是找到密码保存文件signons3.txt(在 系统盘:\Documents and Settings\xxxx\Application Data\Mozilla\Firefox\Profiles\xxxxx.default目录下),用常用的编辑器打开,另存为UTF-8编码覆盖原来的文件即可。

已经验证过,可行。

几个性能工具备忘

Posted by 曹宇伟 on 九月 17th, 2008

top:

* A: PID        = Process Id
* E: USER       = User Name
* H: PR         = Priority
* I: NI         = Nice value
* O: VIRT       = Virtual Image (kb)
* Q: RES        = Resident size (kb)
* T: SHR        = Shared Mem size (kb)
* W: S          = Process Status
* K: %CPU       = CPU usage
* N: %MEM       = Memory usage (RES)
* M: TIME+      = CPU Time, hundredths
b: PPID       = Parent Process Pid
c: RUSER      = Real user name
d: UID        = User Id
f: GROUP      = Group Name
g: TTY        = Controlling Tty
j: P          = Last used cpu (SMP)
p: SWAP       = Swapped size (kb)
l: TIME       = CPU Time
r: CODE       = Code size (kb)
s: DATA       = Data+Stack size (kb)
u: nFLT       = Page Fault count
v: nDRT       = Dirty Pages count
y: WCHAN      = Sleeping in Function
z: Flags      = Task Flags <sched.h>
* X: COMMAND    = Command name/line

Flags field:
0×00000001  PF_ALIGNWARN
0×00000002  PF_STARTING
0×00000004  PF_EXITING
0×00000040  PF_FORKNOEXEC
0×00000100  PF_SUPERPRIV
0×00000200  PF_DUMPCORE
0×00000400  PF_SIGNALED
0×00000800  PF_MEMALLOC
0×00002000  PF_FREE_PAGES (2.5)
0×00008000  debug flag (2.5)
0×00024000  special threads (2.5)
0x001D0000  special states (2.5)
0×00100000  PF_USEDFPU (thru 2.4)

进程的优先级和nice级别
进程优先级是一个决定进程被CPU执行优先顺序的参数,内核会根据需要调整这个值。Nice值是一个对优先权的限制。进程优先级的值不能低于nice值。(nice值越低优先级越高)
进程优先级是无法去手动改变的,只有通过改变nice值去间接的调整进程优先级。如果一个进程运行的太慢了,你可以通过指定一个较低的nice值去为它分配更多的CPU资源。当然,这意味着其他的一些进程将被分配更少的CPU资源,运行更慢一些。Linux支持nice值的范围是19(低优先级)到-20(高优先级),默认的值是0。如果需要改变一个进程的nice值为负数(高优先级),必须使用su命令登陆到root用户。下面是一些调整nice值的命令示例,
以nice值-5开始程序xyz
#nice –n -5 xyz

改变已经运行的程序的nice值
#renice level pid

将pid为2500的进程的nice值改为10
#renice 10 2500

vmstat:

·process(procs)
r:等待运行时间的进程数量
b:处在不可中断睡眠状态的进程
w:被交换出去但是仍然可以运行的进程,这个值是计算出来的
·memoryswpd:虚拟内存的数量
free:空闲内存的数量
buff:用做缓冲区的内存数量
·swap
si:从硬盘交换来的数量
so:交换到硬盘去的数量
·IO
bi:向一个块设备输出的块数量
bo:从一个块设备接受的块数量
·system
in:每秒发生的中断数量, 包括时钟
cs:每秒发生的context switches的数量
·cpu(整个cpu运行时间的百分比)
us:非内核代码运行的时间(用户时间,包括nice时间)
sy:内核代码运行的时间(系统时间)
id:空闲时间,在Linux 2.5.41之前的内核版本中,这个值包括I/O等待时间;
wa:等待I/O操作的时间,在Linux 2.5.41之前的内核版本中这个值为0

iostat:

%user:user level(应用)的CPU占用率情况
%nice:加入nice优先级的user level的CPU占用率情况
%sys:system level(内核)的CPU占用情况
%idle:空闲的CPU资源情况

Device:块设备名
Tps:设备每秒进行传输的数量(每秒的I/O请求)。多个单独的I/O请求可以被组成一个传输操作,因为一个传输操作可以是不同的容量。
Blk_read/s, Blk_wrtn/s:该设备每秒读写的块的数量。块可能为不同的容量。
Blk_read, Blk_wrtn:自系统启动以来读写的块设备的总量。

块可能为不同的容量。块的大小一般为1024、2048、4048byte。可通过tune2fs或dumpe2fs获得:
# tune2fs -l /dev/hda1|grep ‘Block size’
Block size:               4096
# dumpe2fs -h /dev/hda1|grep ‘Block size’
dumpe2fs 1.35 (28-Feb-2004)
Block size:               4096

我们一直在努力

Posted by 曹宇伟 on 九月 16th, 2008

9月11号,我们的新版后台v5上线了。

说实话,之前,我们技术部的同学们战斗了无数个工作日、非工作日。虽然内测的时候,测出来不少问题,公测的时候,也有不少的bug,但是对于我们来说,已经是个喜人的成果。

先看一下新后台的载图:

blogbus-v5

新后台一上线,网上的评论立刻蜂拥而至,褒贬不一。整体是赞扬多于批评吧!我们依然保持“绿色”、“简洁”的风格,”清新”而又不失丰富。

图片

Posted by 曹宇伟 on 九月 16th, 2008
Nikon D700

Nikon D700

ThinkPad T400

ThinkPad T400

Nikon D80

Nikon D80

UMPC

UMPC

google_phone_by_dogorgod

google_phone_by_dogorgod

Gphone

Gphone

trek

trek

trek

trek

法拉利概念车

法拉利概念车

法拉利概念车

法拉利概念车

现代机器人

现代机器人

现代机器人

现代机器人

现代机器人

现代机器人

现代机器人

现代机器人

关闭lo接口对arp查询的响应

Posted by 曹宇伟 on 九月 15th, 2008

#echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce
#echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
#echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

Piranha for LVS

Posted by 曹宇伟 on 九月 15th, 2008

食人鱼(Piranha)是南美洲食肉的淡水。它们通常15—25厘米(6—10英寸)长,虽然有时发现有长度达到40厘米的。食人鱼具有尖利的牙齿(能够轻易咬断用造的鱼钩或是一个人的手指[1]),非常凶猛,一旦发现猎物,往往群起而攻之。可以10分鐘內將一隻活牛吃剩一排白骨。当地人用它们的牙齿来做工具和武器。亚马逊河圭亚那河巴拉圭河、等河流是食人鱼经常出没的场所。

piranha,水虎鱼,食人鱼

piranha,水虎鱼,食人鱼

piranha,水虎鱼,食人鱼

piranha,水虎鱼,食人鱼

piranha:

Summary     : Cluster administation tools
Description : Various tools to administer and configure the Linux Virtual Server as well as heartbeating and failover components.  The LVS is a dynamically adjusted kernel routing mechanism that provides load balancing primarily for web and ftp servers though other services are supported.

piranha的组件:

/usr/sbin/pulse
heartbeating daemon for monitoring the health of cluster nodes.

/usr/sbin/lvsd
daemon to control the Red Hat clustering services.

/usr/sbin/nanny
tool to monitor status of service in a cluster.

/usr/sbin/fos
failover services daemon to control the Red Hat clustering service.

/usr/sbin/send_arp
tool  to  notify network of a new IP address / MAC address mapping.
这个工具非常有用。之前有一篇《send_arp的一个角本,我曾经简单介绍过。

On LVS router, there are three service which need to be set to activate at boot time.

  • piranha-gui
  • pulse
  • sshd

If you are clustering multi-port services or using firewall marks, you must enable the iptables service.

Clustering of CentOS 5.2

Posted by 曹宇伟 on 九月 14th, 2008

http://www.centos.org/docs/5/html/5.2/Cluster_Administration/

CentOS Linux 5.2 (i386) 中的Clustering组件中包含如下组件:

yum groupinfo Clustering
Group: Clustering
Description: Clustering Support.
Default Packages:
clustermon
conga-devel
ricci
system-config-cluster
ipvsadm
piranha
cluster-snmp
modcluster
ricci-modcluster
cluster-cim
rgmanager
luci

实际安装过程:
Installing:

cluster-cim                          : CentOS Cluster Suite – CIM provider
cluster-snmp                       : CentOS Cluster Suite – SNMP agent
luci                                       : Remote Management System – Management Station
piranha                                 : Cluster administation tools
rgmanager                            : Open Source HA Resource Group Failover for CentOS
ricci                                      : Remote Management System – Managed Station
system-config-cluster         : system-config-cluster is a utility which allows you to manage cluster configuration in a graphical setting.
Installing for dependencies:
cman : cman – The Cluster Manager
gnome-python2-canvas : Python bindings for the GNOME Canvas.
httpd : Apache HTTP Server
ipvsadm : Utility to administer the Linux Virtual Server
lm_sensors : Hardware monitoring tools.
modcluster : CentOS Cluster Suite – remote management
net-snmp : A collection of SNMP protocol tools and libraries.
net-snmp-libs : The NET-SNMP runtime libraries.
openais : The openais Standards-Based Cluster Framework executive and APIs
perl-Net-Telnet : Net-Telnet Perl module
perl-XML-LibXML : XML-LibXML Perl module
perl-XML-LibXML-Common : XML-LibXML-Common Perl module
perl-XML-NamespaceSupport : XML-NamespaceSupport Perl module
perl-XML-SAX : XML-SAX Perl module
php : The PHP HTML-embedded scripting language. (PHP: Hypertext Preprocessor)
php-cli : Command-line interface for PHP
php-common :  Common files for PHP
pygtk2-libglade : A wrapper for the libglade library for use with PyGTK
python-imaging : Python’s own image processing library
tix :A set of extension widgets for Tk
tk :Tk graphical toolkit for the Tcl scripting language
tkinter :A graphical user interface for the Python scripting language.
tog-pegasus :OpenPegasus WBEM Services for Linux

Command Line Administration Tools
In addition to Conga and the system-config-cluster Cluster Administration GUI, command line tools are available for administering the cluster infrastructure and the high-availability service management components. The command line tools are used by the Cluster Administration GUI and init scripts supplied by Red Hat. Table 1.1, “Command Line Tools” summarizes the command line tools.

Command Line Tool Used With Purpose
ccs_tool — Cluster Configuration System Tool Cluster Infrastructure ccs_tool is a program for making online updates to the cluster configuration file. It provides the capability to create and modify cluster infrastructure components (for example, creating a cluster, adding and removing a node). For more information about this tool, refer to the ccs_tool(8) man page.
cman_tool — Cluster Management Tool Cluster Infrastructure cman_tool is a program that manages the CMAN cluster manager. It provides the capability to join a cluster, leave a cluster, kill a node, or change the expected quorum votes of a node in a cluster. For more information about this tool, refer to the cman_tool(8) man page.
fence_tool — Fence Tool Cluster Infrastructure fence_tool is a program used to join or leave the default fence domain. Specifically, it starts the fence daemon (fenced) to join the domain and kills fenced to leave the domain. For more information about this tool, refer to the fence_tool(8) man page.
clustat — Cluster Status Utility High-availability Service Management Components The clustat command displays the status of the cluster. It shows membership information, quorum view, and the state of all configured user services. For more information about this tool, refer to the clustat(8) man page.
clusvcadm — Cluster User Service Administration Utility High-availability Service Management Components The clusvcadm command allows you to enable, disable, relocate, and restart high-availability services in a cluster. For more information about this tool, refer to the clusvcadm(8) man page.

分布式、集群文件系统小结

Posted by 曹宇伟 on 九月 13th, 2008

顺序不分先后:

Lustre
Lustre is a scalable, secure, robust, highly-available cluster file system. It is designed, developed and maintained by Sun Microsystems, Inc.
Designed to meet the demands of the world’s largest high-performance compute clusters, the Lustre file system redefines scalability and provides groundbreaking I/O and metadata throughput. An object-based cluster, Lustre currently supports tens of thousands of nodes, petabytes of data, and billions of files — and development is underway to support one million nodes, trillions of files, and zetta to yotta bytes.
http://www.sun.com/software/products/lustre/
http://wiki.huihoo.com/index.php?title=Lustre

AFS
AFS Reference Page

OpenAFS
What is AFS?
AFS is a distributed filesystem product, pioneered at Carnegie Mellon University and supported and developed as a product by Transarc Corporation (now IBM Pittsburgh Labs). It offers a client-server architecture for file sharing, providing location independence, scalability and transparent migration capabilities for data. OpenAFS is the Transarc source code released as it looked like around AFS3.6 under IBM Public License IPL.

Arla
Arla is a free AFS implementation.
The main goal is to make a fully functional client with all capabilities of AFS as formerly sold by Transarc and today available as OpenAFS. Other stuff, such as servers and management tools are being developed, but currently not considered stable.

Coda
Coda分布式文件系统:http://www.bsdmap.com/diary/coda.php
Coda File System http://www.coda.cs.cmu.edu/
Coda is a forked of version of AFS that support disconnected and weakly connected mode better then AFS.

InterMezzo
InterMezzo is a new distributed file system with a focus on high availability. InterMezzo will be suitable for replication of servers, mobile computing, managing system software on large clusters, and for maintenance of high availability clusters.

xFS
xFS is a Serverless Network File Service.

CFS
Cluster File Systems, Inc. is the leading developer of next generation technology for scalable high-performance file systems. Our Lustre® file system redefines scalability and has been designed from the ground up to meet the demands of the world’s largest high-performance computer clusters.

GlusterFS
GlusterFS is a cluster file-system capable of scaling to several peta-bytes. It aggregates various storage bricks over Infiniband RDMA or TCP/IP interconnect into one large parallel network file system. GlusterFS is based on a stackable user space design without compromising performance.

Scalable File Share
HP StorageWorks Scalable File Share
A high-bandwidth, scalable storage appliance for Linux clusters
http://h20311.www2.hp.com/HPC/cache/276636-0-0-0-121.html

MogileFS
MogileFS is our open source distributed filesystem. Its properties and features include:
-1. Application level
-2. No single point of failure
-3. Autumaic file replication
-4. “Better than RAID”
-5. Flat Namespace
-6. Shared-Nothing
-7. No RAID required
-8. Local filesystem agnostic

Hadoop
The Apache Hadoop project develops open-source software for reliable, scalable, distributed computing, including:
* Hadoop Core, our flagship sub-project, provides a distributed filesystem (HDFS) and support for the MapReduce distributed computing metaphor.
* HBase builds on Hadoop Core to provide a scalable, distributed database.
* ZooKeeper is a highly available and reliable coordination system. Distributed applications use ZooKeeper to store and mediate updates for critical shared state.

PVFS
http://www.pvfs.org/
http://www.parl.clemson.edu/pvfs/
PVFS is designed to provide high performance for parallel applications, where concurrent, large IO and many file accesses are common. PVFS provides dynamic distribution of IO and metadata, avoiding single points of contention, and allowing for scaling to high-end terascale and petascale systems.

GFS

http://en.wikipedia.org/wiki/Global_File_System
http://www.redhat.com/docs/manuals/csgfs/
GFS (Global File System) is a cluster file system. It allows a cluster of computers to simultaneously use a block device that is shared between them (with FC, iSCSI, NBD, etc…). GFS reads and writes to the block device like a local filesystem, but also uses a lock module to allow the computers coordinate their I/O so filesystem consistency is maintained. One of the nifty features of GFS is perfect consistency — changes made to the filesystem on one machine show up immediately on all other machines in the cluster.

See also

External links About GFS

1. HP OpenVMS
————–
The first to work with a CFS is HP OpenVMS. Oracle Parallel Server and RAC always used
the OpenVMS filesystem (RMS) for its database.

2 HP Tru64
————
CFS is a layer on top of Advfs the filesystem of HP Tru64. Oracle uses
the Direct I/O feature available in CFS. Direct I/O enables Oracle to bypass
the buffer cache (no caching at filesystem level). Oracle manages the
concurrent access to the file itself; as it does on raw devices. On CFS,
without Direct I/O enabled on files – file access goes through a CFS server.
A CFS server runs on a cluster member and serves a file domain. A file
domain can be relocated from one cluster member to another cluster member
online. A file domain may contain one or more filesystems.

Direct I/O does not go through the CFS server, but file creation and resizing
is seen as metadata operation by advfs and this has to be done by the CFS
server.  The consequence is to run file creations and resizing on the node
where the CFS server is located. File operations might take longer when the
CFS server is remote.

Oracle recommends not using the tempfile option, as tempfiles might not be
allocated until the tempfile blocks are accessed and so cause
‘remote metadata operations’ for advfs.

3 Veritas
———–
VERITAS Database EditionTM / Advanced Cluster for Oracle9i RAC enables Oracle
to use the CFS.  The VERITAS Cluster File System is an extension of the VERITAS
File System (VxFS).  Veritas CFS allows the same filesystem to be simultaneously
mounted on multiple nodes.  Veritas CFS is designed with a master/slave
architecture.  Any node can initiate a metadata operation (create, delete, or
resize data), the actual operation is carried out by the master node. All other
(non metadata) IO goes directly to the disk.

CFS is used in DBE/AC to manage a filesystem in a large database environment.
When used in DBE/AC for Oracle9i RAC, Oracle accesses data files stored on CFS
filesystems by bypassing the filesystem buffer and filesystem locking for data.

4 Oracle Cluster File System
——————————
Oracle Cluster File System (OCFS) is a shared filesystem designed specifically
for Oracle Real Application Clusters. OCFS eliminates the requirement for Oracle
database files to be linked to logical drives and enables all nodes to share a
single Oracle_Home (current capabilities are detailed in section 2.8) instead
of requiring each node to have its own local copy. OCFS volumes can span one
shared disk or multiple shared disks for redundancy and performance
enhancements.

5. Netapp(R) Filer
——————-
Netapp Filer offers CFS functionality via NFS to the server machines. These
filesystems are mounted using special mount options. For details please see
Netapp documentation.

Netapp certifications can be found at:

http://www.netapp.com/part…

To understand the architecture and Oracle installation please see these
documents:

Note 210889.1: RAC Installation with a NetApp Filer in Red Hat Linux Environment
and
Oracle9i RAC Installation with a NetApp Filer on Fujitsu-Siemens Primepower
(Solaris8 Operating System) at http://www.netapp.com/tech…

6 AIX
——-
IBM’s General Parallel File System (GPFS) allows users shared access to files
that may span multiple disk drives on multiple nodes. GPFS provides access to
all data from all nodes of the cluster.  It can be configured with multiple
copies of metadata allowing continued operation should the paths to a disk or
the disk itself be broken. Metadata is the filesystem data that describes
the user data.  GPFS allows the use of RAID or other hardware redundancy
capabilities to enhance reliability.

In Oracle9i GPFS is only supported with HACMP/ES in a RAC configuration.
When placing datafiles on GPFS no CRM (Concurrent Resource Manager) needs to be
installed. Starting with Oracle10g HACMP is no longer required to use GPFS.

Metalink contains certification information and information about required
patches for having a cluster database on a GPFS.

7 Sun GFS
———–
Global File Service (GFS or Cluster File System) is a filesystem that is
accessible from all nodes in the cluster. GFS is based on global devices and
has a client/server architecure. GFS provides transparent and concurrent file
access.

Note that Sun GFS is not supported for Oracle datafiles, see section 3.10.

8 Sun StorEdge QFS
——————–
QFS software is a file manager that provides a shared filesystem where mutiple
servers can read and write simultanuously to the same file in the same filesystem.

9 Other Linux Cluster Filesystems
———————————–
There are various third party cluster filesystems available on Linux.
Consult the Oracle Certify website for the policy regarding support for third party
cluster file systems on Linux. Also, consult the RAC Technology Compatibility Matrix (RTCM)
for Linux (http://www.oracle.com/tech… … generic_linux.html)
for the latest information on which third party cluster file systems are supported
by RAC release and platform.

10 Which Platforms support what?
———————————-

Platform and                         Storage for                      Storage for
[Cluster Software]                Oracle installation             datafiles

AIX [HACMP]                          LFS (1) or CFS (2)           CFS and/or Raw devices
AIX [CRS]                                  LFS or CFS            CFS and/or Raw devices
HP/UX [MC/Service Guard]             LFS or CFS (3)        CFS (3) and/or Raw Devices
HP/UX PA-Risc [Veritas DBE/AC)       LFS or CFS            CFS and/or Raw Devices
Linux [oracm, CRS]                   LFS                   OCFS (4) and/or Raw
Devices, also NFS (5)
OpenVMS                              CFS                   CFS
Sun Solaris [Fujitsu Siemens         LFS                   Raw Devices/NFS (5)
Primecluster]
Sun Solaris [Sun Cluster]            LFS or CFS        (6,7)             CFS (7) Raw Devices/NFS (5)
Sun Solaris [Veritas DBE/AC]         LFS or CFS                         CFS and/or Raw Devices
Tru64 Unix                           LFS or CFS                         CFS and/or Raw Devices
Windows NT/2000 [oracm, CRS]         LFS or CFS                   OCFS and/or Raw Devices
Windows 2003 (32/64bit) [oracm, CRS] LFS or CFS            OCFS and/or Raw Devices

(1) LFS is the abbreviation for local filesystem and is only accessible directly
by the node that mounted the disk
(2) CFS is the abbreviation for Cluster FileSystem. The implementation
depends on the operating software vendor or cluster software vendor.
(3) MC ServiceGuard 11.17 includes a CFS which is supported with Oracle 10gR2
(4) OCFS: Oracle Cluster FileSystem
(5) NFS is supported with Netapp(R) Filer, see Metalink certification
(6) Sun GFS can only be used for Oracle_Home and archivelogs.
(7) Sun StorEdge QFS

Local Filesystem means that the Oracle Universal Installer replicates the
RAC software installation automatically to every private filesystem of the
selected nodes in the cluster. The Oracle installation products
are cluster aware and will not install the Oracle software to over-write itself.

Oracm is the Oracle Cluster manager, which is available on Linux and Windows
NT/2000. No other cluster manager is needed to setup Real Application Cluster.

Cluster Ready Services (CRS) are new in Oracle10g and provide also clustermanager
functionality.

Oracle will validate cluster filesystems of other vendors when they become
available. Oracle will support the Oracle software when running on a validated
cluster filesystem.

11 Cluster File System names
——————————

PLatform or Cluster Vendor        CFS name

AIX                                                  GPFS
HP/UX MC/ServiceGuard       CFS
Linux [oracm, CRS]                OCFS
OpenVMS                                              RMS
Tru64 Unix                                    CFS
SunCluster                  GFS, QFS
Veritas DBE/AC                                CFS
Windows NT/2000                                OCFS
Windows 2003 (32/64bit)           OCFS

For more information on certified configuration please see the certification
matrix available on Metalink.  Instructions for accessing the certification
matrix can be found in the following note:

Note 184875.1
How To Check The Certification Matrix for Real Application Clusters

12 When to use CFS over raw?
——————————
This option is very dependent on the availability of a CFS on your platform.
A CFS offers:
- Simpler management
- Use of Oracle Managed Files with RAC
- Single Oracle Software installation
- Autoextend enabled on Oracle datafiles
- Uniform accessibility to archive logs in case of physical node failure
- With Oracle_Home on CFS, when you apply Oracle patches CFS guarantees that
the updated Oracle_Home is visible to all nodes in the cluster.

nginxctl

Posted by 曹宇伟 on 九月 10th, 2008

自已仿照写了一个nginx的控制角本,运行在我们的CentOS Linux系统上,使用良好。代码如下:

#!/bin/bash
# Author  : Cao Yuwei
# MSN     :
# QQ       :
# E-Mail   :

# master process
# TERM,INT  shutdown fast
# QUIT         shutdown graceful
# HUP           reload config
# USR1          reopen log file
# USR2          update nginx bin file graceful
# WINCH       shutdown worke prcess graceful

# work process
# TERM,INT   shutdown fast
# QUIT          shutdown graceful
# USR1          reopen log file

PATH=/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
if [[ $NETWORKING == [Nn][Oo] ]]; then exit 0; fi

start() {

echo -n ‘Starting Nginx: ‘
#这里要指定你的nginx的路径: /opt/nginx/sbin/nginx
daemon /opt/nginx/sbin/nginx “$EXTRAOPTIONS”
local RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then touch /var/lock/subsys/nginx ; fi
return $RETVAL
}

stop() {
echo -n ‘Shutting down Nginx: ‘
killproc nginx
local RETVAL=$?
case nptl in
[Ll]inux[Tt]hreads*|lt*)
# Wait until all threads have terminated.
local -i count=20
while [[ count -gt 0 ]] && pidof nginx > /dev/null
do
usleep 200000
let –count
done
;;
esac
echo
if [ $RETVAL -eq 0 ]; then rm -f /var/lock/subsys/nginx; fi
return $RETVAL
}

restart() {
stop
start
}

relog() {
echo -n ‘Relog Nginx: ‘
killproc nginx -USR1
local RETVAL=$?
echo
return $RETVAL
}

reload() {
echo -n ‘Reload Nginx: ‘
killproc nginx -HUP
local RETVAL=$?
echo
return $RETVAL
}

check() {
/opt/nginx/sbin/nginx -t
}

#
#       See how we were called.
#
case “$1″ in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
relog)
relog
;;
check)
check
;;
*)
echo $”Usage: nginxctl {start|stop|restart|reload|relog|check}”
exit 1
esac

exit

SELinux HOWTO 中文PDF

Posted by 曹宇伟 on 九月 8th, 2008

SELinux HOWTO

PAM (Linux)

Posted by 曹宇伟 on 九月 5th, 2008

#%PAM-1.0
#root可以不经过认证直接运行su
auth sufficient pam_rootok.so
#wheel组的账号可以不经过认证运行su
#auth sufficient pam_wheel.so trust use_uid
#wheel组的账号才可以运行su
auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so

搜狗五笔升级了

Posted by 曹宇伟 on 九月 4th, 2008

还是同一个朋友。

今天搜狗五笔升级了。很好,很强大。输入法对我,终于有一家可以一统天下。

下载最新版的搜狗五笔去 http://wubi.sogou.com

LAMP架构中的关键瓶颈在哪里

Posted by 曹宇伟 on 九月 3rd, 2008

以下为引用:

我的想法源起于这样一个事情,有一次一个网站的技术总监问我,为什么他们的网站那么慢,要怎么办。当时,我的MSN里Zend总部的工程师正好在线,我就 问他PHP响应比较慢了,怎么办?他当时直接告诉我,数据库问题!肯定是数据库没有优化设计好。所以,我没有给那个技术总监确切的答案了,因为他们的数据 库设计我们是不能涉及的。所以就给了大概的数据库优化的建议。这样的事情屡次发生,我就开始怀疑,为什么Zend总部的工程师每次都跟我 说是数据库的问题呢,难道我们不能从PHP层面来解决这个问题吗?答案是不能!因为PHP目前的运行速度已经是很快了,通过Zend的性能分析也能看到一 个用户的点击,PHP的运行时间只有10%不到,那PHP在干吗?它在等。等数据库的查询结果。这个方面在目前的PHP产品中有了很大 的提高,那就是Caching和网页静态化两个方案。Caching可能大家会比较陌生,但是网也静态化现在连PHP产品的用户都非常清楚了。速度快、容 易被搜索到等等,好处不言而喻。开玩笑地说,现在网站的主页实现网页静态化只需要硬盘足够大。至于Caching就比较复杂些,也是大多数PHPer感到 头疼的地方。甚至于有些人会用C来实现。因为Caching中的数据有效期验证、查找、提取、更新等等都是比较难处理。当然,也有人会用数据库来处理 Caching问题。

chrome——谷歌浏览器

Posted by 曹宇伟 on 九月 3rd, 2008

Google推出自己的浏览器了,命名为chrome,下载地址为:http://tools.google.com/chrome/

乍一看,UI不错,用起来也挺顺手。但是总觉得缺少特色,放出来早了?

更多关于chrome的信息

看看官方博客的声明:

我们通过漫画形式提前发布了一款开源浏览器Google Chrome,相信大家已经通过博客渠道了解到该消息。周二,我们将在全球100多个国家推出Google Chrome测试版。

为什么要开发Google Chrome呢?因为我们相信它能给用户带来更多价值,同时有利于推动Web创新。

在谷歌,大量的工作都是通过浏览器进行的,搜索、聊天、收发邮件和协同开发等。在空闲时间,我们通过浏览器购物,登录网络银行,读新闻,与好友交流等。每天花费在浏览器上的时间如此之多,我们不得不考虑什么样的浏览器最适合当前的Web发展趋势。如今,网页已经从简单的文本页面发展到富媒体页面,这就需要我们重新设计网络浏览器。我们真正需要的不仅仅是一款浏览器,而是一个现代化的网页及应用平台。这就是我们开发Google Chrome的初衷。

从外观即可看出,Google Chrome的设计简单、高效,是一款真正的Web浏览工具。与谷歌主页一样,Google Chrome的特点是简洁、快速。

Google Chrome支持多标签浏览,每个标签页面都在独立的“沙箱”内运行,在提高安全性的同时,一个标签页面的崩溃也不会导致其他标签页面被关闭。Google Chrome基于更强大的JavaScript V8引擎,这是当前Web浏览器所无法实现的。

当然,这只是一个开始,Google Chrome在很多方面还需要进一步完善。此次,我们即将推出的是Windows下的测试版本,供大家讨论,我们也希望能够得到用户的反馈。目前, Mac和Linux版本尚在开发之中,同样将秉承快速、高效的特点。

Google Chrome是一款开源软件,借鉴了苹果的WebKit、Mozilla的Firefox及其他相关应用。同样,我们也将开放Google Chrome的全部源代码。我们期望与整个开源社区合作,共同推动Web创新。

在当前Web市场,选择和创新越来越多,我们希望Google Chrome能成为一个新选择,推动Web服务更上一层楼。


Copyright © 2007 花开的地方. All rights reserved.