Support mongodb cluster

pull/351/head
skiffer-git 2 years ago
parent aa41dc3650
commit 06117c98b1

@ -28,7 +28,7 @@ mysql:
mongo:
dbUri: ""#当dbUri值不为空则直接使用该值
#dbAddress: 127.0.0.1:37017 #单机时为mongo地址使用分片集群时为mongos地址 默认即可
dbAddress: [127.0.0.1:37017] #单机时为mongo地址使用分片集群时为mongos地址 默认即可
dbAddress: [ 127.0.0.1:37017 ] #单机时为mongo地址使用分片集群时为mongos地址 默认即可
dbDirect: false
dbTimeout: 60
dbDatabase: openIM #mongo db 默认即可

@ -72,7 +72,7 @@ func init() {
// clientOpts := options.Client().ApplyURI("mongodb://localhost:27017,localhost:27018/?replicaSet=replset")
//mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
//uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin&replicaSet=replset",
uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin",
uri = fmt.Sprintf("mongodb://%s:%s@%s/%s?maxPoolSize=%d&authSource=admin&replicaSet=replset",
config.Config.Mongo.DBUserName, config.Config.Mongo.DBPassword, mongodbHosts,
config.Config.Mongo.DBDatabase, config.Config.Mongo.DBMaxPoolSize)
} else {

Loading…
Cancel
Save