Пример #1
0
func main() {
	defer func() {
		if panicErr := recover(); panicErr != nil {
			log.Fatalf("panic: %v", tb.Errorf("%v", panicErr))
		}
	}()

	flag.Parse()
	args := flag.Args()
	if len(args) != 0 {
		flag.Usage()
		os.Exit(1)
	}

	if *fromTopo == "" || *toTopo == "" {
		log.Fatalf("Need both from and to topo")
	}

	fromTS := topo.GetServerByName(*fromTopo)
	toTS := topo.GetServerByName(*toTopo)

	if *doKeyspaces {
		helpers.CopyKeyspaces(fromTS, toTS)
	}
	if *doShards {
		helpers.CopyShards(fromTS, toTS, *deleteKeyspaceShards)
	}
	if *doShardReplications {
		helpers.CopyShardReplications(fromTS, toTS)
	}
	if *doTablets {
		helpers.CopyTablets(fromTS, toTS)
	}
}
Пример #2
0
func main() {
	defer exit.RecoverAll()
	defer logutil.Flush()

	flag.Parse()
	args := flag.Args()
	if len(args) != 0 {
		flag.Usage()
		os.Exit(1)
	}

	if *fromTopo == "" || *toTopo == "" {
		log.Errorf("Need both from and to topo")
		exit.Return(1)
	}

	ctx := context.Background()
	fromTS := topo.GetServerByName(*fromTopo)
	toTS := topo.GetServerByName(*toTopo)

	if *doKeyspaces {
		helpers.CopyKeyspaces(ctx, fromTS.Impl, toTS.Impl)
	}
	if *doShards {
		helpers.CopyShards(ctx, fromTS.Impl, toTS.Impl, *deleteKeyspaceShards)
	}
	if *doShardReplications {
		helpers.CopyShardReplications(ctx, fromTS.Impl, toTS.Impl)
	}
	if *doTablets {
		helpers.CopyTablets(ctx, fromTS.Impl, toTS.Impl)
	}
}
Пример #3
0
func main() {
	defer exit.RecoverAll()
	defer logutil.Flush()

	flag.Parse()
	args := flag.Args()
	if len(args) != 0 {
		flag.Usage()
		os.Exit(1)
	}

	if *fromTopo == "" || *toTopo == "" {
		log.Fatalf("Need both from and to topo")
	}

	fromTS := topo.GetServerByName(*fromTopo)
	toTS := topo.GetServerByName(*toTopo)

	if *doKeyspaces {
		helpers.CopyKeyspaces(fromTS, toTS)
	}
	if *doShards {
		helpers.CopyShards(fromTS, toTS, *deleteKeyspaceShards)
	}
	if *doShardReplications {
		helpers.CopyShardReplications(fromTS, toTS)
	}
	if *doTablets {
		helpers.CopyTablets(fromTS, toTS)
	}
}