beanstalk

时间:2024-05-13 04:17:29编辑:优化君

如何使用beanstalk 多版本

Beanstalkd 是一个高性能的消息队列中间件
Beanstalkd 是一个轻量级消息中间件,它最大特点是将自己定位为基于管道 (tube) 和任务 (job) 的工作队列 (work-queue):
Beanstalkd 支持任务优先级 (priority), 延时 (delay), 超时重发 (time-to-run) 和预留 (buried), 能够很好的支持分布式的后台任务和定时任务处理。
它的内部实现采用 libevent, 服务器-客户端之间用类似 memcached 的轻量级通讯协议,具有有很高的性能。
尽管是内存队列, beanstalkd 提供了 binlog 机制, 当重启 beanstalkd 时,当前任务状态能够从纪录的本地 binlog 中恢复。
管道 (tube):
管道类似于消息主题 (topic), 在一个 Beanstalkd 中可以支持多个管道, 每个管道都有自己的发布者 (producer) 和消费者 (consumer). 管道之间互相不影响。


jack and beanstalk 有什么寓意?能用英语来总结下吗

The story tells of a boy named Jack who was sent to market one day by his mother to sell their last possession,the cow.As Jack was on his way he met a stranger who offered to trade five "magic" beans for the cow.Jack accepted the trade and returned back home with the beans in his pocket.Jack's mother was angered that he had not obeyed her instructions to sell the cow and threw the beans out of the window.
As Jack slept,the beans germinated in the soil,and a gigantic beanstalk grew in their place by morning.When Jack saw the huge beanstalk,he immediately decided to climb it.He arrived in a land high up in the clouds that happened to be the home of a giant.When he broke into the giant's castle,the giant quickly sensed a human was near:
Fee-fi-fo-fum!
I smell the blood of an Englishman.
Be he 'live,or be he dead,
I'll grind his bones to make my bread.
However,Jack was saved by the giant's wife and as he escaped from the palace,he took a bag of gold coins with him.Jack desired to seek out more treasures from the castle in the clouds and climbed once more up the beanstalk.This time he stole a hen which laid golden eggs.Again he was saved from harm by the giant's wife.
Jack disregarded being nearly discovered by the giant twice and decided to go up the beanstalk a third time.This time,he stole a magical harp that played by itself.The instrument did not appreciate being stolen and called out to the giant for help.The giant chased Jack down the beanstalk,but Jack managed to get to the ground before the giant did.Jack,seeing an axe on the ground beside him,immediately chopped the beanstalk down.The giant fell to earth,hitting the ground so hard that it split,pulling the beanstalk down with him.That was the end of the giant and the beanstalk.
简单的:
Jack lives with his mum ,a poor widow .They are very poor.The only thing they have is a milking cow.Jack goes to the market to sell the cow.On the way to the market he meets a kind man .The man tells Jack that he will buy his milking cow for some magic beans.Jack returns home and shows his mum the magic beans.When he tells his mum about the beans she is angry .She throws them out of the window.The next morning Jack wakes up to find a giant beanstalk outside his window.Jack climbs the beanstalk.At the top of the beanstalk he sees a beautiful castle.He goes into the castle and he hears a giant.He hides in the cupboard.Before the giant finds him ,Jack takes the hen and harp with him.The giant chases Jack down the beanstalk ,Jack chops the beanstalk.The hen lays more and more golden eggs.Jack and his mother lives happily.


如何安装和使用Beanstalkd工作队列

使用aptitude安装:

下载并安装Beanstalkd运行以下命令:

aptitude install -y beanstalkd
编辑默认配置文件让随着系统启动

vim /etc/default/beanstalkd
打开文件后,向下滚动并找到底部线#开始= yes。将其更改为:

START=yes
下面介绍源码安装

我们需要从源代码安装过程的一个关键工具- Git。

运行以下获取Git在你系统上:

aptitude install -y git
下载必要的开发工具软件包:

aptitude install -y build-essential
使用Git克隆(下载)官方库:

git clone https://github.com/kr/beanstalkd
进入到下载目录:

cd beanstalkd
从源代码构建应用程序:

make
安装:

make install
再介绍一下centos下源码安装:

下载地址:

wget http://cloud.github.com/downloads/kr/beanstalkd/beanstalkd-1.4.6.tar.gz

解压:

tar xzf beanstalkd-1.4.6.tar.gz

cd beanstalkd-1.4.6

/configure

make

make install

默认安装路径 :/usr/local/bin/

查看版本:

/usr/local/bin/beanstalkd -v

1.4.6
再附加一个启动脚本,从Fedora下挖来的 startup 脚本:

#!/bin/sh
#
# beanstalkd - a simple, fast workqueue service
#
# chkconfig: - 57 47
# description: a simple, fast workqueue service
# processname: beanstalkd
# config: /etc/sysconfig/beanstalkd
#

### BEGIN INIT INFO
# Provides: beanstalkd
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Stop: 0 1 2 6
# Short-Description: start and stop beanstalkd
# Description: a simple, fast work-queue service
### END INIT INFO

# Source function library.
/etc/rc.d/init.d/functions

# Source networking configuration.
/etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit
exec="/usr/local/bin/beanstalkd"
prog=$(basename $exec)

# default options, overruled by items in sysconfig
BEANSTALKD_ADDR=127.0.0.1
BEANSTALKD_PORT=11300
BEANSTALKD_USER=beanstalkd

[ -e /etc/sysconfig/beanstalkd ] && . /etc/sysconfig/beanstalkd

lockfile=/var/lock/subsys/beanstalkd

start() {
[ -x $exec ] || exit 5
echo -n $"Starting $prog: "
# if not running, start it up here, usually something like "daemon $exec"
options="-l ${BEANSTALKD_ADDR} -p ${BEANSTALKD_PORT} -u ${BEANSTALKD_USER}"
if [ "${BEANSTALKD_MAX_JOB_SIZE}" != "" ]; then
options="${options} -z ${BEANSTALKD_MAX_JOB_SIZE}"
fi

if [ "${BEANSTALKD_BINLOG_DIR}" != "" ]; then
if [ ! -d "${BEANSTALKD_BINLOG_DIR}" ]; then
echo "Creating binlog directory (${BEANSTALKD_BINLOG_DIR})"
mkdir -p ${BEANSTALKD_BINLOG_DIR} && chown ${BEANSTALKD_USER}:${BEANSTALKD_USER} ${BEANSTALKD_BINLOG_DIR}
fi
options="${options} -b ${BEANSTALKD_BINLOG_DIR}"
if [ "${BEANSTALKD_BINLOG_FSYNC_PERIOD}" != "" ]; then
options="${options} -f ${BEANSTALKD_BINLOG_FSYNC_PERIOD}"
else
options="${options} -F"
fi
if [ "${BEANSTALKD_BINLOG_SIZE}" != "" ]; then
options="${options} -s ${BEANSTALKD_BINLOG_SIZE}"
fi
fi

daemon $exec -d $options
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $prog: "
# stop it here, often "killproc $prog"
killproc $prog -INT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
stop
start
}

reload() {
restart
}

force_reload() {
restart
}

rh_status() {
# run checks to determine if the service is running or use generic status
status $prog
}

rh_status_q() {
rh_status >/dev/null 2>&1
}


case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
esac
exit $?
使用Beanstalkd

在安装之后,您就可以开始使用Beanstalkd服务器。以下是运行守护进程的选项:

-b DIR wal directory
-f MS fsync at most once every MS milliseconds (use -f0 for "always fsync")
-F never fsync (default)
-l ADDR listen on address (default is 0.0.0.0)
-p PORT listen on port (default is 11300)
-u USER become user and group
-z BYTES set the maximum job size in bytes (default is 65535)
-s BYTES set the size of each wal file (default is 10485760)
(will be rounded up to a multiple of 512 bytes)
-c compact the binlog (default)
-n do not compact the binlog
-v show version information
-V increase verbosity
-h show this help
使用例子:

# Usage: beanstalkd -l [ip address] -p [port #]
# For local only access:
beanstalkd -l 127.0.0.1 -p 11301 &
管理服务:

如果安装包管理器(i.e. aptitude),你将能够管理Beanstalkd作为服务守护进程。

# To start the service:
service beanstalkd start

# To stop the service:
service beanstalkd stop

# To restart the service:
service beanstalkd restart

# To check the status:
service beanstalkd status
获得Beanstalkd客户端库

Beanstalkd配有一长串的支持客户端库来处理许多不同的应用程序部署。这个列表的支持语言和框架,包括:

●Python

●Django

●Go

●Java

●Node.js

●Perl

●PHP

●Ruby

●and more.

查看完整列表支持,寻找你最喜欢的语言和安装说明,查看客户端库页面Beanstalkd Github上。

使用Beanstalkd

在本节之前,完成这篇文章,让我们快速Beanstalkd的基本用法。在我们的示例中,我们将使用Python语言和Beanstald Python bindings ——beanstalkc。

安装beanstalkc,运行以下命令:

pip install pyyaml
pip install beanstalkc
基本操作

在所有Python文件你想处理Beanstalkd时,需要导入beanstalkc并连接:

import beanstalkc

# Connection
beanstalk = beanstalkc.Connection(host='localhost', port=11301)
To enqueue a job:

beanstalk.put('job_one')
To receive a job:

job = beanstalk.reserve()
# job.body == 'job_one'
To delete a job after processing it:

job.delete()
To use a specific tube (i.e. queue / list):

beanstalk.use('tube_a')
To list all available tubes:

beanstalk.tubes()
# ['default', 'tube_a']
Final example (nano btc_ex.py):

import beanstalkc

# Connect
beanstalk = beanstalkc.Connection(host='localhost', port=11301)

# See all tubes:
beanstalk.tubes()

# Switch to the default (tube):
beanstalk.use('default')

# To enqueue a job:
beanstalk.put('job_one')

# To receive a job:
job = beanstalk.reserve()

# Work with the job:
print job.body

# Delete the job:
job.delete()
当您运行上面的脚本时,您应该会看到工作的主体被打印:

python btc_ex.py
# job_one


有哪些to开头的英语单词?

to[tʊ,tuː]prep.到...toad[tәud]n.蟾蜍,癞蛤蟆toast[təʊst]n.烤面包toast[təʊst]n.烤面包(片)tobacco[təʊst]n.烟草,烟叶today[təʊst]ad.在今天;现在toe[tәu]n.脚趾,足尖toffee[ˈtɒfi]太妃糖together[təʊst]ad.共同,一起toilet[ˈtɔɪlɪt]n.厕所,盥洗室,浴室token['tәukәn]n.象征;辅币;纪念品told告诉tomato[təˈmɑːtəʊ]n.番茄tomb[tuːm]n.坟墓tomorrow[təˈmɔrəʊ]ad.在明天n.明天ton[təˈmɔrəʊ]n.吨(重量单位)tone[tәun]n.色调,光度;风气tongue[tʌŋ]n.舌头;语言;口语tonight[təˈnaɪt]ad.在今夜n.今夜tonne[tʌn]n.公吨too[təˈnaɪt]adv.也took花了tool[tuːl]n.工具;用具tooth[tuːθ]n.牙齿top[tɔp]adj.最高的top[tɔp]adj.最高的topic[ˈtɔpɪk]n.(文章的)题目;主题torch[tɔ:tʃ]n.火炬,火把;手电筒tore,tornv.撕开,弄破(tear)tortoise[ˈtɔpɪk]n.龟,乌龟torture['tɔ:tʃә]n.拷问;折磨vt.拷打the Tory Party托利党toss[tɔs]vi.翻来复去total[ˈtəʊt(ə)l]a.总的n.合计total[ˈtəʊt(ə)l]a.总的n.合计tough[ˈtɔt(ə)lɪ]adj.坚韧的tour[tʊə(r)]n.&vi.旅行,游历tourism[ˈtʊərɪz(ə)m]n.旅游事业tourist[ˈtʊərɪst]n.旅游者,观光者tournament[ˈtʊənəmənt;(US)ˈtɜːrn-]n.比赛,(旧时)骑士比武大会tow[tәu]vt.&n.拖引,牵引towardsprep.向,往,朝...方向towel[


《豌豆公主》是出自格林童话还是安徒生童话?

《豌豆公主》,又译《豌豆上的公主》,是安徒生童话系列中的著名的一个,其经典故事深入人心,而《豌豆公主》讲述了关于王子寻找真正的公主的故事,故事简单而且家喻户晓,此外,还有根据这个故事改编的相关电影及动画等。这个作品写于1835年,收集在《讲给孩子们听的故事》里。它的情节虽然简短,但意义却很深刻。真正的王子只能与真正的公主结婚,即所谓的“门户相对”。但真正的公主的特点是什么呢?它的特点是皮肤娇嫩,嫩的连压在这二十床垫子和二十床鸭绒被下面的一粒豌豆都能感觉得出来,这粒豌豆证明了公主的真实,因此,它也成了具有重大历史意义的东西,被送进了博物馆。封建统治者就是这样荒唐。这一小故事是一莫大的讽刺,与《皇帝的新装》也有异曲同工之妙。此外,更有人说安徒生是借此来讽刺封建贵族的娇弱与不堪一击。

请大家帮忙找一下杰克与豆茎童话故事原文

《杰克与豆茎》作者:佚名在古老的欧洲,一个家庭里,生活着两母子,生活很艰难,母亲让儿子杰克去变卖唯一的财产-奶牛,杰克出门时碰到了一个老人,用5粒豌豆和他换了奶牛,老人告诉杰克:豌豆有着无与伦比的魔力。夜里,撒在地上的豌豆长成了豆苗,一直长上了天空,杰克爬上豆苗,发现这是另一个世界。在那里他发现一个巨人统治着一个巨大的城堡,巨人拥有一只会下金蛋的鹅,伴随着旁边的黄金小和谐女神所弹奏竖琴的美妙音乐中,鹅会生下金蛋。杰克偷了鹅和黄金小女神,爬下豆茎,但是巨人紧追不舍,于是杰克把豆苗砍断,巨人摔死。从此,杰克和母亲过上幸福的生活。扩展资料创作背景《杰克与豆茎》是一个西方流传已久的,关于巨人和豆茎的传统故事,讲述了杰克敢于冒险,用勇气和智慧战胜了巨人,和母亲过上了幸福的生活的故事。意在告诉人们,在生活中可能也会遇到一些困难,但是在困境中能够像杰克一样,勇敢坚强,积极面对生活,为了家人和梦想而奋斗。根据该童话故事改编的同名电影《杰克与豆茎》是一部穿梭天地人神间的魔幻大片,片中的特技之逼真,令人为之惊叹。本片改编自家喻户晓的民间传说,但在情节的设置上对传统的故事又进行了一些颠覆。把传说中的恶巨人变成好巨人,把勇斗恶巨人的杰克变成偷窃犯和谋杀犯。与同为魔幻大片的《纳尼亚传奇》相比,《杰克与豆茎》中的故事情节更为吸引,可谓 有过之而无不及。另外值得一提的是,片中的超特技效果,让人应接不暇,感觉耳目一新。

杰克与豌豆的故事

杰克是个与单亲母亲同住的少年,家中唯一的经济来源是一头乳牛。直到有一天,母牛已经老到无法生产牛奶赚钱,母亲便叫杰克把牛牵到市场上去卖钱。在去市场的途中,杰克遇到了一位欲以“魔豆”交换乳牛的男人,而杰克也答应了。回到家后,母亲发现杰克一毛钱也没赚到,只换来的几颗不明所以的豆子,盛怒之下把魔豆通通丢到外面,并命令杰克立刻上床睡觉。一夜之间,魔豆长得飞快,杰克攀著延伸到天上的豆茎,进入了一个天上的世界,并闯入了巨人居住的房子和城堡。巨人回家后,他发现了家里有“人味”,不过并没有发现杰克。直到巨人沉沉睡去之后,杰克偷了一袋金币,并原路逃离这个地方。之后,杰克曾经回到巨人的住所两次,并如法炮制在巨人睡着时偷了其他的财宝:一个会下金蛋的鹅(或鸡)、以及一个会自动弹奏的竖琴。但是,在杰克想要带着竖琴离开时,把巨人吵醒了,于是,巨人紧紧追赶杰克,杰克便叫母亲拿斧头把豆茎砍断,让巨人跌落至死。而杰克和母亲便靠着从巨人那里得到的财宝,过着幸福的日子。扩展资料《杰克与豌豆》(Jack and the Beanstalk)是一则英国童话,它是最著名的杰克故事。1734年首次出现于《杰克‧史普林金与魔豆的故事》,1807年时出现在本杰明·塔巴特(Benjamin Tabart)的版本《杰克与魔豆史话》,但最普及的是约瑟夫·雅各布(Joseph Jacobs)的版本(1890年)。有看法认为,约瑟夫的版本可能比较接近口语流传时的版本,因为本杰明的版本中含有说教劝世的内容,而口语流传时的版本通常比较没有这类成分。参考资料百度百科_杰克与魔豆

jack and beanstalk 有什么寓意? 能用英语来总结下吗?

The story tells of a boy named Jack who was sent to market one day by his mother to sell their last possession, the cow. As Jack was on his way he met a stranger who offered to trade five "magic" beans for the cow. Jack accepted the trade and returned back home with the beans in his pocket. Jack's mother was angered that he had not obeyed her instructions to sell the cow and threw the beans out of the window.
As Jack slept, the beans germinated in the soil, and a gigantic beanstalk grew in their place by morning. When Jack saw the huge beanstalk, he immediately decided to climb it. He arrived in a land high up in the clouds that happened to be the home of a giant. When he broke into the giant's castle, the giant quickly sensed a human was near:
Fee-fi-fo-fum!
I smell the blood of an Englishman.
Be he 'live, or be he dead,
I'll grind his bones to make my bread.
However, Jack was saved by the giant's wife and as he escaped from the palace, he took a bag of gold coins with him. Jack desired to seek out more treasures from the castle in the clouds and climbed once more up the beanstalk. This time he stole a hen which laid golden eggs. Again he was saved from harm by the giant's wife.
Jack disregarded being nearly discovered by the giant twice and decided to go up the beanstalk a third time. This time, he stole a magical harp that played by itself. The instrument did not appreciate being stolen and called out to the giant for help. The giant chased Jack down the beanstalk, but Jack managed to get to the ground before the giant did. Jack, seeing an axe on the ground beside him, immediately chopped the beanstalk down. The giant fell to earth, hitting the ground so hard that it split, pulling the beanstalk down with him. That was the end of the giant and the beanstalk.

简单的:
Jack lives with his mum ,a poor widow .They are very poor. The only thing they have is a milking cow. Jack goes to the market to sell the cow. On the way to the market he meets a kind man .The man tells Jack that he will buy his milking cow for some magic beans. Jack returns home and shows his mum the magic beans. When he tells his mum about the beans she is angry .She throws them out of the window. The next morning Jack wakes up to find a giant beanstalk outside his window. Jack climbs the beanstalk. At the top of the beanstalk he sees a beautiful castle. He goes into the castle and he hears a giant. He hides in the cupboard. Before the giant finds him ,Jack takes the hen and harp with him. The giant chases Jack down the beanstalk ,Jack chops the beanstalk. The hen lays more and more golden eggs. Jack and his mother lives happily.


请问在英语中Jack 有什么特别的寓意吗?

hi Jack!
hijack,劫机,大家看这个单词,hijack可分成两部分,hi和jack。hi是英语中打招呼的一种说法,Jack是个大众人名。话说美国在颁布禁酒令(1920-1933)初期,歹徒常常打劫运酒车。他们通常使用的办法就是,先装成搭便车的路人(hitchhiker),等汽车停下来,他们会对司机说的第一句话是:“ Hi, Jack!”。于是hijack 便成了“抢劫”的代名词。当然了,Jack这个词本身也不“安分”,除了当人名外,小写jack也有抢劫的意思。比如你在等红灯时,一个人拉开门,把你拽下来,抢了你的车,这就是car-jacking。


上一篇:恬噪

下一篇:缓冲