本文主要是介绍02.InfluxDB系统化学习-InfluxDB初始化,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
说明
版本信息 | InfluxDB v1.7.2 (git: 1.7 76f907b0fada2f16931e37471da695349fcdf8c6) |
Git地址 | https://github.com/influxdata/influxdb |
官方文档 | https://docs.influxdata.com/influxdb/v1.7/ |
安装方式 | 使用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 diskconfig display the default configurationhelp display this help messagerestore uses a snapshot of a data node to rebuild a clusterrun run node with existing configurationversion 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 fileis present at any of these locations.Disable the automatic loading of a configuration file usingthe 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 struct {Stdin io.Read
这篇关于02.InfluxDB系统化学习-InfluxDB初始化的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!