How to know current shard id?


My database is set 24h duration for the default shard.

What influxdb query to use to know the current active shard id for given database ?

Is it safe enough to assume it is largest ‘id’ value from the queue below ?

SELECT “database”,id,retentionPolicy,seriesCreate,writeReq FROM “_internal”…“shard” WHERE time>now()-10s AND “database”=‘telegraf’ AND retentionPolicy=‘default’ AND writeReq>0
name: shard
time database id retentionPolicy seriesCreate writeReq

1528307460000000000 telegraf 820 default 206266 1530131
1528307460000000000 telegraf 945 default 281520 2556952
1528307460000000000 telegraf 949 default 168335 2229729


If you use the query SHOW SHARDS you will see a list of all shards and corresponding ids, and you will be able to identify the current active shard more easily than using the method above.


oh, right !

Thanks alot :smile:

1 Like