81991935 2008-09-18
项目中需要用到Memcached,前期的测试,都是在Win上做的.而我们的服务器却是Solaris的.为了测试在Solaris上的性能.则需要在服务器上安装Memcached.因为之前没有弄过这个东西,所以安装的过程也遇到了很多的问题.
还好在Solaris下,有一个专门的工具CoolStack,它是一个Apache,PHP,MySql的简易安装包.现在的版本是1.3.1.很庆幸,在这个安装包中,同样也包含Memcached.
从http://cooltools.sunsource.net/coolstack/下载CoolStack的运行环境和Memcached的安装包.
分别是:CSKruntime_1.3.1_i386.pkg.bz2和CSKmemcached_1.3.1_i386.pkg.bz2.
下载后上传到Solaris上.
之后进行解压.
bunzip2CSKruntime_1.3.1_i386.pkg.bz2
bunzip2CSKmemcached_1.3.1_i386.pkg.bz2
解压后,
使用Root账号登录.
之后使用pkgadd来安装两个包,记住要加-d.
pkgadd-dCSKruntime_1.3.1_i386.pkg
pkgadd-dCSKmemcached_1.3.1_i386.pkg
很容易的就安装成功了.
之后进入到目录:/opt/coolstack/bin中.
你就会看到目录里有一个memcached了.
执行./memcached-h
如果你能看到像下面的内容一样,就证明你安装成功了.memcached 1.2.5 -p <num> TCP port number to listen on (default: 11211) -U <num> UDP port number to listen on (default: 0, off) -s <file> unix socket path to listen on (disables network support) -a <mask> access mask for unix socket, in octal (default 0700) -l <ip_addr> interface to listen on, default is INDRR_ANY -d run as a daemon -r maximize core file limit -u <username> assume identity of <username> (only when run as root) -m <num> max memory to use for items in megabytes, default is 64 MB -M return error on memory exhausted (rather than removing items) -c <num> max simultaneous connections, default is 1024 -k lock down all paged memory. Note that there is a limit on how much memory you may lock. Trying to allocate more than that would fail, so be sure you set the limit correctly for the user you started the daemon with (not for -u <username> user; under sh this is done with 'ulimit -S -l NUM_KB'). -v verbose (print errors/warnings while in event loop) -vv very verbose (also print client commands/reponses) -h print this help and exit -i print memcached and libevent license -b run a managed instanced (mnemonic: buckets) -P <file> save PID in <file>, only used with -d option -f <factor> chunk size growth factor, default 1.25 -n <bytes> minimum space allocated for key+value+flags, default 48 -L Try to use large memory pages (if available). Increasing the memory page size could reduce the number of TLB misses and improve the performance. In order to get large pages from the OS, memcached will allocate the total item-cache in one large chunk. -t <num> number of threads to use, default 4
哈.现在你可以将Memcached启动起来进行测试啦.
./memcached-d-m2048-l10.10.13.240-P11211
关于Memcached的使用.网上有很多教程.
可以参见.
PS:这两天被这个问题给郁闷坏了.
新装的Solaris服务器.
要安装Memcached,首先要安装libevent.
网上提供的都是需要自己编译,安装的.
这就需要在系统中安装gcc和make.
装这两个东西倒没有什么问题.
可是在安装libevent的时候,遇到了好多的问题.
做C的同事也帮着弄了好久,才勉强将它安装上,其间还改了源代码....
可是Memcached却始终提示找不到libevent.
无论你是否指定libevent的路径.都不行.
我在自己的Ubuntu上装了一下,一点问题也没有.
快要放弃的时候,在Sun的网站上看到了可以使用CoolStack来安装Memcached.
才让自己看了希望.
还好,功夫不负有心人.
现在已经开始进行Memcached的测试了.
终于把这个狗屎问题解决了.