Exemple #1
0
func main() {
	flag.Parse()
	servenv.Init()
	defer servenv.Close()

	unmarshalFile(*dbConfigFile, &dbconfig)
	log.Infof("dbconfig: %s\n", dbconfig)

	unmarshalFile(*overridesFile, &schemaOverrides)
	data, _ := json.MarshalIndent(schemaOverrides, "", "  ")
	log.Infof("schemaOverrides: %s\n", data)

	ts.InitQueryService()

	ts.AllowQueries(dbconfig, schemaOverrides, ts.LoadCustomRules())

	servenv.ServeRPC()

	log.Infof("starting vtocc %v", *port)
	s := proc.ListenAndServe(fmt.Sprintf("%v", *port))

	// A SIGUSR1 means that we're restarting
	if s == syscall.SIGUSR1 {
		// Give some time for the other process
		// to pick up the listeners
		time.Sleep(5 * time.Millisecond)
		ts.DisallowQueries(true)
	} else {
		ts.DisallowQueries(false)
	}
}
Exemple #2
0
// zkocc: a proxy for zk
func main() {
	flag.Parse()
	servenv.Init()
	defer servenv.Close()

	servenv.ServeRPC()
	zkr := zkocc.NewZkReader(*resolveLocal, flag.Args())
	zk.RegisterZkReader(zkr)

	topo.RegisterTopoReader(&TopoReader{zkr: zkr})

	proc.ListenAndServe(fmt.Sprintf("%v", *port))
}
func main() {
	flag.Parse()
	servenv.Init()
	defer servenv.Close()

	if *mycnfFile == "" {
		log.Fatalf("Please specify the path for mycnf file.")
	}
	mycnf, err := mysqlctl.ReadMycnf(*mycnfFile)
	if err != nil {
		log.Fatalf("Error reading mycnf file %v", *mycnfFile)
	}

	binlogServer := mysqlctl.NewBinlogServer(mycnf)
	mysqlctl.EnableBinlogServerService(binlogServer, *dbname)

	proto.RegisterBinlogServer(binlogServer)
	rpcwrap.RegisterAuthenticated(binlogServer)

	servenv.ServeRPC()

	proc.ListenAndServe(fmt.Sprintf("%v", *port))
	mysqlctl.DisableBinlogServerService(binlogServer)
}