轻量级消息队列服务UCMQ

来源:互联网 发布:kontakt5 mac破解版 编辑:程序博客网 时间:2024/04/30 13:22

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/ucmqmake 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.1http_listen_port= 8803allow_exec_ip=0output_log_path=../logoutput_log_level=DEBUGbinlog_file_path=../binlogkeep_alive=300conf_file=../conf/ucmq.inipid_file=/tmp/ucmq_eth0_8803.pid# reserved storage space, unit GB */res_store_space=4# queue list items limitmax_qlist_itmes=128       [rtag]sync_interval=100sync_time_interval=20[queue]# queue store msg numberdef_max_queue=1000000def_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=../datadb_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/