Skip to content

Commit

Permalink
docs: update example config for static deployment (apache#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiKaiWi authored Oct 8, 2022
1 parent a73fa0f commit b3c8cd1
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 67 deletions.
27 changes: 0 additions & 27 deletions docs/example.toml

This file was deleted.

76 changes: 38 additions & 38 deletions docs/guides/src/deploy/static_routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,29 @@ Then we should define the common part -- schema&shard declaration and routing ru

Here is the config for schema&shard declaration:
```toml
[[meta_client.cluster_view.schema_shards]]
[[static_route.topology.schema_shards]]
schema = 'public_0'
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 0
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 1
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831

[[meta_client.cluster_view.schema_shards]]
schema = 'public_1'
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards]]
schema = 'public_0'
[[static_route.topology.schema_shards.shard_views]]
shard_id = 0
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 1
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 18831
```
Expand Down Expand Up @@ -127,38 +127,38 @@ wal_path = "/tmp/ceresdb_0"
type = "Local"
data_path = "/tmp/ceresdb_0"

[[meta_client.cluster_view.schema_shards]]
[[static_route.topology.schema_shards]]
schema = 'public_0'
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 0
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 1
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831

[[meta_client.cluster_view.schema_shards]]
schema = 'public_1'
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards]]
schema = 'public_0'
[[static_route.topology.schema_shards.shard_views]]
shard_id = 0
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 1
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 18831

[[route_rules.prefix_rules]]
[[static_route.rules.prefix_rules]]
schema = 'public_0'
prefix = 'prod_'
shard = 0

[[route_rules.hash_rules]]
[[static_route.rules.hash_rules]]
schema = 'public_1'
shards = [0, 1]
```
Expand All @@ -177,38 +177,38 @@ wal_path = "/tmp/ceresdb_1"
type = "Local"
data_path = "/tmp/ceresdb_1"

[[meta_client.cluster_view.schema_shards]]
[[static_route.topology.schema_shards]]
schema = 'public_0'
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 0
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 1
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831

[[meta_client.cluster_view.schema_shards]]
schema = 'public_1'
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards]]
schema = 'public_0'
[[static_route.topology.schema_shards.shard_views]]
shard_id = 0
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 8831
[[meta_client.cluster_view.schema_shards.shard_views]]
[[static_route.topology.schema_shards.shard_views]]
shard_id = 1
[meta_client.cluster_view.schema_shards.shard_views.node]
[static_route.topology.schema_shards.shard_views.endpoint]
addr = '127.0.0.1'
port = 18831

[[route_rules.prefix_rules]]
[[static_route.rules.prefix_rules]]
schema = 'public_0'
prefix = 'prod_'
shard = 0

[[route_rules.hash_rules]]
[[static_route.rules.hash_rules]]
schema = 'public_1'
shards = [0, 1]
```
Expand All @@ -224,4 +224,4 @@ sudo docker run -d -t --name ceresdb_0 -p 5440:5440 -p 8831:8831 -v $(pwd)/confi
sudo docker run -d -t --name ceresdb_1 -p 15440:15440 -p 18831:18831 -v $(pwd)/config_1.toml:/etc/ceresdb/ceresdb.toml ceresdb/ceresdb-server:v0.1.0-alpha
```

After the two containers are created and starting running, read and write requests can be served by the two-instances CeresDB cluster.
After the two containers are created and starting running, read and write requests can be served by the two-instances CeresDB cluster.
2 changes: 1 addition & 1 deletion server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub struct RuntimeConfig {
#[derive(Clone, Debug, Default, Deserialize)]
#[serde(default)]
pub struct StaticRouteConfig {
pub rule_list: RuleList,
pub rules: RuleList,
pub topology: StaticTopologyConfig,
}

Expand Down
2 changes: 1 addition & 1 deletion src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ async fn build_in_standalone_mode<Q: Executor + 'static>(
let schema_configs = cluster_view.schema_configs.clone();
let router = Arc::new(RuleBasedRouter::new(
cluster_view,
config.static_route.rule_list.clone(),
config.static_route.rules.clone(),
));
let schema_config_provider = Arc::new(ConfigBasedProvider::new(schema_configs));

Expand Down

0 comments on commit b3c8cd1

Please sign in to comment.