MemcacheQ安装及使用
来源:互联网 发布:arksz410788k数据手册 编辑:程序博客网 时间:2024/04/30 09:40
一. 安装
MemcacheQ 是一个简单的分布式队列服务,它的运行依赖于BerkeleyDB 和 libevent,所以需要先安装BerkeleyDB和libevent.
Berkeley DB 4.7 or later
Download from <http://www.oracle.com/database/berkeley-db/db/index.html>
How to install BerkeleyDB:
$tar -xvzf db-5.3.21.tar.gz$cd db-5.3.21/$cd build_unix/$../dist/configure$make$make install安装BerkeleyDB时,可以手动指定安装路径:<pre name="code" class="literal-block">../dist/configure --prefix=/usr/local/berkeleydb不指定的话,默认安装在:/usr/local/BerkeleyDB.5.3
libevent 1.4.x or later
先检查libevent 是否已经安装:
#rpm -qa|grep libevent
libevent-devel-2.0.10-2.fc15.x86_64
libevent-2.0.10-2.fc15.x86_64
libevent-2.0.10-2.fc15.i686
或者:
ls -al /usr/lib |grep libevent
如果还没有安装:
Download from <http://monkey.org/~provos/libevent/>
How to install libevent:
$tar -xvzf libevent-1.4.x-stable.tar.gz$cd libevent-1.4.x-stable$./configure$make$make install
安装libevent时,可以手动指定安装路径:<pre name="code" class="literal-block">./configure --prefix=/usr/local/libevent不指定的话,默认安装在:/usr/lib64(64位系统)或者/usr/lib(32位系统)
memcacheQ
下载软件包:http://code.google.com/p/memcacheq/downloads/list
解压缩,cd进目录
./configure --enable-threads
make
make install
configure 时,如果libevent 不是安装在默认目录,需--with--libevent=/usr/local/libevent指定libevent的安装目录
若没有将
/usr/local/lib/usr/local/BerkeleyDB.5.3/lib添加进/etc/ld.so.conf 并运行 /sbin/ldconfig 则需<span style="color:#000000;">--with-bdb=/usr/local/BerkeleyDB.5.3</span> 指定berkeleyDb库的路径
二.使用
启动memcacheQ
- 使用memcacheq -h 的命令来查看命令行选项
- 启动memcacheq:memcacheq -d -u nobody -r -H /tmp/memcacheq -N -R -v -L 1024 -B 1024 > /tmp/mq_error.log 2>&1
命令行使用memcacheQ
telnet 127.0.0.1 22202
只有两个命令可以在命令行下使用memcacheQ
写对列:
set <queue name> <flags> 0 <message_len>\r\n<put your message body here>\r\nSTORED\r\n
取出队列:
get <queue name>\r\nVALUE <queue name> <flags> <message_len>\r\n<your message body will come here>\r\nEND\r\n
与memcache协议基本一致,只是把key name换成queue name,而且在set的命令中,忽略了expire_time的参数。mq的数据存储是存在berkeleyDB中,做了持久化存储,没有内存的过期时间。
示例:
三.安装使用过程中可能出现的错误telnet 127.0.0.1 22202Trying 127.0.0.1…Connected to 127.0.0.1.Escape character is ‘^]’.set q4 0 0 5helloSTOREDset q4 0 0 5worldSTOREDstats queueSTAT q4 2/0ENDget q4VALUE q4 0 5helloENDstats queueSTAT q4 2/1END
1.编译出现错误:checking for library containing db_create... no
configure: error: cannot find libdb.so in /usr/local/BerkeleyDB.5.3/lib
需要修改 configure 中的BerkeleyDB中的预编译参数vim configure找到bdbdir="/usr/local/berkeleydb"改为
bdbdir="/usr/local/BerkeleyDB.5.3"再次编译
2.configure: error: cannot find libdb.so in /usr/local/BerkeleyDB.5.3/lib
出现此错误的原因在于没有安装BerkyleyDb,安装即可
3./usr/local/memcacheq/bin/memcachq -h
运行报:
memcacheq: error while loading shared libraries: libdb-5.3.so: cannot open shared object file: No such file or directory
解决方法:ln -s /usr/local/BerkeleyDB.5.3/lib/libdb-5.3.so /usr/lib/libdb-5.3.so
注:在64位操作系统中,需执行
ln -s /usr/local/BerkeleyDB.5.3/lib/libdb-5.3.so /usr/lib64/libdb-5.3.so
本文参考网址:
http://www.niutian365.com/blog/article.asp?id=463
http://web2.0coder.com/archives/197
http://www.cnblogs.com/sunzy/archive/2012/04/13/2446234.html
官方网站:
http://memcachedb.org/memcacheq/
- MemcacheQ安装及使用
- MemcacheQ安装及使用
- MemcacheQ 安装与使用
- MemcacheQ 安装与使用
- linux(Centos)上memcacheq成功安装及使用
- Memcacheq的安装与使用
- memcacheq 的安装和使用
- Memcacheq的安装与使用
- memcacheq 安装
- memcacheQ安装
- memcacheQ安装
- linux memcacheQ的安装与使用
- php消息队列MemcacheQ 安装与使用
- redhat安装memcacheQ
- memcacheQ安装命令
- linux 安装memcacheQ
- linux下安装memcacheq
- MemcacheQ 安装和测试
- [shell]join两个文件
- 另一篇关于 Serializable 和 Parcelable 对比的文章
- JAVA 中Arrays类简单介绍
- perl快速学习记录
- 网桥
- MemcacheQ安装及使用
- CsQuery 犀利的html代码分析库,像jq一样用c#处理html
- android引入第三方jar包后打包报错
- Linux Shell之sed命令
- 杭电 hdu 2063 (最基础的 二分匹配)
- C++学习心得(5)继承与派生
- 2012年5月SAT香港真题解析
- Android开发模板------ViewPager(二)FragmentPagerAdapter的简介
- 在多个页面中地方需要登录,创建一个新的navgationController