示例#1
0
文件: vps.go 项目: yinqiwen/gsnova
func main() {
	ots.RegisterHandler("vstat", dumpServerStat, 0, 0, "VStat                                 Dump server stat")
	ots.RegisterHandler("sls", dumpServerSession, 0, 0, "SLS                                  List server sessions")
	ots.RegisterHandler("qls", dumpServerQueue, 0, 0, "QLS                                  List server event queues")
	err := ots.StartTroubleShootingServer(remote.ServerConf.AdminListen)
	if nil != err {
		log.Printf("Failed to start admin server with reason:%v", err)
		return
	}
	startLocalProxyServer(remote.ServerConf.Listen)
}
示例#2
0
文件: server.go 项目: yinqiwen/ssf
func startClusterServer(laddr string) error {
	os.MkdirAll(ssfCfg.ProcHome+"/ipc", 0770)
	ipcAddr := ssfCfg.ProcHome + "/ipc/" + ssfCfg.ClusterName + ".sock"
	if err := trylockFile(ipcAddr); nil != err {
		return fmt.Errorf("IPC file:%s is locked by reason:%v", ipcAddr, err)
	}
	os.Remove(ipcAddr)
	ots.RegisterHandler("ps", ps, 0, 0, "ps                                 list all processors")
	ots.RegisterHandler("cd", cd, 1, 1, "cd  <Processor>                    enter interactive mode for the processor")

	l, err := net.Listen("unix", ipcAddr)
	if nil != err {
		return err
	}
	go runServer(l)
	l, err = net.Listen("tcp", laddr)
	if nil != err {
		return err
	}
	runServer(l)
	return nil
}