Last active
February 20, 2025 15:35
-
-
Save hartleybrody/3d9f6a6f9ea43cbf2923ee2c6e65b140 to your computer and use it in GitHub Desktop.
Revisions
-
hartleybrody revised this gist
Aug 23, 2022 . 1 changed file with 18 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,3 +26,21 @@ redis-server --dbfilename dump.rdb docker run --rm dclg/redis-inventory inventory host.docker.internal:6379 # 4. Reclaim memory from deleted keys # if you've deleted a bunch of keys but haven't seen # memory usage drop back down yet, you can manually run # `memory purge` at the redis-cli and give it ~1hr # note that, per the docs, this only works if the # allocator is set to `jemalloc` # docs https://redis.io/commands/memory-purge/ redis-cli -u $PROD_REDIS_URL > INFO memory ... mem_allocator:jemalloc-5.1.0 ... > MEMORY PURGE -
hartleybrody revised this gist
Aug 23, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ redis-cli -u $PROD_REDIS_URL --rdb dump.rdb # 2. start your local redis-server using that # rdb snapshot file as an argument @@ -24,3 +25,4 @@ redis-server --dbfilename dump.rdb # source https://github.com/obukhov/redis-inventory docker run --rm dclg/redis-inventory inventory host.docker.internal:6379 -
hartleybrody revised this gist
Aug 23, 2022 . No changes.There are no files selected for viewing
-
hartleybrody renamed this gist
Aug 23, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hartleybrody created this gist
Aug 23, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ # 1. download a copy of prod db to localhost # connect to remote redis database and # download a snapshot of the entire database # to a local file on your filesystem # via https://stackoverflow.com/a/61365048/625840 # docs https://redis.io/docs/manual/cli/#remote-backups-of-rdb-files redis-cli -u $PROD_REDIS_URL --rdb dump.rdb # 2. start your local redis-server using that # rdb snapshot file as an argument # via https://stackoverflow.com/a/71282587/625840 redis-server --dbfilename dump.rdb # 3. BONUS! Analyze your local copy of the # production redis database using redis-inventory # via https://dclg.net/posts/2021-08-16---Redis-inventory/redis-inventory # source https://github.com/obukhov/redis-inventory docker run --rm dclg/redis-inventory inventory host.docker.internal:6379