mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-27 02:46:47 +01:00
vmctl: allow disabling binary export protocol (#4716)
Binary export API protocol can be disabled via `-vm-native-disable-binary-protocol` cmd-line flag when migrating data from VictoriaMetrics. Disabling binary protocol can be useful for deduplication of the exported data before ingestion. For this, deduplication need to be configured at `-vm-native-src-addr` side and `-vm-native-disable-binary-protocol` should be set on vmctl side. Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
6289a21d24
commit
833ab331b1
@ -325,8 +325,9 @@ const (
|
|||||||
vmNativeFilterTimeEnd = "vm-native-filter-time-end"
|
vmNativeFilterTimeEnd = "vm-native-filter-time-end"
|
||||||
vmNativeStepInterval = "vm-native-step-interval"
|
vmNativeStepInterval = "vm-native-step-interval"
|
||||||
|
|
||||||
vmNativeDisableHTTPKeepAlive = "vm-native-disable-http-keep-alive"
|
vmNativeDisableBinaryProtocol = "vm-native-disable-binary-protocol"
|
||||||
vmNativeDisableRetries = "vm-native-disable-retries"
|
vmNativeDisableHTTPKeepAlive = "vm-native-disable-http-keep-alive"
|
||||||
|
vmNativeDisableRetries = "vm-native-disable-retries"
|
||||||
|
|
||||||
vmNativeSrcAddr = "vm-native-src-addr"
|
vmNativeSrcAddr = "vm-native-src-addr"
|
||||||
vmNativeSrcUser = "vm-native-src-user"
|
vmNativeSrcUser = "vm-native-src-user"
|
||||||
@ -450,6 +451,14 @@ var (
|
|||||||
Usage: "Defines whether to disable retries with backoff policy for migration process",
|
Usage: "Defines whether to disable retries with backoff policy for migration process",
|
||||||
Value: false,
|
Value: false,
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: vmNativeDisableBinaryProtocol,
|
||||||
|
Usage: "Whether to use https://docs.victoriametrics.com/#how-to-export-data-in-json-line-format" +
|
||||||
|
"instead of https://docs.victoriametrics.com/#how-to-export-data-in-native-format API." +
|
||||||
|
"Binary export/import API protocol implies less network and resource usage, as it transfers compressed binary data blocks." +
|
||||||
|
"Non-binary export/import API is less efficient, but supports deduplication if it is configured on vm-native-src-addr side.",
|
||||||
|
Value: false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -254,6 +254,7 @@ func main() {
|
|||||||
cc: c.Int(vmConcurrency),
|
cc: c.Int(vmConcurrency),
|
||||||
disableRetries: c.Bool(vmNativeDisableRetries),
|
disableRetries: c.Bool(vmNativeDisableRetries),
|
||||||
isSilent: c.Bool(globalSilent),
|
isSilent: c.Bool(globalSilent),
|
||||||
|
isNative: !c.Bool(vmNativeDisableBinaryProtocol),
|
||||||
}
|
}
|
||||||
return p.run(ctx)
|
return p.run(ctx)
|
||||||
},
|
},
|
||||||
|
@ -34,11 +34,12 @@ type vmNativeProcessor struct {
|
|||||||
cc int
|
cc int
|
||||||
disableRetries bool
|
disableRetries bool
|
||||||
isSilent bool
|
isSilent bool
|
||||||
|
isNative bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
nativeExportAddr = "api/v1/export/native"
|
nativeExportAddr = "api/v1/export"
|
||||||
nativeImportAddr = "api/v1/import/native"
|
nativeImportAddr = "api/v1/import"
|
||||||
nativeWithBackoffTpl = `{{ blue "%s:" }} {{ counters . }} {{ bar . "[" "█" (cycle . "█") "▒" "]" }} {{ percent . }}`
|
nativeWithBackoffTpl = `{{ blue "%s:" }} {{ counters . }} {{ bar . "[" "█" (cycle . "█") "▒" "]" }} {{ percent . }}`
|
||||||
nativeSingleProcessTpl = `Total: {{counters . }} {{ cycle . "↖" "↗" "↘" "↙" }} Speed: {{speed . }} {{string . "suffix"}}`
|
nativeSingleProcessTpl = `Total: {{counters . }} {{ cycle . "↖" "↗" "↘" "↙" }} Speed: {{speed . }} {{string . "suffix"}}`
|
||||||
)
|
)
|
||||||
@ -159,9 +160,14 @@ func (p *vmNativeProcessor) runSingle(ctx context.Context, f native.Filter, srcU
|
|||||||
|
|
||||||
func (p *vmNativeProcessor) runBackfilling(ctx context.Context, tenantID string, ranges [][]time.Time, silent bool) error {
|
func (p *vmNativeProcessor) runBackfilling(ctx context.Context, tenantID string, ranges [][]time.Time, silent bool) error {
|
||||||
exportAddr := nativeExportAddr
|
exportAddr := nativeExportAddr
|
||||||
|
importAddr := nativeImportAddr
|
||||||
|
if p.isNative {
|
||||||
|
exportAddr += "/native"
|
||||||
|
importAddr += "/native"
|
||||||
|
}
|
||||||
srcURL := fmt.Sprintf("%s/%s", p.src.Addr, exportAddr)
|
srcURL := fmt.Sprintf("%s/%s", p.src.Addr, exportAddr)
|
||||||
|
|
||||||
importAddr, err := vm.AddExtraLabelsToImportPath(nativeImportAddr, p.dst.ExtraLabels)
|
importAddr, err := vm.AddExtraLabelsToImportPath(importAddr, p.dst.ExtraLabels)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to add labels to import path: %s", err)
|
return fmt.Errorf("failed to add labels to import path: %s", err)
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,7 @@ func Test_vmNativeProcessor_run(t *testing.T) {
|
|||||||
interCluster: tt.fields.interCluster,
|
interCluster: tt.fields.interCluster,
|
||||||
cc: tt.fields.cc,
|
cc: tt.fields.cc,
|
||||||
isSilent: tt.args.silent,
|
isSilent: tt.args.silent,
|
||||||
|
isNative: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := p.run(tt.args.ctx); (err != nil) != tt.wantErr {
|
if err := p.run(tt.args.ctx); (err != nil) != tt.wantErr {
|
||||||
|
@ -27,10 +27,11 @@ The following `tip` changes can be tested by building VictoriaMetrics components
|
|||||||
* FEATURE: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): add `share_eq_over_time(m[d], eq)` function for calculating the share (in the range `[0...1]`) of raw samples on the given lookbehind window `d`, which are equal to `eq`. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4441). Thanks to @Damon07 for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4725).
|
* FEATURE: [MetricsQL](https://docs.victoriametrics.com/MetricsQL.html): add `share_eq_over_time(m[d], eq)` function for calculating the share (in the range `[0...1]`) of raw samples on the given lookbehind window `d`, which are equal to `eq`. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4441). Thanks to @Damon07 for the [pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/4725).
|
||||||
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): remove deprecated in [v1.61.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.61.0) `-rule.configCheckInterval` command-line flag. Use `-configCheckInterval` command-line flag instead.
|
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): remove deprecated in [v1.61.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.61.0) `-rule.configCheckInterval` command-line flag. Use `-configCheckInterval` command-line flag instead.
|
||||||
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): remove support of deprecated web links of `/api/v1/<groupID>/<alertID>/status` form in favour of `/api/v1/alerts?group_id=<>&alert_id=<>` links. Links of `/api/v1/<groupID>/<alertID>/status` form were deprecated in v1.79.0. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2825) for details.
|
* FEATURE: [vmalert](https://docs.victoriametrics.com/vmalert.html): remove support of deprecated web links of `/api/v1/<groupID>/<alertID>/status` form in favour of `/api/v1/alerts?group_id=<>&alert_id=<>` links. Links of `/api/v1/<groupID>/<alertID>/status` form were deprecated in v1.79.0. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2825) for details.
|
||||||
|
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): allow disabling binary export API protocol via `-vm-native-disable-binary-protocol` cmd-line flag when [migrating data from VictoriaMetrics](https://docs.victoriametrics.com/vmctl.html#migrating-data-from-victoriametrics). Disabling binary protocol can be useful for deduplication of the exported data before ingestion. For this, deduplication need [to be configured](https://docs.victoriametrics.com/#deduplication) at `-vm-native-src-addr` side and `-vm-native-disable-binary-protocol` should be set on vmctl side.
|
||||||
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use local scrape timestamps for the scraped metrics unless `honor_timestamps: true` option is explicitly set at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This fixes gaps for metrics collected from [cadvisor](https://github.com/google/cadvisor) or similar exporters, which export metrics with invalid timestamps. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799) for details. The issue has been introduced in [v1.68.0](#v1680).
|
|
||||||
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): add support of `week` step for [time-based chunking migration](https://docs.victoriametrics.com/vmctl.html#using-time-based-chunking-of-migration). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4738).
|
* FEATURE: [vmctl](https://docs.victoriametrics.com/vmctl.html): add support of `week` step for [time-based chunking migration](https://docs.victoriametrics.com/vmctl.html#using-time-based-chunking-of-migration). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4738).
|
||||||
* BUGFIX: [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html): fix panic when creating a backup to a local filesystem on Windows. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4704).
|
|
||||||
|
* BUGFIX: [vmbackupmanager](https://docs.victoriametrics.com/vmbackupmanager.html): fix panic when creating a backup to a local filesystem on Windows. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4704).
|
||||||
|
* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): use local scrape timestamps for the scraped metrics unless `honor_timestamps: true` option is explicitly set at [scrape_config](https://docs.victoriametrics.com/sd_configs.html#scrape_configs). This fixes gaps for metrics collected from [cadvisor](https://github.com/google/cadvisor) or similar exporters, which export metrics with invalid timestamps. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697) and [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4697#issuecomment-1654614799) for details. The issue has been introduced in [v1.68.0](#v1680).
|
||||||
|
|
||||||
|
|
||||||
## [v1.92.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.92.1)
|
## [v1.92.1](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.92.1)
|
||||||
|
Loading…
Reference in New Issue
Block a user