Jianghan 1 year ago
parent
commit
e4b051186c

+ 5 - 0
jyBXSubscribe/rpc/init/db.go

@@ -109,6 +109,11 @@ func MysqlInit(mm *entity.Mysql) {
 		}
 		GlobalCommonData.Init()
 	}
+	if mm.JyCk.Address != "" {
+		logx.Info("--初始化 jy clickhouse--")
+		CkJy = mysql.NewInit(mysql.CLICKHOUSE, fmt.Sprintf("clickhouse://%s:%s@%s/%s", mm.JyCk.UserName, mm.JyCk.Password, mm.JyCk.Address, mm.JyCk.DbName),
+			mm.JyCk.MaxOpenConns, mm.JyCk.MaxIdleConns)
+	}
 	P.BidCodeMapping.Init(BaseServiceMysql)
 }
 

+ 0 - 1
jyBXSubscribe/rpc/init/init.go

@@ -26,7 +26,6 @@ func InitC() {
 	RedisInit(&DB.Redis)
 	//初始es
 	EsInit(&DB.Es)
-	CkInit(&DB.Mysql)
 	Middleground = middleground.NewMiddleground(C.CodeServiceConf.Etcd.Hosts).
 		RegUserCenter(C.UserCenterKey).
 		RegPowerCheckCenter(C.PowerCheckCenterKey).

+ 4 - 5
jyBXSubscribe/rpc/internal/config/config.go

@@ -25,9 +25,8 @@ type Config struct {
 }
 
 type Db struct {
-	Mysql      entity.Mysql      `json:"mysql"`
-	Redis      entity.RedisStuct `json:"redis"`
-	Es         entity.EsStruct   `json:"es"`
-	Mongo      entity.Mongo      `json:"mongo"`
-	ClickHouse entity.Mysql      `json:"clickhouse"`
+	Mysql entity.Mysql      `json:"mysql"`
+	Redis entity.RedisStuct `json:"redis"`
+	Es    entity.EsStruct   `json:"es"`
+	Mongo entity.Mongo      `json:"mongo"`
 }