beanstalkd消息队列安装启动以及PHP使用Pheanstalk类操作

 MeLiu   2019-07-18 14:35   4557 人阅读  0 条评论

目前 beanstalkd 只支持Linux系统


1.安装beanstalkd 

yum install beanstalkd

如出现没有找到这个包,可以升级下yum

yum update

2.启动beanstalkd

beanstalkd -l 127.0.0.1 -p 11300 & 

# ip可以使用这台机器的ip,端口可以更改;
#如果想切换到后台运行:
nohup beanstalkd -l 127.0.0.1 -p 11301 & 

#----------------------------如果不适用源文件安装的启动
# 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

3.使用composer 安装 Pheanstalk类

composer require pda/pheanstalk

4.Pheanstalk使用方法

维护方法        

    stats() 查看状态方法        

    listTubes() 目前存在的管道

    listTubesWatched() 目前监听的管道        

    statsTube() 管道的状态        

    useTube() 指定使用的管道        

    statsJob() 查看任务的详细信息        

    peek() 通过任务ID获取任务    

生产者方法        

    putInTube() 往管道中写入数据        

    put() 配合useTube()使用    

消费者方法        

    watch() 监听管道,可以同时监听多个管道        

    ignore() 不监听管道        

    reserve() 以阻塞方式监听管道,获取任务        

    reserveFromTube()        

    release() 把任务重新放回管道        

    bury() 把任务预留        

    peekBuried() 把预留任务读取出来        

    kickJob() 把buried状态的任务设置成ready        

    kick() 批量把buried状态的任务设置成ready        

    peekReady() 把准备好的任务读取出来        

    peekDelayed() 把延迟的任务读取出来        

    pauseTube() 给管道设置延迟        

    resumeTube() 取消管道延迟        

    touch() 让任务重新计算ttr时间,给任务续命  



本文地址:https://www.mobaishare.com/post/20.html
版权声明:本文为原创文章,版权归 MeLiu 所有,欢迎分享本文,转载请保留出处!

 发表评论


表情

还没有留言,还不快点抢沙发?