登录  /  注册

laravel job 的 queue:listen 队列处理

php中文网
发布: 2016-06-06 20:29:35
原创
1514人浏览过

laravel 本地开发好后 上传到远程服务器上,

php artisan queue:listen
登录后复制
登录后复制

结果返回

[PDOException]  could not find driver
登录后复制
登录后复制

本地开发好程序后 上传到服务器上 除了上传源代码 还需要做什么吗

.env 配置

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=database
登录后复制
登录后复制

queue.php 配置文件

<?php return [

    /*
    |--------------------------------------------------------------------------
    | Default Queue Driver
    |--------------------------------------------------------------------------
    |
    | The Laravel queue API supports a variety of back-ends via an unified
    | API, giving you convenient access to each back-end using the same
    | syntax for each one. Here you may set the default queue driver.
    |
    | Supported: "null", "sync", "database", "beanstalkd",
    |            "sqs", "iron", "redis"
    |
    */

    'default' => env('QUEUE_DRIVER', 'database'),

    /*
    |--------------------------------------------------------------------------
    | Queue Connections
    |--------------------------------------------------------------------------
    |
    | Here you may configure the connection information for each server that
    | is used by your application. A default configuration has been added
    | for each back-end shipped with Laravel. You are free to add more.
    |
    */

    'connections' =&gt; [

        'sync' =&gt; [
            'driver' =&gt; 'sync',
        ],

        'database' =&gt; [
            'driver' =&gt; 'database',
            'table' =&gt; 'jobs',
            'queue' =&gt; 'default',
            'expire' =&gt; 60,
        ],

        'beanstalkd' =&gt; [
            'driver' =&gt; 'beanstalkd',
            'host'   =&gt; 'localhost',
            'queue'  =&gt; 'default',
            'ttr'    =&gt; 60,
        ],

        'sqs' =&gt; [
            'driver' =&gt; 'sqs',
            'key'    =&gt; 'your-public-key',
            'secret' =&gt; 'your-secret-key',
            'queue'  =&gt; 'your-queue-url',
            'region' =&gt; 'us-east-1',
        ],

        'iron' =&gt; [
            'driver'  =&gt; 'iron',
            'host'    =&gt; 'mq-aws-us-east-1.iron.io',
            'token'   =&gt; 'your-token',
            'project' =&gt; 'your-project-id',
            'queue'   =&gt; 'your-queue-name',
            'encrypt' =&gt; true,
        ],

        'redis' =&gt; [
            'driver' =&gt; 'redis',
            'connection' =&gt; 'default',
            'queue'  =&gt; 'default',
            'expire' =&gt; 60,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Failed Queue Jobs
    |--------------------------------------------------------------------------
    |
    | These options configure the behavior of failed queue job logging so you
    | can control which database and table are used to store the jobs that
    | have failed. You may change them to any database / table you wish.
    |
    */

    'failed' =&gt; [
        'database' =&gt; '<a style="color:#f60; text-decoration:underline;" href="//m.sbmmt.com/zt/15713.html" target="_blank">mysql</a>', 'table' =&gt; 'failed_jobs',
    ],

];

登录后复制

领导 如果 要监听队列,命令窗口是不是要一直开着呢 php artisan queue:listen

关闭了 好像 就不执行 数据库里的队列任务就不执行了呢

改如何一直监听 队列处理呢

回复内容:

laravel 本地开发好后 上传到远程服务器上,

php artisan queue:listen
登录后复制
登录后复制

结果返回

[PDOException]  could not find driver
登录后复制
登录后复制

本地开发好程序后 上传到服务器上 除了上传源代码 还需要做什么吗

.env 配置

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=database
登录后复制
登录后复制

queue.php 配置文件

<?php return [

    /*
    |--------------------------------------------------------------------------
    | Default Queue Driver
    |--------------------------------------------------------------------------
    |
    | The Laravel queue API supports a variety of back-ends via an unified
    | API, giving you convenient access to each back-end using the same
    | syntax for each one. Here you may set the default queue driver.
    |
    | Supported: "null", "sync", "database", "beanstalkd",
    |            "sqs", "iron", "redis"
    |
    */

    'default' => env('QUEUE_DRIVER', 'database'),

    /*
    |--------------------------------------------------------------------------
    | Queue Connections
    |--------------------------------------------------------------------------
    |
    | Here you may configure the connection information for each server that
    | is used by your application. A default configuration has been added
    | for each back-end shipped with Laravel. You are free to add more.
    |
    */

    'connections' =&gt; [

        'sync' =&gt; [
            'driver' =&gt; 'sync',
        ],

        'database' =&gt; [
            'driver' =&gt; 'database',
            'table' =&gt; 'jobs',
            'queue' =&gt; 'default',
            'expire' =&gt; 60,
        ],

        'beanstalkd' =&gt; [
            'driver' =&gt; 'beanstalkd',
            'host'   =&gt; 'localhost',
            'queue'  =&gt; 'default',
            'ttr'    =&gt; 60,
        ],

        'sqs' =&gt; [
            'driver' =&gt; 'sqs',
            'key'    =&gt; 'your-public-key',
            'secret' =&gt; 'your-secret-key',
            'queue'  =&gt; 'your-queue-url',
            'region' =&gt; 'us-east-1',
        ],

        'iron' =&gt; [
            'driver'  =&gt; 'iron',
            'host'    =&gt; 'mq-aws-us-east-1.iron.io',
            'token'   =&gt; 'your-token',
            'project' =&gt; 'your-project-id',
            'queue'   =&gt; 'your-queue-name',
            'encrypt' =&gt; true,
        ],

        'redis' =&gt; [
            'driver' =&gt; 'redis',
            'connection' =&gt; 'default',
            'queue'  =&gt; 'default',
            'expire' =&gt; 60,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Failed Queue Jobs
    |--------------------------------------------------------------------------
    |
    | These options configure the behavior of failed queue job logging so you
    | can control which database and table are used to store the jobs that
    | have failed. You may change them to any database / table you wish.
    |
    */

    'failed' =&gt; [
        'database' =&gt; 'mysql', 'table' =&gt; 'failed_jobs',
    ],

];

登录后复制

领导 如果 要监听队列,命令窗口是不是要一直开着呢 php artisan queue:listen

关闭了 好像 就不执行 数据库里的队列任务就不执行了呢

改如何一直监听 队列处理呢

生产环境用Supervisor在后台跑queue
http://laravel.com/docs/5.1/queues#supervisor-configuration

智能AI问答
PHP中文网智能助手能迅速回答你的编程问题,提供实时的代码和解决方案,帮助你解决各种难题。不仅如此,它还能提供编程资源和学习指导,帮助你快速提升编程技能。无论你是初学者还是专业人士,AI智能助手都能成为你的可靠助手,助力你在编程领域取得更大的成就。
相关标签:
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
关于CSS思维导图的课件在哪? 课件
凡人来自于2024-04-16 10:10:18
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 //m.sbmmt.com/ All Rights Reserved | php.cn | 湘ICP备2023035733号