系统环境:CentOS 6.5 64位
安装方式:编译安装
防火墙:开启
软件版本: httpsqs 1.7
一、 环境准备:
1. 安装libevent-2.0.12-stable.tar.gz
Bash
[root@iZ94ebgv853Z ~]# wget http://soft.7dot.com/soft/libevent-2.0.12-stable.tar.gz
[root@iZ94ebgv853Z ~]# tar xf libevent-2.0.12-stable.tar.gz
[root@iZ94ebgv853Z ~]# cd libevent-2.0.12-stable
[root@iZ94ebgv853Z libevent-2.0.12-stable]# ./configure --prefix=/usr/local/libevent-2.0.12-stable/
[root@iZ94ebgv853Z libevent-2.0.12-stable]#make
[root@iZ94ebgv853Z libevent-2.0.12-stable]#make install
2、安装tokyocabinet-1.4.47.tar.gz
Bash
[root@iZ94ebgv853Z ~]# wget http://fallabs.com/tokyocabinet/tokyocabinet-1.4.47.tar.gz
[root@iZ94ebgv853Z ~]# tar xf tokyocabinet-1.4.47.tar.gz
[root@iZ94ebgv853Z ~]# cd tokyocabinet-1.4.47
[root@iZ94ebgv853Z tokyocabinet-1.4.47]# ./configure --prefix=/usr/local/tokyocabinet-1.4.47/
提示错误:configure: error: zlib.h is require
需要安装zlib
Bash
[root@iZ94ebgv853Z ~]# wget http://www.winimage.com/zLibDll/zlib-1.2.5.tar.gz
[root@iZ94ebgv853Z ~]# tar xf zlib-1.2.5.tar.gz
[root@iZ94ebgv853Z ~]# cd zlib-1.2.5
[root@iZ94ebgv853Z zlib-1.2.5]# ./configure
修改Makefile如下参数:
Bash
CC=gcc -fPIC
CFLAGS=-O3 -fPIC -D_LARGEFILE64_SOURCE=1
Bash
[root@iZ94ebgv853Z zlib-1.2.5]#make
[root@iZ94ebgv853Z zlib-1.2.5]#make install
再次编译:
Bash
[root@iZ94ebgv853Z tokyocabinet-1.4.47]# ./configure --prefix=/usr/local/tokyocabinet-1.4.47/
提示错误:configure: error: bzlib.h is require
需要安装bzlib
Bash
[root@iZ94ebgv853Z ~]# wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
[root@iZ94ebgv853Z ~]# tar xf bzip2-1.0.6.tar.gz
[root@iZ94ebgv853Z ~]# cd bzip2-1.0.6
修改Makefile如下参数:
Bash
CC=gcc -fPIC
CFLAGS=-Wall -Winline -O2 -fPIC -g $(BIGFILES)
Bash
[root@iZ94ebgv853Z bzip2-1.0.6]# make && make install
再次编译:
Bash
[root@iZ94ebgv853Z tokyocabinet-1.4.47]# ./configure --prefix=/usr/local/tokyocabinet-1.4.47/
[root@iZ94ebgv853Z tokyocabinet-1.4.47]# make && make install
二、安装httpsqs-1.7.tar.gz
Bash
[root@iZ94ebgv853Z ~]# wget http://httpsqs.googlecode.com/files/httpsqs-1.7.tar.gz
[root@iZ94ebgv853Z ~]# tar xf httpsqs-1.7.tar.gz
[root@iZ94ebgv853Z ~]# cd httpsqs-1.7
[root@iZ94ebgv853Z httpsqs-1.7]# make && make install
三、 配置httpsqs
Bash
[root@iZ94ebgv853Z ~]# mkdir /usr/local/httpsqs_queue #建立存储目录
建立启动脚本httpsqs.sh
Bash
[root@iZ94ebgv853Z ~]# vim /etc/init.d/httpsqs.sh
内容如下:
Bash
! /bin/sh
ulimit -SHn 65535
/usr/bin/httpsqs -d -p 1218 -t 10 -c 10000 -m 512 -x /usr/local/httpsqs_queue -a pwd123
带密码启动:
Bash
/usr/bin/httpsqs -d -p 1218 -t 10 -c 10000 -m 512 -x /usr/local/httpsqs_queue -a pwd123
不带密码启动:
Bash
/usr/bin/httpsqs -d -p 1218 -t 10 -c 10000 -m 512 -x /usr/local/httpsqs_queue
Bash
[root@iZ94ebgv853Z ~]# chmod +x /etc/init.d/httpsqs.sh #增加可执行权限
在/etc/rc.local中添加:
Bash
/bin/bash /etc/init.d/httpsqs.sh
四、 设置防火墙
Bash
[root@iZ94ebgv853Z ~]# iptables -I INPUT 1 -p tcp --dport 1218 -j ACCEPT
[root@iZ94ebgv853Z ~]# service iptables save
五、 测试:
写队列
Bash
http://IP:1218/?name=your_queue_name&opt=put&data=TEXT&auth=pwd123
读队列
Bash
http://IP:1218/?charset=utf-8&name=your_queue_name&opt=get&auth=pwd123