修改mysql连接
This commit is contained in:
parent
d35ffd793a
commit
2dee02b6c5
|
@ -53,7 +53,7 @@ func GetAllTableNames(uri string) []string {
|
|||
return tableNames
|
||||
}
|
||||
|
||||
// "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"
|
||||
// "fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen"
|
||||
func GetColsFromTable(tname string, db *sql.DB) (result []Column, tableName, tableComment string) {
|
||||
|
||||
var a, ddl string
|
||||
|
@ -210,7 +210,7 @@ func main() {
|
|||
var name string // 需要序列化的单独文件名
|
||||
var mdir string // 需要修改的序列化路径 model
|
||||
|
||||
flag.StringVar(&mysqluri, "uri", "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest", "输入需要序列化的ddl文件名, 不需要后缀.ddl")
|
||||
flag.StringVar(&mysqluri, "uri", "fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen", "输入需要序列化的ddl文件名, 不需要后缀.ddl")
|
||||
flag.StringVar(&name, "name", "", "输入需要序列化的ddl文件名, 不需要后缀.ddl")
|
||||
flag.StringVar(&mdir, "mdir", "", "输入需要生成model的Go文件所在目录")
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Name: {{.serviceName}}
|
|||
Host: {{.host}}
|
||||
Port: {{.port}}
|
||||
Timeout: 15000 #服务超时时间(毫秒)
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
SourceRabbitMq: amqp://rabbit001:rabbit001129@110.41.19.98:5672
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Name: {{.serviceName}}
|
||||
Host: {{.host}}
|
||||
Port: {{.port}}
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package initalize
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/schema"
|
||||
"time"
|
||||
)
|
||||
|
||||
// 初始化mysql
|
||||
|
@ -24,6 +26,7 @@ func InitMysql(sourceMysql string) *gorm.DB {
|
|||
},
|
||||
SkipDefaultTransaction: true,
|
||||
})
|
||||
log.Println(db.Rows())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ Name: assistant
|
|||
Host: 0.0.0.0
|
||||
Port: 9950
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -2,8 +2,8 @@ Name: auth
|
|||
Host: localhost
|
||||
Port: 9980
|
||||
ReplicaId: 10
|
||||
MainAddress: "http://localhost:9900"
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
MainAddress: "https://server.fusen.3718.cn:9900"
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -23,7 +23,6 @@ func main() {
|
|||
conf.MustLoad(*configFile, &c)
|
||||
|
||||
server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) {
|
||||
|
||||
}))
|
||||
defer server.Stop()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ Name: backend
|
|||
Host: localhost
|
||||
Port: 9901
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen_backend_2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -2,7 +2,7 @@ Name: base
|
|||
Host: 0.0.0.0
|
||||
Port: 9920
|
||||
Timeout: 15000 #服务超时时间(毫秒)
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9902
|
||||
ReplicaId: 15
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9903
|
||||
ReplicaId: 20
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -4,7 +4,7 @@ Port: 9904
|
|||
ReplicaId: 25
|
||||
Timeout: 15000 #服务超时时间
|
||||
MainAddress: "http://localhost:9900"
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9905
|
||||
ReplicaId: 30
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9906
|
||||
ReplicaId: 35
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9907
|
||||
ReplicaId: 40
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: 0.0.0.0
|
|||
Port: 9915
|
||||
ReplicaId: 45
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Name: product-model
|
||||
Host: localhost
|
||||
Port: 9909
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: 0.0.0.0
|
|||
ReplicaId: 10
|
||||
Port: 9917
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -2,7 +2,7 @@ Name: product-template
|
|||
Host: localhost
|
||||
Port: 9910
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9908
|
||||
ReplicaId: 50
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: 0.0.0.0
|
|||
Port: 9919
|
||||
ReplicaId: 55
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: 0.0.0.0
|
|||
Port: 9916
|
||||
ReplicaId: 60
|
||||
Timeout: 150000 #服务超时时间(毫秒)
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9911
|
||||
ReplicaId: 65
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -4,7 +4,7 @@ Port: 9912
|
|||
ReplicaId: 70
|
||||
Timeout: 150000 #服务超时时间
|
||||
MaxBytes: 104857600 #传输字节大小
|
||||
SourceMysql: "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"
|
||||
SourceMysql: "fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen"
|
||||
Env: "test"
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: localhost
|
|||
Port: 9913
|
||||
ReplicaId: 75
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: "fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"
|
||||
SourceMysql: "fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen"
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -3,7 +3,7 @@ Host: 0.0.0.0
|
|||
Port: 9914
|
||||
ReplicaId: 80
|
||||
Timeout: 15000 #服务超时时间
|
||||
SourceMysql: fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest
|
||||
SourceMysql: fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen
|
||||
Auth:
|
||||
AccessSecret: fusen2023
|
||||
AccessExpire: 2592000
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
func test1() {
|
||||
// log.SetFlags(log.Llongfile)
|
||||
|
||||
// fsm := StartNode("fs1", "localhost:5500", nil, initalize.InitMysql("fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"))
|
||||
// fsm := StartNode("fs1", "localhost:5500", nil, initalize.InitMysql("fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen"))
|
||||
|
||||
// time.Sleep(time.Second * 5)
|
||||
|
||||
|
@ -264,7 +264,7 @@ func waitForCluster(ra *raft.Raft) {
|
|||
}
|
||||
}
|
||||
|
||||
// var gdb *gorm.DB = initalize.InitMysql("fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest")
|
||||
// var gdb *gorm.DB = initalize.InitMysql("fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen")
|
||||
|
||||
type UserState struct {
|
||||
UpdateAt time.Time
|
||||
|
|
|
@ -28,7 +28,7 @@ func NewFsStateMachine(shardID uint64, replicaID uint64) sm.IStateMachine {
|
|||
shardID: shardID,
|
||||
replicaID: replicaID,
|
||||
store: make(map[int64]*UserState),
|
||||
// gdb: initalize.InitMysql("fusentest:XErSYmLELKMnf3Dh@tcp(110.41.19.98:3306)/fusentest"),
|
||||
// gdb: initalize.InitMysql("fsreaderwriter:XErSYmLELKMnf3Dh@tcp(fusen.cdmigcvz3rle.us-east-2.rds.amazonaws.com:3306)/fusen"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,3 +9,11 @@ func FsCors(header http.Header) {
|
|||
header.Set("Access-Control-Expose-Headers", "*")
|
||||
header.Set("Access-Control-Allow-Credentials", "true")
|
||||
}
|
||||
|
||||
func FsCorsResponse(w http.ResponseWriter) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "*")
|
||||
w.Header().Set("Access-Control-Expose-Headers", "*")
|
||||
w.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user