[root@localhost ~]# ls -al /usr/lib | grep libevent
[root@localhost ~]# yum install libtool -y
[root@localhost ~]# wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
[root@localhost ~]# cd libevent-2.1.11-stable
[root@localhost libevent-2.1.11-stable]# ./configure --prefix=/usr/lib/libevent
[root@localhost libevent-2.1.11-stable]# make && make install
[root@localhost libevent-2.1.11-stable]# ls -al /usr/lib | grep libevent
drwxr-xr-x. 5 root root 43 Feb 11 02:48 libevent
ucmq和memcache都依赖libevent,同时ucmq还依赖libtool
[root@localhost ~]# git clone git://github.com/zhanglei/ucmq.git
[root@localhost ~]# cp -R ucmq /root/ucmq
[root@localhost ~]# cd /root/ucmq/
[root@localhost ucmq]# chmod +x .
[root@localhost ucmq]# ./genall.sh
[root@localhost ucmq]# ./configure --with-libevent=/usr/lib/libevent --prefix=/usr/local/ucmq
[root@localhost ucmq]# make && make install
[root@localhost ucmq]# make clean
错误:./genall.sh:行13: libtoolize: 未找到命令,安装libtool即可
[root@localhost ucmq]# vi source/Makefile
[root@localhost ucmq]# vi Makefile
修改后再编译,一切顺利!!
[root@localhost ucmq]# make && make install
[root@localhost ucmq]# ll /usr/local/ucmq/
总用量 0
drwxr-xr-x. 2 root root 18 12月 21 10:13 bin
drwxr-xr-x. 2 root root 22 12月 21 10:13 conf
drwxr-xr-x. 2 root root 41 12月 21 10:13 include
drwxr-xr-x. 2 root root 103 12月 21 10:13 lib
drwxr-xr-x. 2 root root 86 12月 21 10:13 test
[server]
http_listen_addr=0.0.0.0 //监听地址,设置0.0.0.0为通用访问,也可设置为127.0.0.1或192.168.x.x
http_listen_port=18180 //监听端口,设置超过10000,避免冲突
allow_exec_ip=0 //允许执行运维指令的ip,0为不限制
binlog_file_path=/log/ucmq.binlog //binlog目录(暂未实现主从)
output_log_path=/log/ucmq.log //日志目录
output_log_level=DEBUG //日志记录级别
keep_alive=300 //长连接有效时间(单位:秒)
conf_file=/data/conf/ucmq.ini //配置文件路径
pid_file=/var/run/ucmq.pid //进程保护文件
res_store_space=4 //预留磁盘空间(单位:GB)
[rtag]
sync_interval=10 //数据文件内存映射持久化操作间隔(写操作次数)
sync_time_interval=100 //间隔n秒后持久化rtag和DB的信息,会调用fsync。
[queue]
def_max_queue=1000000 //队列允许积压消息量,设置为0则不限制
#延时只能设置更大
def_delay=0 //队列延时时间
#以下内容自从启动后不允许修改
[db]
data_file_path=/data/ucmq/ //data文件存放路径
#文件大小不允许超过64,必须是系统页大小的倍数
db_file_max_size=64 //允许的data文件的最大限制(单位:MB)
将ucmq加入系统服务,并设置开启自启动
#! /bin/sh
#
# ucmq this script starts and stops the ucmq daemon
#
# chkconfig: 345 86 16
# description: ucmq is a non-relational database storage system.
# processname: ucmq
# config: /data/conf/ucmq.ini
# pidfile: /var/run/ucmq.pid
PATH=/usr/local/bin:/sbin:/usr/bin:/bin
EXEC=/usr/local/ucmq/bin/ucmq
CONF=/data/conf/ucmq.ini
PIDFILE=/var/run/ucmq.pid
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting ucmq server..."
$EXEC -c $CONF -d
fi
while [ ! -x ${PIDFILE} ]
do
echo "Waiting for ucmq to starting ..."
sleep 1
done
echo "ucmq is running..."
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
kill -2 $PID;
while [ -x ${PIDFILE} ]
do
echo "Waiting for ucmq to shutdown ..."
sleep 1
done
echo "ucmq stopped"
fi
;;
restart|force-reload)
${0} stop
${0} start
;;
*)
echo "Usage: /etc/init.d/ucmq {start|stop|restart|force-reload}" >&2
exit 1
esac
设置为开机服务
[root@localhost ~]# vi /etc/init.d/ucmq
[root@localhost ~]# chmod +x /etc/init.d/ucmq
[root@localhost ~]# chkconfig ucmq on
[root@localhost ~]# service ucmq start
[root@localhost ~]# ps aux |grep ucmq
root 75568 0.0 0.0 22608 1000 pts/3 S 13:33 0:00 /usr/local/ucmq/bin/ucmq -c /data/conf/ucmq.ini
root 75759 0.0 0.0 112728 992 pts/2 S+ 13:37 0:00 grep --color=auto ucmq
test ucmq