migrate

package
v2.0.0-beta.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2020 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package migrate provides tooling to migrate data from InfluxDB 1.x to 2.x

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SourcePath string
	DestPath   string
	DestOrg    influxdb.ID

	From            int64
	To              int64
	MigrateHotShard bool

	DryRun bool

	// Optional if you want to emit logs
	Stdout         io.Writer
	VerboseLogging bool
}

type Data

type Data struct {
	Term      uint64 // associated raft term
	Index     uint64 // associated raft index
	ClusterID uint64
	Databases []DatabaseInfo

	MaxShardGroupID uint64
	MaxShardID      uint64
}

Data represents the top level collection of all metadata.

func (*Data) UnmarshalBinary

func (data *Data) UnmarshalBinary(buf []byte) error

UnmarshalBinary decodes the object from a binary format.

type DatabaseInfo

type DatabaseInfo struct {
	Name                   string
	DefaultRetentionPolicy string
	RetentionPolicies      []RetentionPolicyInfo
}

DatabaseInfo represents information about a database in the system.

type Migrator

type Migrator struct {
	Config
	// contains filtered or unexported fields
}

A Migrator migrates TSM data from a InfluxDB 1.x to InfluxDB 2.x.

func NewMigrator

func NewMigrator(c Config) *Migrator

func (*Migrator) Process1xShard

func (m *Migrator) Process1xShard(pth string, bucketID influxdb.ID) error

Process1xShard migrates the TSM data in a single 1.x shard to the 2.x data directory.

First, the shard is checked to determine it's fully compacted. Hot shards are not migrated by default as the WAL is not processed, which could lead to data loss. Next, each TSM file contents is checked to ensure it overlaps the desired time-range, and all matching data is migrated.

func (*Migrator) Process1xShards

func (m *Migrator) Process1xShards(dbFilter, rpFilter string) error

Process1xShards migrates the contents of any matching 1.x shards.

The caller can filter shards only belonging to a retention policy and database. Providing the zero value for the filters will result in all shards being migrated, with the exception of the `_internal` database, which is never migrated unless explicitly filtered on.

type RetentionPolicyInfo

type RetentionPolicyInfo struct {
	Name               string
	ReplicaN           int
	Duration           time.Duration
	ShardGroupDuration time.Duration
}

RetentionPolicyInfo represents metadata about a retention policy.

Directories

Path Synopsis
Package meta is a generated protocol buffer package.
Package meta is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL