項(xiàng)目中需要用到Memcached,前期的測(cè)試,都是在Win上做的.而我們的服務(wù)器卻是Solaris的.為了測(cè)試在Solaris上的性能.則需要在服務(wù)器上安裝Memcached.因?yàn)橹皼](méi)有弄過(guò)這個(gè)東西,所以安裝的過(guò)程也遇到了很多的問(wèn)題.
還好在Solaris下,有一個(gè)專(zhuān)門(mén)的工具
Cool Stack,它是一個(gè)Apache,PHP,MySql的簡(jiǎn)易安裝包.現(xiàn)在的版本是1.3.1.很慶幸,在這個(gè)安裝包中,同樣也包含Memcached.
從
http://cooltools.sunsource.net/coolstack/下載Cool Stack的運(yùn)行環(huán)境和Memcached的安裝包.
分別是:CSKruntime_1.3.1_i386.pkg.bz2和CSKmemcached_1.3.1_i386.pkg.bz2.
下載后上傳到Solaris上.
之后進(jìn)行解壓.
bunzip2 CSKruntime_1.3.1_i386.pkg.bz2
bunzip2 CSKmemcached_1.3.1_i386.pkg.bz2
解壓后,
使用Root賬號(hào)登錄.
之后使用pkgadd來(lái)安裝兩個(gè)包,記住要加-d.
pkgadd -d CSKruntime_1.3.1_i386.pkg
pkgadd -d CSKmemcached_1.3.1_i386.pkg
很容易的就安裝成功了.
之后進(jìn)入到目錄:/opt/coolstack/bin中.
你就會(huì)看到目錄里有一個(gè)memcached了.
執(zhí)行./memcached -h
如果你能看到像下面的內(nèi)容一樣,就證明你安裝成功了.
1
memcached 1.2.5
2
-p <num> TCP port number to listen on (default: 11211)
3
-U <num> UDP port number to listen on (default: 0, off)
4
-s <file> unix socket path to listen on (disables network support)
5
-a <mask> access mask for unix socket, in octal (default 0700)
6
-l <ip_addr> interface to listen on, default is INDRR_ANY
7
-d run as a daemon
8
-r maximize core file limit
9
-u <username> assume identity of <username> (only when run as root)
10
-m <num> max memory to use for items in megabytes, default is 64 MB
11
-M return error on memory exhausted (rather than removing items)
12
-c <num> max simultaneous connections, default is 1024
13
-k lock down all paged memory. Note that there is a
14
limit on how much memory you may lock. Trying to
15
allocate more than that would fail, so be sure you
16
set the limit correctly for the user you started
17
the daemon with (not for -u <username> user;
18
under sh this is done with 'ulimit -S -l NUM_KB').
19
-v verbose (print errors/warnings while in event loop)
20
-vv very verbose (also print client commands/reponses)
21
-h print this help and exit
22
-i print memcached and libevent license
23
-b run a managed instanced (mnemonic: buckets)
24
-P <file> save PID in <file>, only used with -d option
25
-f <factor> chunk size growth factor, default 1.25
26
-n <bytes> minimum space allocated for key+value+flags, default 48
27
-L Try to use large memory pages (if available). Increasing
28
the memory page size could reduce the number of TLB misses
29
and improve the performance. In order to get large pages
30
from the OS, memcached will allocate the total item-cache
31
in one large chunk.
32
-t <num> number of threads to use, default 4
哈.現(xiàn)在你可以將Memcached啟動(dòng)起來(lái)進(jìn)行測(cè)試?yán)?
./memcached -d -m 2048 -l 10.10.13.240 -P 11211
關(guān)于Memcached的使用.網(wǎng)上有很多教程.
可以參見(jiàn).
PS:這兩天被這個(gè)問(wèn)題給郁悶壞了.
新裝的Solaris服務(wù)器.
要安裝Memcached,首先要安裝libevent.
網(wǎng)上提供的都是需要自己編譯,安裝的.
這就需要在系統(tǒng)中安裝gcc和make.
裝這兩個(gè)東西倒沒(méi)有什么問(wèn)題.
可是在安裝libevent的時(shí)候,遇到了好多的問(wèn)題.
做C的同事也幫著弄了好久,才勉強(qiáng)將它安裝上,其間還改了源代碼....
可是Memcached卻始終提示找不到libevent.
無(wú)論你是否指定libevent的路徑.都不行.
我在自己的Ubuntu上裝了一下,一點(diǎn)問(wèn)題也沒(méi)有.
快要放棄的時(shí)候,在Sun的網(wǎng)站上看到了可以使用Cool Stack來(lái)安裝Memcached.
才讓自己看了希望.
還好,功夫不負(fù)有心人.
現(xiàn)在已經(jīng)開(kāi)始進(jìn)行Memcached的測(cè)試了.
終于把這個(gè)狗屎?jiǎn)栴}解決了.