mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-26 18:00:41 +00:00
feat: all in one cfg
This commit is contained in:
32
chore.md
Normal file
32
chore.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# first create table
|
||||
```bash
|
||||
mysql --host=127.0.0.1 --port=19195 --database=public;
|
||||
```
|
||||
|
||||
```sql
|
||||
CREATE TABLE IF NOT EXISTS `public`.`logsbench` (
|
||||
`greptime_timestamp` TimestampNanosecond NOT NULL TIME INDEX,
|
||||
`app` STRING NULL INVERTED INDEX,
|
||||
`cluster` STRING NULL INVERTED INDEX,
|
||||
`message` STRING NULL,
|
||||
`region` STRING NULL,
|
||||
`cloud-provider` STRING NULL,
|
||||
`environment` STRING NULL,
|
||||
`product` STRING NULL,
|
||||
`sub-product` STRING NULL,
|
||||
`service` STRING NULL
|
||||
) WITH (
|
||||
append_mode = 'true',
|
||||
'compaction.type' = 'twcs',
|
||||
'compaction.twcs.max_output_file_size' = '500MB',
|
||||
'compaction.twcs.max_active_window_files' = '16',
|
||||
'compaction.twcs.max_active_window_runs' = '4',
|
||||
'compaction.twcs.max_inactive_window_files' = '4',
|
||||
'compaction.twcs.max_inactive_window_runs' = '2',
|
||||
);
|
||||
```
|
||||
|
||||
# then ingest
|
||||
```bash
|
||||
cargo run --bin=ingester -- --input-dir="/home/discord9/greptimedb/parquet_store" --parquet-dir="." --cfg="ingester.toml" --db-http-addr="http://127.0.0.1:4000"
|
||||
```
|
||||
35
ingester.toml
Normal file
35
ingester.toml
Normal file
@@ -0,0 +1,35 @@
|
||||
## The metasrv client options.
|
||||
[meta_client]
|
||||
## The addresses of the metasrv.
|
||||
metasrv_addrs = ["127.0.0.1:3002", "127.0.0.1:3003"]
|
||||
|
||||
## Operation timeout.
|
||||
timeout = "3s"
|
||||
|
||||
## Heartbeat timeout.
|
||||
heartbeat_timeout = "500ms"
|
||||
|
||||
## DDL timeout.
|
||||
ddl_timeout = "10s"
|
||||
|
||||
## Connect server timeout.
|
||||
connect_timeout = "1s"
|
||||
|
||||
## `TCP_NODELAY` option for accepted connections.
|
||||
tcp_nodelay = true
|
||||
|
||||
## The configuration about the cache of the metadata.
|
||||
metadata_cache_max_capacity = 100000
|
||||
|
||||
## TTL of the metadata cache.
|
||||
metadata_cache_ttl = "10m"
|
||||
|
||||
# TTI of the metadata cache.
|
||||
metadata_cache_tti = "5m"
|
||||
|
||||
## The data storage options.
|
||||
[storage]
|
||||
## The working home directory.
|
||||
data_home = "/tmp/greptimedb/"
|
||||
type = "File"
|
||||
[mito]
|
||||
@@ -16,6 +16,7 @@ use clap::Parser;
|
||||
use common_time::timestamp::TimeUnit;
|
||||
use datanode::config::StorageConfig;
|
||||
use meta_client::MetaClientOptions;
|
||||
use mito2::config::MitoConfig;
|
||||
use mito2::sst::file::IndexType;
|
||||
use mito2::sst::parquet::SstInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -33,12 +34,9 @@ struct Args {
|
||||
/// Directory of input json files, relative to input_dir
|
||||
#[arg(short, long)]
|
||||
json_dir: Option<String>,
|
||||
/// Output storage config file
|
||||
/// Config file
|
||||
#[arg(short, long)]
|
||||
output_storage_config_file: String,
|
||||
/// Meta client config file
|
||||
#[arg(short, long)]
|
||||
meta_client_config_file: String,
|
||||
cfg: String,
|
||||
/// DB HTTP address
|
||||
#[arg(short, long)]
|
||||
db_http_addr: String,
|
||||
@@ -51,26 +49,26 @@ struct Args {
|
||||
sst_output_path: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
struct IngesterConfig {
|
||||
meta_client: MetaClientOptions,
|
||||
storage: StorageConfig,
|
||||
mito: MitoConfig,
|
||||
}
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
let meta_client_config = std::fs::read_to_string(&args.meta_client_config_file)
|
||||
.expect("Failed to read meta client config file");
|
||||
let meta_options: MetaClientOptions =
|
||||
toml::from_str(&meta_client_config).expect("Failed to parse meta client config");
|
||||
let cfg_file = std::fs::read_to_string(&args.cfg).expect("Failed to read config file");
|
||||
let cfg: IngesterConfig = toml::from_str(&cfg_file).expect("Failed to parse config");
|
||||
|
||||
let storage_config = std::fs::read_to_string(&args.output_storage_config_file)
|
||||
.expect("Failed to read storage config file");
|
||||
let storage_config: StorageConfig =
|
||||
toml::from_str(&storage_config).expect("Failed to parse storage config");
|
||||
|
||||
// TODO: build sst converter
|
||||
let mut sst_converter = {
|
||||
let mut builder = SstConverterBuilder::new_fs(args.input_dir)
|
||||
.with_meta_options(meta_options)
|
||||
.with_storage_config(storage_config);
|
||||
.with_meta_options(cfg.meta_client)
|
||||
.with_storage_config(cfg.storage)
|
||||
.with_config(cfg.mito);
|
||||
|
||||
if let Some(output_path) = args.sst_output_path {
|
||||
builder = builder.with_output_path(output_path);
|
||||
|
||||
Reference in New Issue
Block a user