测试kestrel的队列
一、依赖环境的安装
1、sbt
wget http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.2/sbt-launch.jar
mv sbt-launch.jar /usr/local/bin/
echo 'java -Xmx512M -jar `dirname $0`/sbt-launch.jar "$@"' >> /usr/local/bin/sbt
chmod 777 /usr/local/bin/sbt
2、daemon
wget http://libslack.org/daemon/download/daemon-0.6.4.tar.gz
tar xzvf daemon-0.6.4.tar.gz
./configure
make & make install
二、安装kestrel
wget http://robey.github.com/kestrel/download/kestrel-2.2.0.zip
unzip kestrel-2.2.0.zip
mv kestrel-2.2.0 /usr/local/kestrel
mkdir /usr/local/kestrel/current
cp /usr/local/kestrel/*.jar /usr/local/kestrel/current
三 启动 kestrel
nohup java -jar /usr/local/kestrel/kestrel_2.9.1-2.2.0.jar &
四 通过telnet命令的基本使用
Kestrel有三种协议:memcached、thrift、text。分别在独立的端口提供服务,默认如下:
memcached => 22133,thrift => 2229 ,text => 2222
text相对简单,模拟消息生产和消费:telnet到Kestrel server上,使用"put <queue_name>:\nmessage\n\n"进行生产和"get <queue_name>\n"进行消费,"\n"看作回车键即可。
我们只测试memcached协议
[root@xen189v-t ~]# telnet 127.0.0.1 22133
Trying 127.0.0.1...
Connected to xen189v.ops.corp.qihoo.net (127.0.0.1).
Escape character is '^]'.
reload
Reloaded config.
DUMP_STATS
queue 'uptime' {
items=0
bytes=0
total_items=0
logsize=0
expired_items=0
mem_items=0
mem_bytes=0
age=0
discarded=0
waiters=0
open_transactions=0
total_flushes=0
}
END
stats
STAT uptime 507
STAT time 1378360712
STAT version 2.2.0
STAT curr_items 0
STAT total_items 0
STAT bytes 0
STAT reserved_memory_ratio 0.070
STAT curr_connections 1
STAT total_connections 9
STAT cmd_get 1
STAT cmd_set 0
STAT cmd_peek 0
STAT get_hits 0
STAT get_misses 1
STAT bytes_read 255
STAT bytes_written 2015
STAT queue_creates 1
STAT queue_deletes 0
STAT queue_expires 0
STAT queue_uptime_items 0
STAT queue_uptime_bytes 0
STAT queue_uptime_total_items 0
STAT queue_uptime_logsize 0
STAT queue_uptime_expired_items 0
STAT queue_uptime_mem_items 0
STAT queue_uptime_mem_bytes 0
STAT queue_uptime_age 0
STAT queue_uptime_discarded 0
STAT queue_uptime_waiters 0
STAT queue_uptime_open_transactions 0
STAT queue_uptime_total_flushes 0
END
######################################################################
测试队列的先进先出
[root@xen189v-t ~]# telnet 127.0.0.1 22133
Trying 127.0.0.1...
Connected to xen189v.ops.corp.qihoo.net (127.0.0.1).
Escape character is '^]'.
set fuck 0 0 2
d1
STORED
set fuck 0 0 3
kkk
STORED
set fuck 0 0 8
xxxdddkk
STORED
get fuck
VALUE fuck 0 2
d1
END
get fuck
VALUE fuck 0 3
kkk
END
get fuck
VALUE fuck 0 8
xxxdddkk
END
stats
STAT uptime 1307
STAT time 1378361512
STAT version 2.2.0
STAT curr_items 0
STAT total_items 9
STAT bytes 0
STAT reserved_memory_ratio 0.211
STAT curr_connections 1
STAT total_connections 20
STAT cmd_get 12
STAT cmd_set 9
STAT cmd_peek 0
STAT get_hits 9
STAT get_misses 3
STAT bytes_read 677
STAT bytes_written 9093
STAT queue_creates 3
STAT queue_deletes 0
STAT queue_expires 0
STAT queue_fuck_items 0
STAT queue_fuck_bytes 0
STAT queue_fuck_total_items 9
STAT queue_fuck_logsize 252
STAT queue_fuck_expired_items 0
STAT queue_fuck_mem_items 0
STAT queue_fuck_mem_bytes 0
STAT queue_fuck_age 0
STAT queue_fuck_discarded 0
STAT queue_fuck_waiters 0
STAT queue_fuck_open_transactions 0
STAT queue_fuck_total_flushes 0
STAT queue_uptime_items 0
STAT queue_uptime_bytes 0
STAT queue_uptime_total_items 0
STAT queue_uptime_logsize 0
STAT queue_uptime_expired_items 0
STAT queue_uptime_mem_items 0
STAT queue_uptime_mem_bytes 0
STAT queue_uptime_age 0
STAT queue_uptime_discarded 0
STAT queue_uptime_waiters 0
STAT queue_uptime_open_transactions 0
STAT queue_uptime_total_flushes 0
STAT queue_aaa_items 0
STAT queue_aaa_bytes 0
STAT queue_aaa_total_items 0
STAT queue_aaa_logsize 0
STAT queue_aaa_expired_items 0
STAT queue_aaa_mem_items 0
STAT queue_aaa_mem_bytes 0
STAT queue_aaa_age 0
STAT queue_aaa_discarded 0
STAT queue_aaa_waiters 0
STAT queue_aaa_open_transactions 0
STAT queue_aaa_total_flushes 0
END
继续
get fuck
END
因为队列加的3个数据,统统被取出来了。
五 kestrel认知
1)Kestrel是twitter开源的一个scala写的简单高效MQ,采用的协议是memcached的文本协议,但是并不完全支持所有memcached协议,也不是完全兼容现有协议。
2)标准的协议它仅支持GET、SET、FLUSH_ALL、STATS,
3)Kestrel是一个队列服务器
六 kestrel实现memcache协议的命令如下:
The kestrel implementation of the memcache protocol commands is described below.
SET <queue-name> <flags (ignored)> <expiration> <# bytes>
Add an item to a queue. It may fail if the queue has a size or item limit and it's full.
GET <queue-name>[options]
Remove an item from a queue. It will return an empty response immediately if the queue is empty.
DELETE <queue-name> 删除某个队列同时删除所有条目,也会删除有关联的日志文件
Drop a queue, discarding any items in it, and deleting any associated journal files.
FLUSH <queue-name> 删除某个队列中的所有条目
Discard all items remaining in this queue. The queue remains live and new items can be added. The time it takes to flush will be linear to the current queue size, and any other activity on this queue will block while it's being flushed.
FLUSH_ALL 删除所有队列中的所有条目,就好像是每个队列都接受到了FLUSH命令一样
Discard all items remaining in all queues. The queues are flushed one at a time, as if kestrel received a FLUSH command for each queue.
VERSION 查询KESTREL的版本号
Display the kestrel version in a way compatible with memcache.
SHUTDOWN 关闭KESTREL服务器然后退出
Cleanly shutdown the server and exit.
RELOAD 重新加载配置文件
Reload the config file and reconfigure all queues. This should have no noticable effect on the server's responsiveness.
STATS 跟MEMCACHE显示的格式一样显示
Display server stats in memcache style. They're described below.
DUMP_STATS 按照队列名分组来显示
Display server stats in a more readable style, grouped by queue. They're described below.
测试kestrel的队列的更多相关文章
- 【10.7校内测试】【队列滑窗】【2-sat】【贪心+栈二分+线段树(noip模拟好题)】【生日祭!】
比较好想的一道题,直接用队列滑窗,因为扫一遍往队列里加东西时,改变的只有一个值,开桶储存好就行了! #include<bits/stdc++.h> using namespace std; ...
- 【8.15校内测试】【队列】【manacher】
dp??不能确定转移状态.考虑用优先队列储存最优决策点,可是发现当前选择最优不能保证最后最优,在后面可以将之前用过的替换过来. 比如数据: 3 5 4 6 只储存a[i]来决策不能延展到后面的状态,因 ...
- js array queue (队列)
前言 今天项目中做一个图片效果展示,需要实时从后台获取图片数据,前段做展示.想想用到队列,比较好实现这个功能,只需要展示队列里的数据就可以了.于是写了个js 对列. js code /** * [Qu ...
- jquery 的队列queue
使用示列代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www ...
- Java 集合与队列的插入、删除在并发下的性能比较
这两天在写一个java多线程的爬虫,以广度优先爬取网页,设置两个缓存: 一个保存已经访问过的URL:vistedUrls 一个保存没有访问过的URL:unVistedUrls 需要爬取的数据量不大,对 ...
- c#之Redis队列
摘要 这两天一直在考虑redis队列:一个生产者,多个消费者的情况,这里弄了一个demo进行测试. 一个例子 关于如何引用Redisclient 可以参考之前的这篇文章:c#之Redis实践list, ...
- 队列的链式存储方式的实现(Java语言描述)
链队列的结构示意图: 先进先出. QueueInterface.java//操作方法接口 package 队列的实现; public interface QueueInterface { public ...
- STL学习系列七:优先级队列priority_queue容器
1.简介 最大值优先级队列.最小值优先级队列 优先级队列适配器 STL priority_queue 用来开发一些特殊的应用,请对stl的类库,多做扩展性学习 这里给个例子: #include< ...
- iOS 之GCD串行和并发队列的理解
dispatch_queue_t serialQueue = dispatch_queue_create("com.lai.www", DISPATCH_QUEUE_SERIAL) ...
随机推荐
- 在SSH整合框架中经常会用到Service层,请问大家这个Service层有什么具体的作用,可不可以不用这个Service层呢?
有效地分离数据访问层(DAO)和业务层(SERVICE),使之各司其职,举例说明:如果DAO层访问数据库,得到的数据根据业务需要要进行加密,那么取数据和把数据加密就是2个步骤,访问数据和业务逻辑加工, ...
- 鼠标滑轮一滚动Excel就停止工作
鼠标滑轮一滚动Excel就停止工作 问题签名: 问题事件名称:APPCRASH 应用程序名:EXCEL.EXE 应用程序版本:15.0.4420.1017 应用程序时间戳:50673286 故障模块名 ...
- ASP.NET MVC 5 学习教程:使用 SQL Server LocalDB
原文 ASP.NET MVC 5 学习教程:使用 SQL Server LocalDB 起飞网 ASP.NET MVC 5 学习教程目录: 添加控制器 添加视图 修改视图和布局页 控制器传递数据给视图 ...
- 17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 获取复制Master Binary Log的坐标:
17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 获取复制Master Binary Log的坐标: 你需要master ...
- 腾讯QQ:异地登陆也被封号,你们是怎么决策的???
此文我想放到首页,让很多其它的人看到,更期待有人能解释一下.希望管理员给开绿灯. 今天真是费解,我的手机号是青岛的.可是我在武汉工作,因为是3G的卡,全国没有漫游,打电话也没多少钱,所以就没换号. 谁 ...
- Java 找出四位数的全部吸血鬼数字 基础代码实例
/** * 找出四位数的全部吸血鬼数字 * 吸血鬼数字是指位数为偶数的数字,能够由一对数字相乘而得到,而这对数字各包括乘积的一半位数的数字,当中从最初的数字中选取的数字能够随意排序. * 以两个 ...
- XML(三)
使用 XSLT 显示 XML -------------------------------------------------------------------------------- 通 ...
- linux cmd
Linux查找包含特定字符串的文件名的方法 Pasted from <http://www.jbxue.com/LINUXjishu/9790.html> find .|xargs gre ...
- android开发之Intent.setFlags()_让Android点击通知栏信息后返回正在运行的程序
android开发之Intent.setFlags()_让Android点击通知栏信息后返回正在运行的程序 在应用里使用了后台服务,并且在通知栏推送了消息,希望点击这个消息回到activity ...
- Android 富文本框实现 RichEditText
Android系统自带控件没有富文本框控件,如果想写一封带格式的邮件基本上不可能,EdtiText只有默认一种格式,显示不能滿足要求,!!正好项目需要研究了一下,开发了此控件,现将一些源代码开放一下, ...