本文整理汇总了Golang中github.com/youtube/vitess/go/mysql.ConnectionParams类的典型用法代码示例。如果您正苦于以下问题:Golang ConnectionParams类的具体用法?Golang ConnectionParams怎么用?Golang ConnectionParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConnectionParams类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: changeMasterArgs
func changeMasterArgs(params *mysql.ConnectionParams, status *proto.ReplicationStatus) []string {
var args []string
args = append(args, fmt.Sprintf("MASTER_HOST = '%s'", status.MasterHost))
args = append(args, fmt.Sprintf("MASTER_PORT = %d", status.MasterPort))
args = append(args, fmt.Sprintf("MASTER_USER = '%s'", params.Uname))
args = append(args, fmt.Sprintf("MASTER_PASSWORD = '%s'", params.Pass))
args = append(args, fmt.Sprintf("MASTER_CONNECT_RETRY = %d", status.MasterConnectRetry))
if params.SslEnabled() {
args = append(args, "MASTER_SSL = 1")
}
if params.SslCa != "" {
args = append(args, fmt.Sprintf("MASTER_SSL_CA = '%s'", params.SslCa))
}
if params.SslCaPath != "" {
args = append(args, fmt.Sprintf("MASTER_SSL_CAPATH = '%s'", params.SslCaPath))
}
if params.SslCert != "" {
args = append(args, fmt.Sprintf("MASTER_SSL_CERT = '%s'", params.SslCert))
}
if params.SslKey != "" {
args = append(args, fmt.Sprintf("MASTER_SSL_KEY = '%s'", params.SslKey))
}
return args
}
开发者ID:chinna1986,项目名称:vitess,代码行数:25,代码来源:replication.go
示例2: refreshPassword
// refreshPassword uses the CredentialServer to refresh the password
// to use.
func refreshPassword(params *mysql.ConnectionParams) error {
user, passwd, err := GetCredentialsServer().GetPassword(params.Uname)
switch err {
case nil:
params.Uname = user
params.Pass = passwd
case ErrUnknownUser:
default:
return err
}
return nil
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:14,代码来源:dbconfigs.go
示例3: InitConnectionParams
// InitConnectionParams may overwrite the socket file,
// and refresh the password to check that works.
func InitConnectionParams(cp *mysql.ConnectionParams, socketFile string) error {
if socketFile != "" {
cp.UnixSocket = socketFile
}
params := *cp
return refreshPassword(¶ms)
}
开发者ID:nimishzynga,项目名称:vitess,代码行数:9,代码来源:dbconfigs.go
示例4: NewMysqld
func NewMysqld(config *Mycnf, dba, repl *mysql.ConnectionParams) *Mysqld {
if *dba == dbconfigs.DefaultDBConfigs.Dba {
dba.UnixSocket = config.SocketFile
}
return &Mysqld{config,
dba,
repl,
TabletDir(config.ServerId),
SnapshotDir(config.ServerId),
}
}
开发者ID:qinbo,项目名称:vitess,代码行数:12,代码来源:mysqld.go
示例5: createLookupClient
func createLookupClient(lookupConfigFile, dbCredFile string) (*DBClient, error) {
lookupConfigData, err := ioutil.ReadFile(lookupConfigFile)
if err != nil {
return nil, fmt.Errorf("Error %s in reading lookup-config-file %s", err, lookupConfigFile)
}
lookupClient := &DBClient{}
lookupConfig := new(mysql.ConnectionParams)
err = json.Unmarshal(lookupConfigData, lookupConfig)
if err != nil {
return nil, fmt.Errorf("error in unmarshaling lookupConfig data, err '%v'", err)
}
var lookupPasswd string
if dbCredFile != "" {
dbCredentials := make(map[string][]string)
dbCredData, err := ioutil.ReadFile(dbCredFile)
if err != nil {
return nil, fmt.Errorf("Error %s in reading db-credentials-file %s", err, dbCredFile)
}
err = json.Unmarshal(dbCredData, &dbCredentials)
if err != nil {
return nil, fmt.Errorf("Error in unmarshaling db-credentials-file %s", err)
}
if passwd, ok := dbCredentials[lookupConfig.Uname]; ok {
lookupPasswd = passwd[0]
}
}
lookupConfig.Pass = lookupPasswd
relog.Info("lookupConfig %v", lookupConfig)
lookupClient.dbConfig = lookupConfig
lookupClient.dbConn, err = lookupClient.Connect()
if err != nil {
return nil, fmt.Errorf("error in connecting to mysql db, err %v", err)
}
return lookupClient, nil
}
开发者ID:shrutip,项目名称:vitess,代码行数:39,代码来源:vt_binlog_player.go
示例6: NewMysqld
// NewMysqld creates a Mysqld object based on the provided configuration
// and connection parameters.
// name is the base for stats exports, use 'Dba', except in tests
func NewMysqld(name string, config *Mycnf, dba, repl *mysql.ConnectionParams) *Mysqld {
if *dba == dbconfigs.DefaultDBConfigs.Dba {
dba.UnixSocket = config.SocketFile
}
// create and open the connection pool for dba access
mysqlStats := stats.NewTimings("Mysql" + name)
dbaPool := dbconnpool.NewConnectionPool(name+"ConnPool", *dbaPoolSize, *dbaIdleTimeout)
dbaPool.Open(dbconnpool.DBConnectionCreator(dba, mysqlStats))
return &Mysqld{
config: config,
dba: dba,
dbaPool: dbaPool,
replParams: repl,
TabletDir: TabletDir(config.ServerId),
SnapshotDir: SnapshotDir(config.ServerId),
}
}
开发者ID:miffa,项目名称:vitess,代码行数:22,代码来源:mysqld.go
示例7: NewMysqld
func NewMysqld(config *Mycnf, dba, repl mysql.ConnectionParams) *Mysqld {
if dba == DefaultDbaParams {
dba.UnixSocket = config.SocketFile
}
// the super connection is not linked to a specific database
// (allows us to create them)
superParams := dba
superParams.DbName = ""
createSuperConnection := func() (*mysql.Connection, error) {
return mysql.Connect(superParams)
}
return &Mysqld{config,
dba,
repl,
createSuperConnection,
TabletDir(config.ServerId),
SnapshotDir(config.ServerId),
}
}
开发者ID:rjammala,项目名称:vitess,代码行数:20,代码来源:mysqld.go
注:本文中的github.com/youtube/vitess/go/mysql.ConnectionParams类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论