Skip to content
This repository was archived by the owner on Aug 22, 2022. It is now read-only.

allow dumps of specific series names (avoids treating continuous queries as series) #5

Open
wants to merge 3 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Utility tools to backup and restore InfluxDB databases.
You need a Go development environment. To install to `$GOPATH/bin` do:

```sh
$ go get github.com/eckardt/influxdb-backup/...
$ go get github.com/Abramovic/influxdb-backup/...
```

## Usage
Expand Down
9 changes: 7 additions & 2 deletions influxdb-dump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

type ClientConfig struct {
*influxdb.ClientConfig
Series string
Destination string
}

Expand All @@ -20,11 +21,12 @@ type Client struct {
}

func parseFlags() (*ClientConfig) {
config := &ClientConfig{&influxdb.ClientConfig{}, ""}
config := &ClientConfig{&influxdb.ClientConfig{}, "", ""}
flag.StringVar(&config.Host, "host", "localhost:8086", "host to connect to")
flag.StringVar(&config.Username, "username", "root", "username to authenticate as")
flag.StringVar(&config.Password, "password", "root", "password to authenticate with")
flag.StringVar(&config.Database, "database", "", "database to dump")
flag.StringVar(&config.Series, "series", "-", "series to dump")
flag.StringVar(&config.Destination, "out", "-", "output file (default to stdout)")
flag.BoolVar(&config.IsSecure, "https", false, "connect via https")
flag.Parse()
Expand All @@ -33,6 +35,9 @@ func parseFlags() (*ClientConfig) {
flag.Usage()
os.Exit(1)
}
if config.Series == "" || config.Series == "-"{
config.Series = "/.*/"
}
return config
}

Expand All @@ -57,7 +62,7 @@ func (self *Client) DumpSeries() {
} else {
file = os.Stdout
}
err = self.QueryStream("SELECT * FROM /.*/", file)
err = self.QueryStream("SELECT * FROM " + self.Series, file)
if err != nil {
log.Fatal(err)
}
Expand Down