|
@@ -2,6 +2,7 @@ package public
|
|
|
|
|
|
import (
|
|
|
"log"
|
|
|
+ "strings"
|
|
|
|
|
|
util "app.yhyue.com/moapp/jybase/common"
|
|
|
elastic "app.yhyue.com/moapp/jybase/esv1"
|
|
@@ -21,6 +22,8 @@ var (
|
|
|
Mgo_Log m.MongodbSim
|
|
|
Mgo_Bidding m.MongodbSim
|
|
|
//Mgo_Qyfw m.MongodbSim
|
|
|
+
|
|
|
+ EsDoc *elastic.Elastic
|
|
|
)
|
|
|
|
|
|
type dbConf struct {
|
|
@@ -34,6 +37,7 @@ type dbConf struct {
|
|
|
}
|
|
|
Elasticsearch struct {
|
|
|
Main *esConf
|
|
|
+ Doc *esConf
|
|
|
}
|
|
|
Redis struct {
|
|
|
Main *redisConf
|
|
@@ -79,6 +83,14 @@ func init() {
|
|
|
elastic.InitElasticSize(DbConf.Elasticsearch.Main.Address, DbConf.Elasticsearch.Main.Size)
|
|
|
log.Println("初始化 elasticsearch")
|
|
|
}
|
|
|
+
|
|
|
+ if DbConf.Elasticsearch.Doc != nil {
|
|
|
+ EsDoc.Addrs = strings.Split(DbConf.Elasticsearch.Doc.Address, ",")
|
|
|
+ EsDoc.I_size = DbConf.Elasticsearch.Doc.Size
|
|
|
+ EsDoc.InitElasticSize()
|
|
|
+ log.Println("初始化 doc elasticsearch")
|
|
|
+ }
|
|
|
+
|
|
|
//初始化redis
|
|
|
if DbConf.Redis.Main != nil {
|
|
|
log.Println("初始化 redis")
|