@@ -282,15 +282,40 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the
282
282
283
283
To create an admin token, use the ` influxdb3 create token --admin ` subcommand--for example:
284
284
285
+ {{% code-placeholders "INFLUXDB_HOST|CONTAINER_NAME" %}}
286
+
287
+ {{< code-tabs-wrapper >}}
288
+
289
+ {{% code-tabs %}}
290
+ [ CLI] ( # )
291
+ [ Docker] ( # )
292
+ {{% /code-tabs %}}
293
+
294
+ {{% code-tab-content %}}
285
295
``` bash
286
296
influxdb3 create token --admin \
287
- --host http://{{ < influxdb/host > }}
297
+ --host http://INFLUXDB_HOST
288
298
```
299
+ {{% /code-tab-content %}}
300
+
301
+ {{% code-tab-content %}}
302
+
289
303
``` bash
290
- # With Docker -- In a new terminal, run :
304
+ # With Docker — in a new terminal:
291
305
docker exec -it CONTAINER_NAME influxdb3 create token --admin
292
306
```
293
307
308
+ {{% /code-tab-content %}}
309
+
310
+ {{< /code-tabs-wrapper >}}
311
+
312
+ Replace the following:
313
+
314
+ - {{% code-placeholder-key %}}` INFLUXDB_HOST ` {{% /code-placeholder-key %}}: Host address of your InfluxDB 3 server (for example, ` localhost:8181 ` )
315
+ - {{% code-placeholder-key %}}` CONTAINER_NAME ` {{% /code-placeholder-key %}}: Name of your running Docker container
316
+
317
+ {{% /code-placeholders %}}
318
+
294
319
The command returns a token string that you can use to authenticate CLI commands and API requests.
295
320
296
321
After you have created an admin token, you can use it to create database tokens and system tokens.
@@ -327,8 +352,7 @@ influxdb3 create token \
327
352
```
328
353
{{% /code-placeholders %}}
329
354
330
- In your command, replace {{% code-placeholder-key %}} ` ADMIN_TOKEN ` {{% /code-placeholder-key %}}
331
- with the admin token you created earlier.
355
+ In your command, replace {{% code-placeholder-key %}} ` ADMIN_TOKEN ` {{% /code-placeholder-key %}} with the admin token you created earlier.
332
356
333
357
#### Create a system token
334
358
@@ -355,6 +379,8 @@ To create a system token, use the `influxdb3 create token` subcommand and pass t
355
379
356
380
The following example shows how to create a system token that expires in 1 year and has read permissions for all system endpoints on the server:
357
381
382
+ {{% code-placeholders "ADMIN_TOKEN" %}}
383
+
358
384
``` bash
359
385
influxdb3 create token \
360
386
--permission \
@@ -364,6 +390,9 @@ influxdb3 create token \
364
390
--name " all system endpoints" \
365
391
" system:*:read"
366
392
```
393
+ {{% /code-placeholders %}}
394
+
395
+ In your command, replace {{% code-placeholder-key %}} ` ADMIN_TOKEN ` {{% /code-placeholder-key %}} with the admin token you created earlier.
367
396
368
397
For more information, see how to [ Manage resource tokens] ( /influxdb3/version/admin/tokens/resource/ ) .
369
398
0 commit comments