说明
版本信息 |
InfluxDB v1.7.2 (git: 1.7 76f907b0fada2f16931e37471da695349fcdf8c6) |
Git地址 |
|
官方文档 |
|
安装方式 |
使用docker安装本地使用:docker pull influxdb |
启动命令
使用influxd来完成InfluxDB数据库的启动,启动命令如下:
influxd run -pidfile /var/log/influxdb/pidfile.log -cpuprofile /var/log/influxdb/cpuprofile.log -memprofile /var/log/influxdb/memprofile.log
influxd命令说明
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.
root@c6239814501a:/var/log/influxdb# 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.
代码分析
入口
Influxdb的启动代码实现在 cmd/influxd/main.go中
// influxdb数据库服务启动入口
func main() {
rand.Seed(time.Now().UnixNano())
m := NewMain() //定义输出方式(日志使用标准输出完成)
if err := m.Run(os.Args[1:]...); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
// Main represents the program execution.
type Main