示例#1
0
func init() {
	zconn := zk.NewMetaConn(false)
	zkts := zktopo.NewServer(zconn)
	zkoccconn := zk.NewMetaConn(true)
	zktsro := zktopo.NewServer(zkoccconn)
	db.Register("vtdb", &sDriver{zkts, false})
	db.Register("vtdb-zkocc", &sDriver{zktsro, false})
	db.Register("vtdb-streaming", &sDriver{zkts, true})
	db.Register("vtdb-zkocc-streaming", &sDriver{zktsro, true})
	db.Register("vtdb-streaming-zkocc", &sDriver{zktsro, true})
}
示例#2
0
func main() {
	defer exit.Recover()
	defer logutil.Flush()

	zknsDomain := flag.String("zkns-domain", "", "The naming hierarchy portion to serve")
	zknsRoot := flag.String("zkns-root", "", "The root path from which to resolve")
	bindAddr := flag.String("bind-addr", ":31981", "Bind the debug http server")
	flag.Parse()

	if *bindAddr != "" {
		go func() {
			err := http.ListenAndServe(*bindAddr, nil)
			if err != nil {
				log.Errorf("ListenAndServe: %s", err)
				exit.Return(1)
			}
		}()
	}

	zconn := zk.NewMetaConn()
	fqdn := netutil.FullyQualifiedHostnameOrPanic()
	zr1 := newZknsResolver(zconn, fqdn, *zknsDomain, *zknsRoot)
	pd := &pdns{zr1}
	pd.Serve(os.Stdin, os.Stdout)
	os.Stdout.Close()
}
示例#3
0
文件: sharded.go 项目: kingpro/vitess
func RegisterShardedDrivers() {
	// default topo server
	ts := topo.GetServer()
	db.Register("vtdb", &sDriver{ts, false})
	db.Register("vtdb-streaming", &sDriver{ts, true})

	// forced zk topo server
	zconn := zk.NewMetaConn(false)
	zkts := zktopo.NewServer(zconn)
	db.Register("vtdb-zk", &sDriver{zkts, false})
	db.Register("vtdb-zk-streaming", &sDriver{zkts, true})

	// forced zkocc topo server
	zkoccconn := zk.NewMetaConn(true)
	zktsro := zktopo.NewServer(zkoccconn)
	db.Register("vtdb-zkocc", &sDriver{zktsro, false})
	db.Register("vtdb-zkocc-streaming", &sDriver{zktsro, true})
}
示例#4
0
文件: zkcmd.go 项目: CowLeo/vitess
func init() {
	cmdMap = map[string]cmdFunc{
		"cat":   cmdCat,
		"chmod": cmdChmod,
		"cp":    cmdCp,
		"edit":  cmdEdit,
		"elock": cmdElock,
		"ls":    cmdLs,
		"qlock": cmdQlock,
		"rm":    cmdRm,
		"stat":  cmdStat,
		"touch": cmdTouch,
		"unzip": cmdUnzip,
		"wait":  cmdWait,
		"watch": cmdWatch,
		"zip":   cmdZip,
	}

	zconn = zk.NewMetaConn()
}
示例#5
0
文件: zkcmd.go 项目: ZhuoRoger/vitess
func init() {
	opts.Description = doc
	cmdMap = map[string]cmdFunc{
		"cat":   cmdCat,
		"chmod": cmdChmod,
		"cp":    cmdCp,
		"edit":  cmdEdit,
		"elock": cmdElock,
		"ls":    cmdLs,
		"qlock": cmdQlock,
		"rm":    cmdRm,
		"stat":  cmdStat,
		"touch": cmdTouch,
		"unzip": cmdUnzip,
		"wait":  cmdWait,
		"watch": cmdWatch,
		"zip":   cmdZip,
	}
	log.SetFlags(0)

	zconn = zk.NewMetaConn(false)
}
示例#6
0
import (
	"flag"
	"reflect"
	"sync"
	"time"

	log "github.com/golang/glog"
	"github.com/youtube/vitess/go/vt/servenv"
	"github.com/youtube/vitess/go/vt/tabletserver"
	"github.com/youtube/vitess/go/zk"
	"launchpad.net/gozk/zookeeper"
)

var (
	// Actual ZkCustomRule object in charge of rule updates
	zkCustomRule = NewZkCustomRule(zk.NewMetaConn())
	// Commandline flag to specify rule path in zookeeper
	zkRulePath = flag.String("zkcustomrules", "", "zookeeper based custom rule path")
)

// Invalid rule version, used to mark invalid query rules
const InvalidQueryRulesVersion int64 = -1

// Zookeeper based custom rule source name
const ZkCustomRuleSource string = "ZK_CUSTOM_RULE"

// ZkCustomRule is Zookeeper backed implementation of CustomRuleManager
type ZkCustomRule struct {
	mu                    sync.Mutex
	path                  string
	zconn                 zk.Conn
示例#7
0
func init() {
	zconn := zk.NewMetaConn()
	topo.RegisterServer("zookeeper", &Server{zconn: zconn})
}
示例#8
0
文件: server.go 项目: richarwu/vitess
func init() {
	zconn := zk.NewMetaConn()
	stats.PublishJSONFunc("ZkMetaConn", zconn.String)
	topo.RegisterServer("zookeeper", &Server{zconn: zconn})
}
示例#9
0
func init() {
	zkoccconn := zk.NewMetaConn(true)
	topo.RegisterServer("zkocc", zktopo.NewServer(zkoccconn))
}
示例#10
0
func init() {
	zconn := zk.NewMetaConn(false)
	stats.PublishJSONFunc("ZkMetaConn", zconn.String)
	topo.RegisterServer("zookeeper", NewServer(zconn))
}
示例#11
0
func init() {
	zconn := zk.NewMetaConn(false)
	expvar.Publish("ZkMetaConn", zconn)
	topo.RegisterServer("zookeeper", NewServer(zconn))
}