• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

laravel job 的 queue:listen 队列处理

php 搞代码 4年前 (2022-01-25) 20次浏览 已收录 0个评论
文章目录[隐藏]

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

<code>php artisan queue:listen</code>

结果返回

<code>[PDOException]  could not find driver</code>

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

.env 配置

<code>CACHE_DRIVER=fileSESSION_DRIVER=fileQUEUE_DRIVER=database</code>

queue.php 配置文件

<code><?phpreturn [    /*    |--------------------------------------------------------------------------    | 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' => [        'sync' => [            'driver' => 'sync',        ],        'database' => [            'driver' => 'database',            'table' => 'jobs',            'queue' => 'default',            'expire' => 60,        ],        'beanstalkd' => [            'driver' => 'beanstalkd',            'host'   => 'localhost',            'queue'  => 'default',            'ttr'    => 60,        ],        'sqs' => [            'driver' => 'sqs',            'key'    => 'your-public-key',            'secret' => 'your-secret-key',            'queue'  => 'your-queue-url',            'region' => 'us-east-1',        ],        'iron' => [            'driver'  => 'iron',            'host'    => 'mq-aws-us-east-1.iron.io',            'token'   => 'your-token',            'project' => 'your-project-id',            'queue'   => 'your-queue-name',            'encrypt' => true,        ],        'redis' => [            'driver' => 'redis',            'connection' => 'default',            'queue'  => 'default',            'expire' => 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' => [        'database' => 'mysql', 'table' => 'failed_jobs',    ],];</code>

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

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

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

回复内容:

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

<code>php artisan queue:listen</code>

结果返回

<code>[PDOException]  could not find driver</code>

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

.env 配置

<code>CACHE_DRIVER=fileSESSION_DRIVER=fileQUEUE_DRIVER=database</code>

queue.php 配置文件

<code><?phpreturn [    /*    |-------------------------------<mark>@本文来源gaodaimacom搞#代%码@网-</mark><strong>搞代gaodaima码</strong>-------------------------------------------    | 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' => [        'sync' => [            'driver' => 'sync',        ],        'database' => [            'driver' => 'database',            'table' => 'jobs',            'queue' => 'default',            'expire' => 60,        ],        'beanstalkd' => [            'driver' => 'beanstalkd',            'host'   => 'localhost',            'queue'  => 'default',            'ttr'    => 60,        ],        'sqs' => [            'driver' => 'sqs',            'key'    => 'your-public-key',            'secret' => 'your-secret-key',            'queue'  => 'your-queue-url',            'region' => 'us-east-1',        ],        'iron' => [            'driver'  => 'iron',            'host'    => 'mq-aws-us-east-1.iron.io',            'token'   => 'your-token',            'project' => 'your-project-id',            'queue'   => 'your-queue-name',            'encrypt' => true,        ],        'redis' => [            'driver' => 'redis',            'connection' => 'default',            'queue'  => 'default',            'expire' => 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' => [        'database' => 'mysql', 'table' => 'failed_jobs',    ],];</code>

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

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

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

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


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:laravel job 的 queue:listen 队列处理

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址