在CentOS 6.4中使用HTTPSQS搭建队列服务器

发布时间:2018-08-25 11:33:01编辑:丝画阁阅读(743)

一、安装过程
  1、下载libevent-2.0.12-stable,并编译安装
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

  2、下载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/
#注:在32位Linux操作系统上编译Tokyo cabinet,请使用./configure --enable-off64代替./configure,可以使数据库文件突破2GB的限制。
#./configure --enable-off64 --prefix=/usr/local/tokyocabinet-1.4.47/
make
make install

  3、下载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

二、安装过程中出现的相关问题
  1、编译httpsqs时候出现event.h文件,解决方法:
yum install libevent libevent-devel

三、启动httsqs服务,并加入到/etc/rc.local中:
vim /etc/rc.local

  添加如下内容:
httpsqs -d -p 1218 -x /opt/httpsqs/data

四、测试(查看是否安装成功)
  在浏览器中执行如下操作:
  http://localhost:1218/?name=test&opt=put&data=测试        --向队列中添加一条数据
  http://localhost:1218/?name=test&opt=status                --查看队列的状态
  http://localhost:1218/?name=test&opt=get                --从队列中获取一条数据

关键字