-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split clickhouse admin server (#6837)
- Loading branch information
1 parent
4d17944
commit e634215
Showing
32 changed files
with
913 additions
and
487 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! Executable program to run the Omicron ClickHouse admin interface for | ||
//! clickhouse servers. | ||
|
||
use anyhow::anyhow; | ||
use camino::Utf8PathBuf; | ||
use clap::Parser; | ||
use omicron_clickhouse_admin::{ClickhouseCli, Clickward, Config}; | ||
use omicron_common::cmd::fatal; | ||
use omicron_common::cmd::CmdError; | ||
use std::net::{SocketAddr, SocketAddrV6}; | ||
|
||
#[derive(Debug, Parser)] | ||
#[clap( | ||
name = "clickhouse-admin-server", | ||
about = "Omicron ClickHouse cluster admin server for replica servers" | ||
)] | ||
enum Args { | ||
/// Start the ClickHouse admin server | ||
Run { | ||
/// Address on which this server should run | ||
#[clap(long, short = 'a', action)] | ||
http_address: SocketAddrV6, | ||
|
||
/// Path to the server configuration file | ||
#[clap(long, short, action)] | ||
config: Utf8PathBuf, | ||
|
||
/// Address on which the clickhouse server or keeper is listening on | ||
#[clap(long, short = 'l', action)] | ||
listen_address: SocketAddrV6, | ||
|
||
/// Path to the clickhouse binary | ||
#[clap(long, short, action)] | ||
binary_path: Utf8PathBuf, | ||
}, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
if let Err(err) = main_impl().await { | ||
fatal(err); | ||
} | ||
} | ||
|
||
async fn main_impl() -> Result<(), CmdError> { | ||
let args = Args::parse(); | ||
|
||
match args { | ||
Args::Run { http_address, config, listen_address, binary_path } => { | ||
let mut config = Config::from_file(&config) | ||
.map_err(|err| CmdError::Failure(anyhow!(err)))?; | ||
config.dropshot.bind_address = SocketAddr::V6(http_address); | ||
let clickward = Clickward::new(); | ||
let clickhouse_cli = | ||
ClickhouseCli::new(binary_path, listen_address); | ||
|
||
let server = omicron_clickhouse_admin::start_server_admin_server( | ||
clickward, | ||
clickhouse_cli, | ||
config, | ||
) | ||
.await | ||
.map_err(|err| CmdError::Failure(anyhow!(err)))?; | ||
server.await.map_err(|err| { | ||
CmdError::Failure(anyhow!( | ||
"server failed after starting: {err}" | ||
)) | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.