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

Added thanos bucket replicate #2113

Merged
merged 14 commits into from
Feb 26, 2020
Merged

Added thanos bucket replicate #2113

merged 14 commits into from
Feb 26, 2020

Conversation

daixiang0
Copy link
Member

@daixiang0 daixiang0 commented Feb 10, 2020

Signed-off-by: Xiang Dai 764524258@qq.com

Implement thanos-replicate to support replicate from one object storage to another.

TODO:

  • I added CHANGELOG entry for this change.
  • Add document for replcate.
  • Add mixin about replcate.

@daixiang0 daixiang0 changed the title [WIP] bucket: Implement replcate [WIP] bucket: Implement replicate Feb 10, 2020
@daixiang0 daixiang0 changed the title [WIP] bucket: Implement replicate [WIP] Bucket: Implement replicate Feb 10, 2020
@yeya24
Copy link
Contributor

yeya24 commented Feb 10, 2020

Hmm, do we plan to add thanos-replicate here?

@daixiang0
Copy link
Member Author

Yep, here is a discuss in the slack.

@yeya24
Copy link
Contributor

yeya24 commented Feb 11, 2020

Yep, here is a discuss in the slack.

Thanks for clarifying 😄

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, it looks almost ready!

👍

cc @brancz

CHANGELOG.md Outdated Show resolved Hide resolved
cmd/thanos/bucket.go Outdated Show resolved Hide resolved
cmd/thanos/bucket.go Outdated Show resolved Hide resolved
docs/components/bucket.md Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
pkg/replicater/scheme.go Outdated Show resolved Hide resolved
pkg/replicater/scheme.go Outdated Show resolved Hide resolved
cmd/thanos/bucket.go Outdated Show resolved Hide resolved
@daixiang0 daixiang0 changed the title [WIP] Bucket: Implement replicate Bucket: Implement replicate Feb 12, 2020
@daixiang0 daixiang0 changed the title Bucket: Implement replicate Bucket: Added thanos bucket replicate Feb 12, 2020
@daixiang0 daixiang0 changed the title Bucket: Added thanos bucket replicate Added thanos bucket replicate Feb 12, 2020
cmd/thanos/bucket.go Outdated Show resolved Hide resolved
pkg/replicater/scheme.go Outdated Show resolved Hide resolved
cmd/thanos/bucket.go Outdated Show resolved Hide resolved
cmd/thanos/bucket.go Outdated Show resolved Hide resolved
pkg/replicator/scheme.go Outdated Show resolved Hide resolved
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Few suggestions and LGTM ❤️

Good work!

Also cc @brancz for quick look, as he initially wrote this. 💪

cmd := root.Command("replicate", fmt.Sprintf("Replicate data from one object storage to another. NOTE: Currently it works only with Thanos blocks (%v has to have Thanos metadata).", block.MetaFilename))
httpMetricsBindAddr, _ := regHTTPFlags(cmd)
toObjStoreConfig := regCommonObjStoreFlags(cmd, "-to", false, "The object storage which replicate data to.")
resolution := cmd.Flag("resolution", "Only blocks with this resolution will be replicated.").Default(strconv.FormatInt(downsample.ResLevel0, 10)).HintAction(listResLevel).Int64()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I think we might need actually Int64s for it as we might want to replicate more than one resolution. Let's add TODO for now.

Also resolution-level ?

Suggested change
resolution := cmd.Flag("resolution", "Only blocks with this resolution will be replicated.").Default(strconv.FormatInt(downsample.ResLevel0, 10)).HintAction(listResLevel).Int64()
// TODO(bwplotka): Allow to replicate many compaction levels.
resolution := cmd.Flag("resolution-level", "Only blocks with this resolution will be replicated.").Default(strconv.FormatInt(downsample.ResLevel0, 10)).HintAction(listResLevel).Int64()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not resolved

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact it does.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? I proposed resolution-level (: I might be wrong, but you should comment that I am wrong, because of X not ignore it. But I am pretty sure you just did not notice (:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that you mean add more level support for both resolution and compaction, so i added two TODOs here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kinpin supports Int but not Int64, so still need to use String here.

cmd/thanos/bucket.go Show resolved Hide resolved
pkg/replicator/scheme.go Outdated Show resolved Hide resolved
pkg/replicator/replicater.go Outdated Show resolved Hide resolved
Signed-off-by: Xiang Dai <764524258@qq.com>
Signed-off-by: Xiang Dai <764524258@qq.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments are still not addressed but was marked as addressed.

cmd := root.Command("replicate", fmt.Sprintf("Replicate data from one object storage to another. NOTE: Currently it works only with Thanos blocks (%v has to have Thanos metadata).", block.MetaFilename))
httpMetricsBindAddr, _ := regHTTPFlags(cmd)
toObjStoreConfig := regCommonObjStoreFlags(cmd, "-to", false, "The object storage which replicate data to.")
resolution := cmd.Flag("resolution", "Only blocks with this resolution will be replicated.").Default(strconv.FormatInt(downsample.ResLevel0, 10)).HintAction(listResLevel).Int64()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not resolved

cmd/thanos/bucket.go Show resolved Hide resolved
mixin/thanos/dashboards/replicate.libsonnet Outdated Show resolved Hide resolved
@daixiang0
Copy link
Member Author

daixiang0 commented Feb 19, 2020

@bwplotka hi, i do not understand why those codes are old when you review, they were resolved.
Now, i have confirmed them again. For mixin part, i am still working on it.

@bwplotka
Copy link
Member

bwplotka commented Feb 19, 2020 via email

Signed-off-by: Xiang Dai <764524258@qq.com>
@brancz
Copy link
Member

brancz commented Feb 20, 2020

Can you mark this PR as work in progress until it’s reviewable in its entirety? Thanks! :)

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that bothers me, is the namespacing of the sub-subcommand. I think all the references to this have to be under bucket replicate from docs, dashboards and alerts. Otherwise, it could create confusion.

CHANGELOG.md Outdated Show resolved Hide resolved
@daixiang0 daixiang0 changed the title Added thanos bucket replicate [WIP] Added thanos bucket replicate Feb 21, 2020
Signed-off-by: Xiang Dai <764524258@qq.com>
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

Signed-off-by: Xiang Dai <764524258@qq.com>
Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@daixiang0 daixiang0 changed the title [WIP] Added thanos bucket replicate Added thanos bucket replicate Feb 25, 2020
Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Amazing! LGTM ❤️

@bwplotka bwplotka merged commit 0f6df8b into thanos-io:master Feb 26, 2020
@@ -29,6 +29,7 @@ We use *breaking* word for marking changes that are not backward compatible (rel
- [#2049](https://github.com/thanos-io/thanos/pull/2049) Tracing: Support sampling on Elastic APM with new sample_rate setting.
- [#2008](https://github.com/thanos-io/thanos/pull/2008) Querier, Receiver, Sidecar, Store: Add gRPC [health check](https://github.com/grpc/grpc/blob/master/doc/health-checking.md) endpoints.
- [#2145](https://github.com/thanos-io/thanos/pull/2145) Tracing: track query sent to prometheus via remote read api.
- [#2113](https://github.com/thanos-io/thanos/pull/2113) Bucket: Added `thanos bucket replicate`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It got into wrong release section, so we need to be careful when merging release-0.11 to master @metalmatze

@daixiang0 daixiang0 deleted the repl branch February 27, 2020 01:46
vankop pushed a commit to monitoring-tools/thanos that referenced this pull request Feb 28, 2020
* bucket: Implement replcate

Signed-off-by: Xiang Dai <764524258@qq.com>

* Document replicate

Signed-off-by: Xiang Dai <764524258@qq.com>

* feedback

Signed-off-by: Xiang Dai <764524258@qq.com>

* feedback

Signed-off-by: Xiang Dai <764524258@qq.com>

* remove version check

Signed-off-by: Xiang Dai <764524258@qq.com>

* update CHANGLOG

Signed-off-by: Xiang Dai <764524258@qq.com>

* add chan for SIGHUP

Signed-off-by: Xiang Dai <764524258@qq.com>

* add existence check

Signed-off-by: Xiang Dai <764524258@qq.com>

* Add mixin

Signed-off-by: Xiang Dai <764524258@qq.com>

* rename as replicate

Signed-off-by: Xiang Dai <764524258@qq.com>

* feedback

Signed-off-by: Xiang Dai <764524258@qq.com>

* update mixin

Signed-off-by: Xiang Dai <764524258@qq.com>

* update CHANGLOG

Signed-off-by: Xiang Dai <764524258@qq.com>

* add bucket prefix

Signed-off-by: Xiang Dai <764524258@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants