InfluxDB使用方法详解(2)

[root@localhost ~]# influx --help Usage of influx: -version Display the version and exit. -host 'host name' Host to connect to. -port 'port #' Port to connect to. -database 'database name' Database to connect to the server. -password 'password' Password to connect to the server. Leaving blank will prompt for password (--password ''). -username 'username' Username to connect to the server. -ssl Use https for requests. -unsafeSsl Set this when connecting to the cluster using https and not use SSL verification. -execute 'command' Execute command and quit. -format 'json|csv|column' Format specifies the format of the server responses: json, csv, or column. -precision 'rfc3339|h|m|s|ms|u|ns' Precision specifies the format of the timestamp: rfc3339, h, m, s, ms, u or ns. -consistency 'any|one|quorum|all' Set write consistency level: any, one, quorum, or all -pretty Turns on pretty print for the json format. -import Import a previous database export from file -pps How many points per second the import will allow. By default it is zero and will not throttle importing. -path Path to file to import -compressed Set to true if the import file is compressed Examples: # Use influx in a non-interactive mode to query the database "metrics" and pretty print json: $ influx -database 'metrics' -execute 'select * from cpu' -format 'json' -pretty # Connect to a specific database on startup and set database context: $ influx -database 'metrics' -host 'localhost' -port '8086' [root@localhost ~]#

使用示例:

influx :直接连接本机的8086端口

influx -version :显示版本信息并退出

influx -database 'mydb' -execute 'select * from cpu_load' : 执行单条指令并退出

influx_inspect使用方法介绍

该可执行文件为InfluxDB查看工具,参数如下:

[root@localhost ~]# influx_inspect help Usage: influx_inspect [[command] [arguments]] The commands are: dumptsm dumps low-level details about tsm1 files. export exports raw data from a shard to line protocol help display this help message report displays a shard level report "help" is the default command. Use "influx_inspect [command] -help" for more information about a command. [root@localhost ~]#

dumptsm参数

解析tsm文件,参数如下:

[root@localhost ~]# influx_inspect dumptsm --help Dumps low-level details about tsm1 files. Usage: influx_inspect dumptsm [flags] <path -index Dump raw index data -blocks Dump raw block data -all Dump all data. Caution: This may print a lot of information -filter-key <name> Only display index and block data match this key substring [root@localhost ~]#

使用示例:

[root@localhost ~]# influx_inspect dumptsm -all /var/lib/influxdb/data/mydb/autogen/12/000000004-000000003.tsm Summary: File: /var/lib/influxdb/data/mydb/autogen/12/000000004-000000003.tsm Time Range: 2017-05-23T09:10:10.202006046Z - 2017-05-23T11:10:27.319302712Z Duration: 2h0m17.117296666s Series: 1 File Size: 325 Index: Pos Min Time Max Time Ofs Size Key Field 1 2017-05-23T09:10:10.202006046Z 2017-05-23T09:14:50.532248441Z 5 41 cpu_load,host=server_1,region=us-west value 2 2017-05-23T09:26:34.541091603Z 2017-05-23T09:26:34.541091603Z 46 34 cpu_load,host=server_1,region=us-west value 3 2017-05-23T10:59:10.72052295Z 2017-05-23T10:59:10.72052295Z 80 34 cpu_load,host=server_1,region=us-west value 4 2017-05-23T11:10:02.987617654Z 2017-05-23T11:10:27.319302712Z 114 40 cpu_load,host=server_1,region=us-west value Blocks: Blk Chk Ofs Len Type Min Time Points Enc [T/V] Len [T/V] 0 1091651936 5 37 float64 2017-05-23T09:10:10.202006046Z 2 rle/gor 16/19 1 1782732741 46 30 float64 2017-05-23T09:26:34.541091603Z 1 s8b/gor 9/19 2 2962666225 121 30 float64 2017-05-23T10:59:10.72052295Z 1 s8b/gor 9/19 3 1165672455 230 36 float64 2017-05-23T11:10:02.987617654Z 2 rle/gor 15/19 Statistics Blocks: Total: 4 Size: 149 Min: 30 Max: 37 Avg: 37 Index: Total: 4 Size: 163 Points: Total: 6 Encoding: Timestamp: none: 0 (0%) s8b: 2 (50%) rle: 2 (50%) Float: none: 0 (0%) gor: 4 (100%) Compression: Per block: 24.83 bytes/point Total: 54.17 bytes/point [root@localhost ~]#

export参数

使用示例:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/a36232cf16a212d50a93cb0819ffd2ec.html