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

Update the password-value method #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,37 +37,47 @@ a Github Account might be required / bandwidth costs might be applicable.
```
$ ./bin/redis-dump-go -h
Usage of ./bin/redis-dump-go:
-batchSize int
-batchSize int
HSET/RPUSH/SADD/ZADD only add 'batchSize' items at a time (default 1000)
-db uint
only dump this database (default: all databases)
-filter string
Key filter to use (default "*")
-host string
Server host (default "127.0.0.1")
-n int
Parallel workers (default 10)
-noscan
Use KEYS * instead of SCAN - for Redis <=2.8
-output string
Output type - can be resp or commands (default "resp")
-port int
Server port (default 6379)
-s Silent mode (disable logging of progress / stats)
-ttl
Preserve Keys TTL (default true)
-cacert string
CA Certificate file to verify with
-cert string
Private key file to authenticate with
-db int
only dump this database (default: all databases) (default -1)
-filter string
Key filter to use (default "*")
-h show help information
-host string
Server host (default "127.0.0.1")
-insecure
Allow insecure TLS connection by skipping cert validation
-key string
SSL private key file path
-n int
Parallel workers (default 10)
-noscan
Use KEYS * instead of SCAN - for Redis <=2.8
-output string
Output type - can be resp or commands (default "resp")
-password string
Password
-port int
Server port (default 6379)
-s Silent mode (disable logging of progress / stats)
-tls
Establish a secure TLS connection
-ttl
Preserve Keys TTL (default true)
-user string
Username

$ ./bin/redis-dump-go > dump.resp
Database 0: 9 element dumped
Database 1: 1 element dumped
```

For password-protected Redis servers, set the shell variable REDISDUMPGO\_AUTH:

```
$ export REDISDUMPGO_AUTH=myRedisPassword
$ redis-dump-go
```

## Build

Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ func realMain() int {
log.Fatalf("Failed parsing parameter flag: can only be resp or json")
}

redisPassword := os.Getenv("REDISDUMPGO_AUTH")

progressNotifs := make(chan redisdump.ProgressNotification)
var wg sync.WaitGroup
wg.Add(1)
Expand Down Expand Up @@ -113,7 +111,7 @@ func realMain() int {
Host: c.Host,
Port: c.Port,
Username: c.Username,
Password: redisPassword,
Password: c.Password,
TlsHandler: tlshandler,
}

Expand Down
2 changes: 2 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Config struct {
Port int
Db int
Username string
Password string
Filter string
Noscan bool
BatchSize int
Expand Down Expand Up @@ -47,6 +48,7 @@ func FromFlags(progName string, args []string) (Config, string, error) {
flags.IntVar(&c.Port, "port", 6379, "Server port")
flags.IntVar(&c.Db, "db", -1, "only dump this database (default: all databases)")
flags.StringVar(&c.Username, "user", "", "Username")
flags.StringVar(&c.Password, "password", "", "Password")
flags.StringVar(&c.Filter, "filter", "*", "Key filter to use")
flags.BoolVar(&c.Noscan, "noscan", false, "Use KEYS * instead of SCAN - for Redis <=2.8")
flags.IntVar(&c.BatchSize, "batchSize", 1000, "HSET/RPUSH/SADD/ZADD only add 'batchSize' items at a time")
Expand Down