少年阿宾

那些青春的岁月

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
我这里使用的是Centos6.4的环境下面测试的:
ulimit -SHn 65535
安装:libevent-2.0.12-stable.tar.gz

wget http://httpsqs.googlecode.com/files/libevent-2.0.12-stable.tar.gz
tar zxvf libevent-2.0.12-stable.tar.gz
cd libevent-2.0.12-stable/
./configure --prefix=/usr/local/libevent-2.0.12-stable/
make
make install
cd ../

安装:tokyocabinet-1.4.47.tar.gz
wget http://httpsqs.googlecode.com/files/tokyocabinet-1.4.47.tar.gz
tar zxvf tokyocabinet-1.4.47.tar.gz
cd tokyocabinet-1.4.47/
./configure --prefix=/usr/local/tokyocabinet-1.4.47/
#Note: In the 32-bit Linux operating system, compiler Tokyo cabinet, please use the ./configure --enable-off64 instead of ./configure to breakthrough the filesize limit of 2GB.
#./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/
make
make install
cd ../

##执行上面这个tokyocabinet-1.4.47.tar.gz软件包安装的时候,对于32bit的机器,需要使用
#./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/
这个命令,此外我安装的过程中,出现了这个错误提示,提示tokyocabinet-1.4.47.tar.gz安装不成功,解决办法是,安装需要的软件包就可以了.

错误提示一:
configure: error: zlib.h is required
解决方法是:  # yum install zlib-devel
错误提示二:
configure: error: bzlib.h is required
解决方法是:  # yum install bzip2-devel

下面进入到了正式环节,上面装的两个都是为了httpsqs的安装做的前提准备:
安装:httpsqs-1.7.tar.gz
wget http://httpsqs.googlecode.com/files/httpsqs-1.7.tar.gz
tar zxvf httpsqs-1.7.tar.gz
cd httpsqs-1.7/
make
make install
cd ../

至此安装已经结束:

[root@xoyo ~]# httpsqs -h
-l <ip_addr> 监听的IP地址,默认值为 0.0.0.0 
-p <num> 监听的TCP端口(默认值:1218)
-x <path> 数据库目录,目录不存在会自动创建(例如:/opt/httpsqs/data)
-t <second> HTTP请求的超时时间(默认值:3)
-s <second> 同步内存缓冲区内容到磁盘的间隔秒数(默认值:5)
-c <num> 内存中缓存的最大非叶子节点数(默认值:1024)
-m <size> 数据库内存缓存大小,单位:MB(默认值:100)
-i <file> 保存进程PID到文件中(默认值:/tmp/httpsqs.pid)
-a <auth> 访问HTTPSQS的验证密码(例如:mypass123)
-d 以守护进程运行
-h 显示这个帮助


[root@localhost ~]# ulimit -SHn 65535
[root@localhost ~]# httpsqs -d -p 1218 -x /data0/queue -a mypass123
[root@localhost ~]# ps -aux | grep httpsqs
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
root 14378 0.0 0.0 396420 500 pts/0 S 10:44 0:00 [httpsqs: master process] /usr/bin/httpsqs -d -p 1218 -x /data0/queue -a mypass123
root 14379 0.0 0.0 406664 716 pts/0 Sl 10:44 0:00 [httpsqs: worker process] /usr/bin/httpsqs -d -p 1218 -x /data0/queue -a mypass123
root 14382 0.0 0.0 4356 756 pts/0 S+ 10:44 0:00 grep httpsqs
1、put a queue
[root@localhost ~]# curl "http://192.168.59.129:1218/?name=your_queue_name&opt=put&data=url_encoded_text_message&auth=mypass123"
HTTPSQS_PUT_OK

[root@localhost ~]#
如果入队列成功,返回:
HTTPSQS_PUT_OK

  如果入队列失败,返回:
HTTPSQS_PUT_ERROR

  如果队列已满,返回:
HTTPSQS_PUT_END
2、get a queue
http://192.168.59.129:1218/?name=your_queue_name&opt=get&auth=mypass123
url_encoded_text_message
3、查看队列状态:
http://192.168.59.129:1218/?name=your_queue_name&opt=status&auth=mypass123
HTTP Simple Queue Service v1.7
------------------------------
Queue Name: your_queue_name
Maximum number of queues: 1000000
Put position of queue (1st lap): 5
Get position of queue (1st lap): 0
Number of unread queue: 5
4、使用json格式查看队列内容

http://192.168.59.129:1218/?name=your_queue_name&opt=status_json&auth=mypass123
{"name":"your_queue_name","maxqueue":1000000,"putpos":5,"putlap":1,"getpos":1,"getlap":1,"unread":4}


参考文档:http://blog.s135.com/httpsqs/7/1/
http://code.google.com/p/httpsqs/

posted on 2014-03-01 15:26 abin 阅读(1110) 评论(0)  编辑  收藏 所属分类: httpsqs

只有注册用户登录后才能发表评论。


网站导航: