How do sidekiq jobs get re-created after a restore?

AI-generated summary

The discussion revolves around moving a site’s PostgreSQL and Redis servers to a different machine, focusing on preserving Sidekiq jobs during the transition. pfaffman is concerned about the hundreds of queued Sidekiq jobs (e.g., ToggleTopicClosed, UnpinTopic) and whether they will be restored after a Redis database move. DBHacker suggests using Redis commands like BGSAVE or SAVE to create a snapshot (dump.rdb) of the Redis database, which can then be copied to the new server. However, pfaffman clarifies that this method saves all Redis databases, which is problematic since other sites have already moved to the new server and a full database backup is not feasible. The core issue is how to restore only the specific Redis database containing the Sidekiq jobs without affecting others, and whether Sidekiq jobs will be recreated after the restore.

I want to move a site’s postgres and redis servers to a different machine. Moving postgres is fairly straightforward. But there are several hundred jobs queued in sidekiq (ToggleTopicClosed and UnpinTopic at least mostly). There doesn’t seem to be a straightforward way to move a redis database (you can copy the whole of redis, but that’s no good to move just a single numbered database). If I do a full backup/restore, will those jobs get created? And if they will, can I kick that off by hand some easy way once the move is complete?

Or do I decide not to care about those queued jobs? (That doesn’t seem very nice :thinking:)

You can save a snapshot of the Redis database to dump.rdb by executing BGSAVE or SAVE from the command line.

This Redix command will create a new file named dump.rdb in the same folder as Redis.

Then, you can copy dump.rdb to another other server running Redis.

Then when Redis starts on the new server, it will look for dump.rdb to initialize Redis.

Not sure about how sidekiq will update after restoring Redis, but seems worth a try.

Right, but my understanding is that doing that saves ALL databases on the server, not just the one. Other sites have already moved to the other server, so backup/restore of all databases isn’t an option.