diff --git a/generator/main.go b/generator/main.go index 438eb8b1..73c387ee 100644 --- a/generator/main.go +++ b/generator/main.go @@ -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文件所在目录") diff --git a/goctl_template/api/etc.tpl b/goctl_template/api/etc.tpl index 4575245d..86e74e0a 100644 --- a/goctl_template/api/etc.tpl +++ b/goctl_template/api/etc.tpl @@ -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 diff --git a/goctl_template_backend/api/etc.tpl b/goctl_template_backend/api/etc.tpl index 3279e7ea..ae13e77f 100644 --- a/goctl_template_backend/api/etc.tpl +++ b/goctl_template_backend/api/etc.tpl @@ -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 diff --git a/initalize/mysql.go b/initalize/mysql.go index 7ac6eaae..d4816872 100644 --- a/initalize/mysql.go +++ b/initalize/mysql.go @@ -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) } diff --git a/server/assistant/etc/assistant.yaml b/server/assistant/etc/assistant.yaml index f65d63af..94197f00 100644 --- a/server/assistant/etc/assistant.yaml +++ b/server/assistant/etc/assistant.yaml @@ -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 diff --git a/server/auth/etc/auth.yaml b/server/auth/etc/auth.yaml index 17bd9019..59b8aeed 100644 --- a/server/auth/etc/auth.yaml +++ b/server/auth/etc/auth.yaml @@ -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 diff --git a/server/backend/backend.go b/server/backend/backend.go index 099cb974..bec54a34 100644 --- a/server/backend/backend.go +++ b/server/backend/backend.go @@ -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() diff --git a/server/backend/etc/backend.yaml b/server/backend/etc/backend.yaml index c455689e..2e32fa19 100644 --- a/server/backend/etc/backend.yaml +++ b/server/backend/etc/backend.yaml @@ -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 diff --git a/server/base/etc/base.yaml b/server/base/etc/base.yaml index e201a85b..c54636dc 100644 --- a/server/base/etc/base.yaml +++ b/server/base/etc/base.yaml @@ -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 diff --git a/server/canteen/etc/canteen.yaml b/server/canteen/etc/canteen.yaml index 36fbf7eb..72e191eb 100644 --- a/server/canteen/etc/canteen.yaml +++ b/server/canteen/etc/canteen.yaml @@ -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 diff --git a/server/data-transfer/etc/data-transfer.yaml b/server/data-transfer/etc/data-transfer.yaml index 9c752477..ae3a06a8 100644 --- a/server/data-transfer/etc/data-transfer.yaml +++ b/server/data-transfer/etc/data-transfer.yaml @@ -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 diff --git a/server/home-user-auth/etc/home-user-auth.yaml b/server/home-user-auth/etc/home-user-auth.yaml index b6babad5..4bdccc17 100644 --- a/server/home-user-auth/etc/home-user-auth.yaml +++ b/server/home-user-auth/etc/home-user-auth.yaml @@ -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 diff --git a/server/inventory/etc/inventory.yaml b/server/inventory/etc/inventory.yaml index 4e1c71b7..c4d01916 100644 --- a/server/inventory/etc/inventory.yaml +++ b/server/inventory/etc/inventory.yaml @@ -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 diff --git a/server/map-library/etc/map-library.yaml b/server/map-library/etc/map-library.yaml index 7d4dbf3a..5261a044 100644 --- a/server/map-library/etc/map-library.yaml +++ b/server/map-library/etc/map-library.yaml @@ -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 diff --git a/server/orders/etc/orders.yaml b/server/orders/etc/orders.yaml index b3f3dbc8..d62e8fda 100644 --- a/server/orders/etc/orders.yaml +++ b/server/orders/etc/orders.yaml @@ -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 diff --git a/server/pay/etc/pay.yaml b/server/pay/etc/pay.yaml index 94d779cc..13ffdeb3 100644 --- a/server/pay/etc/pay.yaml +++ b/server/pay/etc/pay.yaml @@ -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 diff --git a/server/product-model/etc/product-model.yaml b/server/product-model/etc/product-model.yaml index 3fcb21b7..f498b3b5 100644 --- a/server/product-model/etc/product-model.yaml +++ b/server/product-model/etc/product-model.yaml @@ -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 diff --git a/server/product-template-tag/etc/product-template-tag.yaml b/server/product-template-tag/etc/product-template-tag.yaml index 2204cdcd..c5967973 100644 --- a/server/product-template-tag/etc/product-template-tag.yaml +++ b/server/product-template-tag/etc/product-template-tag.yaml @@ -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 diff --git a/server/product-template/etc/product-template.yaml b/server/product-template/etc/product-template.yaml index d58ab54f..ba9a4b7f 100644 --- a/server/product-template/etc/product-template.yaml +++ b/server/product-template/etc/product-template.yaml @@ -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 diff --git a/server/product/etc/product.yaml b/server/product/etc/product.yaml index e7dcf596..40f286dc 100644 --- a/server/product/etc/product.yaml +++ b/server/product/etc/product.yaml @@ -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 diff --git a/server/render/etc/render.yaml b/server/render/etc/render.yaml index be49e90c..2679ee88 100644 --- a/server/render/etc/render.yaml +++ b/server/render/etc/render.yaml @@ -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 diff --git a/server/resource/etc/resource.yaml b/server/resource/etc/resource.yaml index 60f9ae55..e0c44e88 100644 --- a/server/resource/etc/resource.yaml +++ b/server/resource/etc/resource.yaml @@ -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 diff --git a/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml b/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml index 5dd45ad4..166a6c98 100644 --- a/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml +++ b/server/shopping-cart-confirmation/etc/shopping-cart-confirmation.yaml @@ -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 diff --git a/server/upload/etc/upload.yaml b/server/upload/etc/upload.yaml index d1335e3b..09f3bf7c 100644 --- a/server/upload/etc/upload.yaml +++ b/server/upload/etc/upload.yaml @@ -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 diff --git a/server/webset/etc/webset.yaml b/server/webset/etc/webset.yaml index 42994d36..278035f4 100644 --- a/server/webset/etc/webset.yaml +++ b/server/webset/etc/webset.yaml @@ -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 diff --git a/server/websocket/etc/websocket.yaml b/server/websocket/etc/websocket.yaml index 368f1ca8..f6865f25 100644 --- a/server/websocket/etc/websocket.yaml +++ b/server/websocket/etc/websocket.yaml @@ -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 diff --git a/shared/main.go b/shared/main.go index c4b8de3e..f7a35d77 100644 --- a/shared/main.go +++ b/shared/main.go @@ -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 diff --git a/shared/sm.go b/shared/sm.go index e40e18c1..9a48646b 100644 --- a/shared/sm.go +++ b/shared/sm.go @@ -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"), } } diff --git a/utils/auth/cors.go b/utils/auth/cors.go index ff7354f4..bcf24a90 100644 --- a/utils/auth/cors.go +++ b/utils/auth/cors.go @@ -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") +}