{"id":20334829,"url":"https://github.com/integrii/go-redis-migrator","last_synced_at":"2025-04-11T21:51:31.836Z","repository":{"id":34757154,"uuid":"38738408","full_name":"integrii/go-redis-migrator","owner":"integrii","description":"A cluster aware Redis key migrator.  Moves keys from one cluster or host to another cluster or host.","archived":false,"fork":false,"pushed_at":"2021-07-05T07:00:41.000Z","size":53,"stargazers_count":33,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T09:48:17.304Z","etag":null,"topics":["cluster","go","migrate","redis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/integrii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-08T07:18:37.000Z","updated_at":"2025-01-06T12:51:23.000Z","dependencies_parsed_at":"2022-09-26T19:11:48.558Z","dependency_job_id":null,"html_url":"https://github.com/integrii/go-redis-migrator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Fgo-redis-migrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Fgo-redis-migrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Fgo-redis-migrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integrii%2Fgo-redis-migrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/integrii","download_url":"https://codeload.github.com/integrii/go-redis-migrator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487733,"owners_count":21112188,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cluster","go","migrate","redis"],"created_at":"2024-11-14T20:38:18.647Z","updated_at":"2025-04-11T21:51:31.813Z","avatar_url":"https://github.com/integrii.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://raw.githubusercontent.com/integrii/go-redis-migrator/master/logo.png)\n\nA cluster aware Redis key migrator.  Moves keys from one cluster or host to another cluster or host.\n\n\n## Details\nIt is possible to use the -keyFilter flag to match a subset of keys you wish to migrate. It is also possible to fetch a list of all keys with this program, create a file with a subset of keys to migrate, and then feed that list back into this program for selective migration.  This is useful if you have some keys hanging around that you do not want to migrate and want to prune during the migration.\n\ngo-redis-migrator is especially useful for populating test data in development instances, executing production migrations, or moving from a non-clustered to a clustered deployment.\n\n## Setup\n\n - Make sure you have golang installed on your operating system.\n - Make sure you have your `$GOPATH` environment variable setup properly.\n - Download it: `go get github.com/integrii/go-redis-migrator`\n - Build and install it: `go install github.com/integrii/go-redis-migrator`\n - Finally, run the binary to see the help: `$GOPATH/bin/go-redis-migrator`\n\n## Example\n\n```\n./go-redis-migrator -copyData -sourceHosts=172.31.37.164:6379,172.31.37.162:6379,172.31.37.168:6379,172.31.37.170:6379,172.31.37.169:6379 -destinationHosts=172.31.34.231:6379,172.31.34.228:6379,172.31.34.227:6379,172.31.34.230:6379,172.31.34.229:6379,172.31.34.226:6379 -keyFile=keyList.txt \nMigrated 57 keys.\n```\n\n## Speed Test\n\n```\ntime ./go-redis-migrator -sourceHosts=127.0.0.1:6379 -destinationHosts=127.0.0.1:6380 -copyData\nMigrated 22000 keys.\n\nreal\t0m3.455s\nuser\t0m0.812s\nsys\t\t0m1.475s\n```\n**6,367 keys/sec!**\n\n\n## More Examples\n\n#### Fetching all keys from a host:\n\n`./go-redis-migrator -getKeys -sourceHosts=127.0.0.1:6379`\n\n#### Fetch a filtered key list from a host:\n\n`./go-redis-migrator -getKeys -keyFilter=sessions:\\* -sourceHosts=127.0.0.1:6379`\n\n#### Fetch a filtered key list from a cluster:\n\n`./go-redis-migrator -getKeys -keyFilter=sessions:\\* -sourceHosts=127.0.0.1:6379,127.0.0.1:6380`\n\n#### From a host to a host:\n\n`./go-redis-migrator -copyData -sourceHosts=127.0.0.1:6379 -destinationHosts=192.168.0.1:6379`\n\n#### From a cluster to a cluster:\n\n`./go-redis-migrator -copyData -sourceHosts=127.0.0.1:6379,127.0.0.1:6380 -destinationHosts=192.168.0.1:6379,192.168.0.1:6380`\n\n#### From a cluster to a single host:\n\n`./go-redis-migrator -copyData -sourceHosts=127.0.0.1:6379,127.0.0.1:6380 -destinationHosts=192.168.0.1:6379`\n\n#### From a single host to a cluster:\n\n`./go-redis-migrator -copyData -sourceHosts=127.0.0.1:6379 -destinationHosts=192.168.0.1:6379,192.168.0.1:6380`\n\n#### Copying keys specified in a file from a host to a host:\n\n`./go-redis-migrator -copydata=true -sourceHosts=127.0.0.1:6379 -destinationHosts=192.168.0.1:6379 -keyFile=./onlyMoveTheseKeys.txt`\n\n\n## CLI help\nSimply run the binary to get the following help:\n```\n- Redis Key Migrator - \nhttps://github.com/integrii/go-redis-migrator\n\nMigrates all or some of the keys from a Redis host or cluster to a specified host or cluster.  Supports migrating TTLs.\ngo-redis-migrator can also be used to list the keys in a cluster.  Run with the -getKey and -sourceHosts= flags to do so.\n\nYou must run this program with an operation before it will do anything.\n\nFlags:\n  -getKeys=false: Fetches and prints keys from the source host.\n  -copyData=false: Copies all keys in a list specified by -keyFile= to the destination cluster from the source cluster.\n  -keyFile=\"\": The file path which contains the list of keys to migrate.  One per line.\n  -keyFilter=\"*\": The filter for which keys to migrate.  Does not work when -keyFile is also specified.\n  -destinationHosts=\"\": A list of source cluster host:port servers seperated by spaces. Use a single host without a ',' if there is no cluster. EX) 127.0.0.1:6379,127.0.0.1:6380\n  -sourceHosts=\"\": A list of source cluster host:port servers seperated by commas. Use a single host without a ',' if there is no cluster. EX) 127.0.0.1:6379,127.0.0.1:6380\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegrii%2Fgo-redis-migrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintegrii%2Fgo-redis-migrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegrii%2Fgo-redis-migrator/lists"}