操作系统 : CentOS7.3.1611_x64
go语言版本:1.8.3 linux/amd64
InfluxDB版本:1.1.0
安装InfluxDB之后,在/usr/bin下会有如下几个文件:
influxd influxdb服务器 influx influxdb命令行客户端 influx_inspect 查看工具 influx_stress 压力测试工具 influx_tsm 数据库转换工具(将数据库从b1或bz1格式转换为tsm1格式)
下面简单介绍下各个工具的使用。
influxd使用方法介绍该可执行文件为InfluxDB服务器程序,参数说明如下:
[root@localhost ~]# influxd --help Configure and start an InfluxDB server. Usage: influxd [[command] [arguments]] The commands are: backup downloads a snapshot of a data node and saves it to disk config display the default configuration help display this help message restore uses a snapshot of a data node to rebuild a cluster run run node with existing configuration version displays the InfluxDB version "run" is the default command. Use "influxd [command] -help" for more information about a command.
backup参数
数据备份功能,参数如下:
[root@localhost ~]# influxd backup --help Downloads a snapshot of a data node and saves it to disk. Usage: influxd backup [flags] PATH -host <host:port> The host to connect to snapshot. Defaults to 127.0.0.1:8088. -database <name> The database to backup. -retention <name> Optional. The retention policy to backup. -shard <id> Optional. The shard id to backup. If specified, retention is required. -since <2015-12-24T08:12:23Z> Optional. Do an incremental backup since the passed in RFC3339 formatted time. backup: flag: help requested
config参数
显示InfluxDB默认参数,使用示例 :
influxd backup -host 127.0.0.1:8088 -database mydb -since 2015-12-24T08:12:23Z back1
其中,mydb为数据库名称,back1为备份文件夹。
help参数
显示帮助信息,使用示例 :influxd help
restore参数
数据恢复功能,使用该功能时,InfluxDB应当关闭。参数如下
[root@localhost ~]# influxd restore --help Uses backups from the PATH to restore the metastore, databases, retention policies, or specific shards. The InfluxDB process must not be running during a restore. Usage: influxd restore [flags] PATH -metadir <path> Optional. If set the metastore will be recovered to the given path. -datadir <path> Optional. If set the restore process will recover the specified database, retention policy or shard to the given directory. -database <name> Optional. Required if no metadir given. Will restore the database TSM files. -retention <name> Optional. If given, database is required. Will restore the retention policy's TSM files. -shard <id> Optional. If given, database and retention are required. Will restore the shard's TSM files. restore: flag: help requested
使用示例:
influxd restore -database mydb -metadir /var/lib/influxdb/meta -datadir /var/lib/influxdb/data/ back1
其中,mydb为数据库名称,back1为之前备份数据的文件夹,/var/lib/influxdb/meta为InfluxDB的meta文件夹,/var/lib/influxdb/data/为InfluxDB的data文件夹。
run参数
run为默认参数,在控制台直接输入 influxd 命令,实际上执行的是: influxd run
默认配置为INFLUXDB_CONFIG_PATH环境变量设置的的路径,或者~/.influxdb/influxdb.conf,或者 /etc/influxdb/influxdb.conf
参数说明如下:
[root@localhost tsdbBin]# influxd run --help Runs the InfluxDB server. Usage: influxd run [flags] -config <path> Set the path to the configuration file. This defaults to the environment variable INFLUXDB_CONFIG_PATH, ~/.influxdb/influxdb.conf, or /etc/influxdb/influxdb.conf if a file is present at any of these locations. Disable the automatic loading of a configuration file using the null device (such as /dev/null). -pidfile <path> Write process ID to a file. -cpuprofile <path> Write CPU profiling information to a file. -memprofile <path> Write memory usage information to a file. run: flag: help requested
使用示例 :
influxd run -config default.conf : 使用default.conf中的配置启动InfluxDB
influxd run -pidfile /tmp/test1.pid : 启动InfluxDB并在/tmp/test1.pid文件中写入pid
cpuprofile和memprofile用于InfluxDB性能分析时使用
version参数
显示版本信息,使用示例:influxd version
influx使用方法介绍该可执行文件为InfluxDB命令行客户端,参数如下: