當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Mysqld.RestoreFromSnapshot方法代碼示例

本文整理匯總了Golang中github.com/henryanand/vitess/go/vt/mysqlctl.Mysqld.RestoreFromSnapshot方法的典型用法代碼示例。如果您正苦於以下問題:Golang Mysqld.RestoreFromSnapshot方法的具體用法?Golang Mysqld.RestoreFromSnapshot怎麽用?Golang Mysqld.RestoreFromSnapshot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/henryanand/vitess/go/vt/mysqlctl.Mysqld的用法示例。


在下文中一共展示了Mysqld.RestoreFromSnapshot方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: restoreCmd

func restoreCmd(mysqld *mysqlctl.Mysqld, subFlags *flag.FlagSet, args []string) {
	dontWaitForSlaveStart := subFlags.Bool("dont_wait_for_slave_start", false, "won't wait for replication to start (useful when restoring from master server)")
	fetchConcurrency := subFlags.Int("fetch_concurrency", 3, "how many files to fetch simultaneously")
	fetchRetryCount := subFlags.Int("fetch_retry_count", 3, "how many times to retry a failed transfer")
	subFlags.Parse(args)
	if subFlags.NArg() != 1 {
		log.Fatalf("Command restore requires <snapshot manifest file>")
	}

	rs, err := mysqlctl.ReadSnapshotManifest(subFlags.Arg(0))
	if err == nil {
		err = mysqld.RestoreFromSnapshot(logutil.NewConsoleLogger(), rs, *fetchConcurrency, *fetchRetryCount, *dontWaitForSlaveStart, nil)
	}
	if err != nil {
		log.Fatalf("restore failed: %v", err)
	}
}
開發者ID:henryanand,項目名稱:vitess,代碼行數:17,代碼來源:mysqlctl.go


注:本文中的github.com/henryanand/vitess/go/vt/mysqlctl.Mysqld.RestoreFromSnapshot方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。