開啟 vmware esxi server virtual switch Promiscuous Mode 的方法 – for sniff network purpose
要研究這麼深?! 沒辦法, 最近遇到奇怪問題非得啟用 Promiscuous Mode 來看看發生啥事了.
設定 step by step 看圖:
這是 免費的 sniff tools: http://www.ethereal.com/
要研究這麼深?! 沒辦法, 最近遇到奇怪問題非得啟用 Promiscuous Mode 來看看發生啥事了.
設定 step by step 看圖:
這是 免費的 sniff tools: http://www.ethereal.com/
升級系統/世界
emerge -uDN system ( world )
升級完世界 把多餘的東西砍掉
emerge --depclean
檢查 library 一致?
revdep-rebuild
用vmware , frame buffer I/O很慢 , 要加 -q
安裝被keywords mark起來的ebuild
把 ebuild 名稱加到 /etc/portage/package.keywords 就可以了
在 /etc/make.conf 加 ACCEPT_KEYWORDS=”~amd64″
裝特定版本的 package
emerge =www-servers/apache-2.x.x
cd / mount -t proc proc /mnt/gentoo/proc mount -o bind /dev /mnt/gentoo/dev cp -L /etc/resolv.conf /mnt/gentoo/etc/ chroot /mnt/gentoo /bin/bash env-update && source /etc/profile
* Messages for package sys-devel/libtool-2.2.6b: * Old versions of installed libraries were detected on your system. * In order to avoid breaking packages that depend on these old libs, * the libraries are not being removed. You need to run revdep-rebuild * in order to remove these old dependencies. If you do not have this * helper program, simply emerge the 'gentoolkit' package. * * # revdep-rebuild --library libltdl.so.3 * * Once you've finished running revdep-rebuild, it should be safe to * delete the old libraries. Here is a copy & paste for the lazy: * # rm '/usr/lib64/libltdl.so.3'
下了 revdep-rebuild –library libltdl.so.3 會
* Configuring search environment for revdep-rebuild * Checking reverse dependencies * Packages containing binaries and libraries using libltdl.so.3 * will be emerged. * Collecting system binaries and libraries * Generated new 1_files.rr * Checking dynamic linking [ 55% ] * found /usr/lib64/apache2/modules/libphp5.so [ 80% ] * found /usr/lib64/php5/bin/php [ 100% ] * Generated new 3_broken.rr * Assigning files to packages * /usr/lib64/apache2/modules/libphp5.so -> dev-lang/php * /usr/lib64/php5/bin/php -> dev-lang/php * Generated new 4_raw.rr and 4_owners.rr * Cleaning list of packages to rebuild * Generated new 4_pkgs.rr * Assigning packages to ebuilds * Generated new 4_ebuilds.rr * Evaluating package order * Generated new 5_order.rr * All prepared. Starting rebuild emerge --oneshot dev-lang/php:5 ..........
tcpdump -nn -i eth1 -c 10000 port 9000 | awk '{print $5}' | cut -d. -f1-4 | sort | uniq -c | sort -n
tcpdump -nn -e -i eth1 port 9000
arping -I eth1 172.25.1.131
開機進入 single user mode 了, 那 / 都 mount 成了 read-only 怎改 /etc/fstab 呢?
下
mount -o remount,rw /
另外可以參考這篇講 Redhat 的 rescue mode steps : http://bbs.518z.net/read-htm-tid-242.html
這個版本 support multiple instance
* With this version of Memcached Gentoo now supports multiple instances. * To enable this you should create a symlink in /etc/init.d/ for each instance * to /etc/init.d/memcached and create the matching conf files in /etc/conf.d/ * Please see Gentoo bug #122246 for more info

MEMCACHED_BINARY="/usr/bin/memcached"
MEMUSAGE="64"
MEMCACHED_RUNAS="memcached"
MAXCONN="1024"
LISTENON="172.30.0.43"
PORT="11212" <---- 改!
UDPPORT="${PORT}"
PIDBASE="/var/run/memcached/memcached"
MISC_OPTS=""
啟動後:
9312 ? Ssl 0:00 /usr/bin/memcached -d -p 11211 -U 11211 -l 172.30.0.43 -m 64 -c 1024 -u memcached -P /var/run/memcached/memcached-.memcached1.pid 9366 ? Ssl 0:00 /usr/bin/memcached -d -p 11212 -U 11212 -l 172.30.0.43 -m 64 -c 1024 -u memcached -P /var/run/memcached/memcached-.memcached2.pid 9420 ? Ssl 0:00 /usr/bin/memcached -d -p 11213 -U 11213 -l 172.30.0.43 -m 64 -c 1024 -u memcached -P /var/run/memcached/memcached-.memcached3.pid 9474 ? Ssl 0:00 /usr/bin/memcached -d -p 11214 -U 11214 -l 172.30.0.43 -m 64 -c 1024 -u memcached -P /var/run/memcached/memcached-.memcached4.pid
下 , netstat -t -u -an 可以看到 ….
它的 memcache client API for php 有新舊兩個版, 之前只參考到 PHP 官網的 manual 寫的 function 用了它的舊 API call , 造成 connection 不會自動斷線, 需要改用新的才行.
另外, memcache 改用 UDP protocol 比較省 CPU cost , 不過 memcached 的 CPU cost 本來就很低, 所以省的部份是在 memcache client 端, 也就是前台 web server 的 CPU cost 可以省一些.
這個就是 "隱藏版" 的 manual , 竟然要到 cvs 去才看得到 ORZ
http://cvs.php.net/viewvc.cgi/pecl/memcache/README?revision=1.3.2.1&view=markup
initial revision
memcached module for PHP
————————This module requires zlib library, used for on-the-fly data (de)compression.
Also, you’ll need memcached to use it =)
The memcached website is here:
http://www.danga.com/memcached/You will probably need libevent to install memcached:
You can download it here: http://www.monkey.org/~provos/libevent/New API in 3.0
————————Version 3 introduces a new class "MemcachePool" which implements the new API, the
old class "Memcache" is still retained (but is deprecated) with the same interfacefor backwards compatibility. Please note that you need a new memcached version to
use the CAS, default value to increment/decrement, append and prepend, and binary
protocol features.
New INI directives are available to allow control over protocol, redundancy and hash
strategy selection. These are# The binary protocol results in less traffic and is more efficient
# for the client and server to generate/parsememcache.protocol = {ascii, binary} # default ascii
# When enabled the client sends requests to N servers in parallel, resulting in
# a somewhat crude reduncancy or mirroring, suitable when used as a session# storage.
#
# If data integrity is of greater importance a real replicating memcached
# backend such as "repcached" (http://sourceforge.net/projects/repcached/) is
# recommended
memcache.redundancy = <int> # default 1
memcache.session_redundancy = <int> # default 2# Hash strategy and function selection. The consistent hashing strategy
# is now the default as it allows servers to be added and removed from# the pool without resulting in all or most keys being re-mapped to
# other server (ie. voiding the cache)
memcache.hash_strategy = {standard, consistent} # default consistent
memcache.hash_function = {crc32, fnv} # default crc32The directives are used by the MemcachePool constructor so you can instantiate
several pools with different settings by using ini_set() creativly. For exampleini_set(‘memcache.protocol’, ‘binary’);
$binarypool = new MemcachePool();
$binarypool->addServer(…)ini_set(‘memcache.protocol’, ‘ascii’);
ini_set(‘memcache.redundancy’, ‘2′);$redundantpool = new MemcachePool();
$redundantpool->addServer(…)ini_set(‘memcache.redundancy’, ‘1′);
The new interface looks like
class MemcachePool() {
bool connect(string host, int tcp_port = 11211, int udp_port = 0, bool persistent = true, int weight = 1, int timeout = 1, int retry_interval = 15)bool addServer(string host, int tcp_port = 11211, int udp_port = 0, bool persistent = true, int weight = 1, int timeout = 1, int retry_interval = 15, bool status = true)
bool setServerParams(string host, int tcp_port = 11211, int timeout = 1, int retry_interval = 15, bool status = true)
/**
* Supports fetching flags and CAS values*/
mixed get(mixed key, mixed &flags = null, mixed &cas = null)
/**
* Supports multi-set, for example* $memcache->set(array(‘key1′ => ‘val1′, ‘key2′ => ‘val1′), null, 0, 60)
*/
bool add(mixed key, mixed var = null, int flag = 0, int exptime = 0)
bool set(mixed key, mixed var = null, int flag = 0, int exptime = 0)
bool replace(mixed key, mixed var = null, int flag = 0, int exptime = 0)
/**
* Compare-and-Swap, uses the CAS param from MemcachePool::get()*/
bool cas(mixed key, mixed var = null, int flag = 0, int exptime = 0, int cas = 0)
/**
* Prepends/appends a value to an existing one*/
bool append(mixed key, mixed var = null, int flag = 0, int exptime = 0)
bool prepend(mixed key, mixed var = null, int flag = 0, int exptime = 0)
/**
* Supports multi-key operations, for example* $memcache->delete(array(‘key1′, ‘key2′))
*/
bool delete(mixed key, int exptime = 0)
/**
* Supports multi-key operations, for example
* $memcache->increment(array(‘key1′, ‘key2′), 1, 0, 0)
*
* The new defval (default value) and exptime (expiration time) are used
* if the key doesn’t already exist. They must be supplied (even if 0) for
* this to be enabled.
*/
mixed increment(mixed key, int value = 1, int defval = 0, int exptime = 0)
mixed decrement(mixed key, int value = 1, int defval = 0, int exptime = 0)
/**
* Assigns a pool-specific failure callback which will be called when
* a request fails. May be null in order to disable callbacks. The callback
* receive arguments like
*
* function mycallback($host, $tcp_port, $udp_port, $error, $errnum)
*
* Where $host and $error are strings or null, the other params are integers.
*/
bool setFailureCallback(function callback)
}
在這邊看到 兩個 memcache php client 的比較表 : http://code.google.com/p/memcached/wiki/PHPClientComparison
There are primarily two clients used with PHP. One is the older, more widespread pecl/memcache and the other is the newer, less used, more feature rich pecl/memcached.
Both support the basics such as multiple servers, setting vaules, getting values, increment, decrement and getting stats.
Here are some more advanced features and information.
| pecl/memcache | pecl/memcached | |
|---|---|---|
| First Release Date | 2004-06-08 | 2009-01-29 (beta) |
| Actively Developed? | Yes | Yes |
| External Dependency | None | libmemcached |
| Features | ||
| Automatic Key Fixup1 | Yes | No |
| Append/Prepend | No | Yes |
| Automatic Serialzation2 | Yes | Yes |
| Binary Protocol | No | Optional |
| CAS | No | Yes |
| Compression | Yes | Yes |
| Communication Timeout | Connect Only | Various Options |
| Consistent Hashing | Yes | Yes |
| Delayed Get | No | Yes |
| Multi-Get | Yes | Yes |
| Session Support | Yes | Yes |
| Set/Get to a specific server | No | Yes |
| Stores Numerics | Converted to Strings | Yes |
www.monster.com.tw , © Copyright 2008