Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2]Multi projects use queue on redis, if failed job the record go across the database. #14403

Closed
ac1982 opened this issue Jul 21, 2016 · 5 comments

Comments

@ac1982
Copy link

ac1982 commented Jul 21, 2016

I have two project on same server (Ubuntu 16.04) with different database, username and also different user_password.
But if A project's queue failed, it may insert into B project's failed-job table.
I checked the Laravel config all with default setting.
I use the supervisor keep walker.
So, anybody has the same problem and a solution for that?

@ac1982 ac1982 changed the title Multi project use queue on redis, if failed job the record go across the database. [5.2]Multi project use queue on redis, if failed job the record go across the database. Jul 21, 2016
@ac1982 ac1982 changed the title [5.2]Multi project use queue on redis, if failed job the record go across the database. [5.2]Multi projects use queue on redis, if failed job the record go across the database. Jul 21, 2016
@maxgaurav
Copy link

You need to change the prefix in config/cache.php for the projects. When creating a queue the cache system is used and it uses a namespace using this prefix, just change the prefix in both or either one of the project and the problem will be resolved.

NOTE:
Changing the prefix will mean that any existing queues/cache that exists will no longer be accessible

@GrahamCampbell
Copy link
Member

Rather than using a prefix, I'd definitely recommend using separate redis databases. Out of the box redis gives you 16, indexed 0->15. By default, laravel will select database 0.

@ac1982
Copy link
Author

ac1982 commented Jul 21, 2016

Thanks all. With different redis, it would not be happened again.

@ac1982
Copy link
Author

ac1982 commented Jul 21, 2016

@GrahamCampbell per your suggestion , I'v solve the problem, thanks. And thank @maxgaurav , I use prefix to database too. Seconds ago, I had updated the answer on https://stackoverflow.com/questions/38494053/laravel-5-2-multi-projects-use-queue-on-redis-if-failed-job-the-record-go-acros/38508731#38508731

@ryancwalsh
Copy link

@GrahamCampbell @ac1982 Unfortunately, the creator of Redis strongly recommends against using that "database" feature and says it was his worst idea: https://stackoverflow.com/a/36498590/470749

I'm still struggling to find a solution for using Redis for queues for multiple Laravel applications on a single server (like this person).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants