forked from all_user/stat_center
Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"stat/common/log"
|
||||
"stat/common/mongos"
|
||||
"stat/models"
|
||||
)
|
||||
|
||||
// InitMongoDB 初始化同步数据库
|
||||
func InitMongoDB() error {
|
||||
|
||||
statDB := mongos.NewManager("mongodb://stat:7u9CUAEE1Nv2tSvz@192.53.118.36:47017,192.53.173.209:47017,139.162.65.62:47017,172.105.237.106:47017,172.105.189.212:47017/stat?replicaSet=MDstat&maxPoolSize=200&connectTimeout=30&authSource=stat")
|
||||
if err := statDB.Connect(); err != nil {
|
||||
log.Error("mgoDB connect err", log.E(err))
|
||||
return err
|
||||
}
|
||||
mongos.MgoManager = statDB
|
||||
|
||||
// 初始化数据库索引
|
||||
models.InitIndex()
|
||||
fmt.Println("init")
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user