func RegisterEtc(etcServers []string) error { err := etclib.Dial(etcServers) if err != nil { return err } err = etclib.BootService(localAddr, etclib.SERVICE_GCOLLECTOR) return err }
func RegisterEtc() error { err := etclib.Dial(config.PushdConf.EtcServers) if err != nil { return err } err = etclib.BootService(config.PushdConf.S2sListenAddr, etclib.SERVICE_PUSHD) return err }
func init() { parseFlags() if options.concurrency != 0 { runtime.GOMAXPROCS(options.concurrency) } if options.showVersion { server.ShowVersionAndExit() } conf := server.LoadConfig(options.configFile) GcollectorConf = new(GcollectorConfig) GcollectorConf.LoadConfig(conf) if options.kill { if err := server.KillProcess(options.lockFile); err != nil { fmt.Fprintf(os.Stderr, "stop failed: %s\n", err) os.Exit(1) } etclib.Dial(GcollectorConf.EtcServers) loadLocalAddr() UnregisterEtc() os.Exit(0) } server.SetupLogging(options.logFile, options.logLevel, options.crashLogFile) if options.lockFile != "" { if locking.InstanceLocked(options.lockFile) { fmt.Fprintf(os.Stderr, "Another gcollector is running, exit...\n") os.Exit(1) } locking.LockInstance(options.lockFile) } signal.RegisterSignalHandler(syscall.SIGINT, func(sig os.Signal) { shutdown() }) err := RegisterEtc(GcollectorConf.EtcServers) if err != nil { panic(err) } GcollectorConf.LoadForwarder(conf) rand.Seed(time.Now().UnixNano()) }