1,Libevent的安装
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar zxvf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local/libevent
make clean && make
sudo make install
2,UCMQ的安装
git clone git://github.com/ucopensource/ucmq.git
cd ucmq
./configure --with-libevent=/usr/local/libevent --prefix=/usr/local/ucmq
make clean && make
sudo make install
3,启动UCMQ
cd /usr/local/ucmq/
cd conf修改ucmq.ini文件,设置server ip port 等
[server]
http_listen_addr=127.0.0.1
http_listen_port= 8803
allow_exec_ip=0
output_log_path=../log
output_log_level=DEBUG
binlog_file_path=../binlog
keep_alive=300
conf_file=../conf/ucmq.ini
pid_file=/tmp/ucmq_eth0_8803.pid
# reserved storage space, unit GB */
res_store_space=4
# queue list items limit
max_qlist_itmes=128
[rtag]
sync_interval=100
sync_time_interval=20
[queue]
# queue store msg number
def_max_queue=1000000
def_delay=0
########################################################################
# DB file size must be less than 64, must be system multiple page !!! #
# !!! The following contents are not allowed to change after the start #
########################################################################
[db]
data_file_path=../data
db_file_max_size=64
启动: ./ucmq –c ../conf/ucmq.ini –d
关闭:
1,kill
2,curl "http://127.0.0.1:8803/exec?cmd=kill"
入队列
curl -d "testdata" "http://127.0.0.1:8803/?name=testmq&opt=put&ver=2"
出队列
http://127.0.0.1:8803/?name=testmq&opt=get&ver=2
获取某队列的状态,查看队列的属性
http://127.0.0.1:8803/?name=testmq&opt=status&ver=2
数据data文件结构
参考:http://ucweb.github.io/ucmq_guide/