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

cnosdb-imexport: cluster data export/import/migrate tool #1635

Merged
merged 4 commits into from Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion main/Cargo.toml
Expand Up @@ -9,6 +9,10 @@ edition.workspace = true
name = "cnosdb"
path = "src/main.rs"

[[bin]]
name = "cnosdb-imexport"
path = "tools/cnosdb_imexport.rs"

[dependencies]
config = { path = "../config" }
coordinator = { path = "../coordinator" }
Expand Down Expand Up @@ -81,11 +85,12 @@ backtrace = ["async-backtrace"]
prost-types = { workspace = true }
reqwest = { workspace = true }


[[example]]
name = "flight_sql_server"
path = "examples/flight_sql_server.rs"

[[example]]
name = "flight_rpc_server"
path = "examples/flight_rpc_server.rs"


17 changes: 17 additions & 0 deletions main/src/http/http_service.rs
Expand Up @@ -206,6 +206,7 @@ impl HttpService {
.or(self.write_line_protocol())
.or(self.metrics())
.or(self.print_meta())
.or(self.meta_leader_addr())
.or(self.debug_pprof())
.or(self.debug_jeprof())
.or(self.prom_remote_read())
Expand All @@ -223,6 +224,7 @@ impl HttpService {
.or(self.query())
.or(self.metrics())
.or(self.print_meta())
.or(self.meta_leader_addr())
.or(self.debug_pprof())
.or(self.debug_jeprof())
.or(self.prom_remote_read())
Expand All @@ -237,6 +239,7 @@ impl HttpService {
.or(self.write_line_protocol())
.or(self.metrics())
.or(self.print_meta())
.or(self.meta_leader_addr())
.or(self.debug_pprof())
.or(self.debug_jeprof())
.or(self.prom_remote_write())
Expand Down Expand Up @@ -619,6 +622,20 @@ impl HttpService {
)
}

fn meta_leader_addr(
&self,
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone {
warp::path!("api" / "v1" / "meta_leader")
.and(self.handle_header())
.and(self.with_coord())
.and_then(|_header: Header, coord: CoordinatorRef| async move {
match coord.meta_manager().meta_leader().await {
Ok(data) => Ok(data),
Err(err) => Err(reject::custom(HttpError::Meta { source: err })),
}
})
}

fn print_meta(
&self,
) -> impl Filter<Extract = (impl warp::Reply,), Error = warp::Rejection> + Clone {
Expand Down