From 69d51487290e894497b3e8ea364226c13d8b5232 Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Fri, 16 Dec 2022 12:54:43 +0100 Subject: [PATCH] fix(ingester2): Make ingester2 work with existing catalogs and document quickstart --- ingester2/README.md | 35 +++++++++++++++++++++++++++++++++++ ingester2/src/init.rs | 9 +++------ 2 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 ingester2/README.md diff --git a/ingester2/README.md b/ingester2/README.md new file mode 100644 index 0000000000..85f5fc5357 --- /dev/null +++ b/ingester2/README.md @@ -0,0 +1,35 @@ +# ingester2 + +## Quick run + +Set-up empty catalog db: + +```bash +mkdir -p /tmp/iox/{wal,obj} + +createdb iox_shared +./target/debug/influxdb_iox catalog setup --catalog-dsn postgres:///iox_shared + +# there has to exist one "topic", see https://github.com/influxdata/influxdb_iox/issues/6420 +psql 'dbname=iox_shared options=-csearch_path=public,iox_catalog' -c "insert into topic (name) values ('iox-shared')" +``` + + +Run ingester2: + +```bash +INFLUXDB_IOX_RPC_MODE=2 ./target/debug/influxdb_iox run ingester2 --api-bind=127.0.0.1:8081 --grpc-bind=127.0.0.1:8042 --wal-directory /tmp/iox/wal --catalog-dsn postgres:///iox_shared --object-store=file --data-dir=/tmp/iox/obj -v +``` + +Run router2: + +```bash +INFLUXDB_IOX_RPC_MODE=2 ./target/debug/influxdb_iox run router2 --api-bind=127.0.0.1:8080 --grpc-bind=127.0.0.1:8085 --ingester-addresses=127.0.0.1:8042 --catalog-dsn postgres:///iox_shared -v +``` + +Run querier: + +```bash +INFLUXDB_IOX_RPC_MODE=2 ./target/debug/influxdb_iox run querier --ingester-addresses=http://127.0.0.1:8042 --api-bind 127.0.0.1:8083 --grpc-bind 127.0.0.1:8082 --catalog-dsn postgres:///iox_shared --object-store=file --data-dir=/tmp/iox/obj -v +``` + diff --git a/ingester2/src/init.rs b/ingester2/src/init.rs index be032b2ae9..9c239810d5 100644 --- a/ingester2/src/init.rs +++ b/ingester2/src/init.rs @@ -164,16 +164,13 @@ pub async fn new( .expect("start transaction"); let topic = txn .topics() - .get_by_name("iox-shared") + .create_or_get("iox-shared") .await - .expect("get topic") - .unwrap(); - let s = txn - .shards() + .expect("get topic"); + txn.shards() .create_or_get(&topic, TRANSITION_SHARD_INDEX) .await .expect("create transition shard"); - assert_eq!(s.id, TRANSITION_SHARD_ID); txn.commit().await.expect("commit transition shard"); // Initialise the deferred namespace name resolver.