فهرست منبع

es新增链接

WH01243 1 سال پیش
والد
کامیت
d13cefb4c9
5فایلهای تغییر یافته به همراه30 افزوده شده و 3 حذف شده
  1. 9 0
      entity/entity.go
  2. 1 0
      rpc/biservice.go
  3. 9 1
      rpc/etc/biservice.yaml
  4. 9 0
      rpc/internal/config/config.go
  5. 2 2
      service/sqlService.go

+ 9 - 0
entity/entity.go

@@ -28,6 +28,7 @@ var (
 	Mgo              *mongodb.MongodbSim
 	Bidding          *mongodb.MongodbSim
 	Es               elastic.Es
+	EntEs            elastic.EsV7
 	AreaCode         = map[string]string{}
 	Hlyj             *HlyjS
 	DataLock         = sync.Mutex{}
@@ -139,6 +140,14 @@ func InitBiddingMgo(addr, db, user, pwd string, size int) {
 func InitEs(version, address, userName, password string, size int) {
 	Es = elastic.NewEs(version, address, size, userName, password)
 }
+func InitEntEs(version, address, userName, password string, size int) {
+	EntEs = elastic.EsV7{
+		Address:  address,
+		UserName: userName,
+		Password: password,
+		Size:     size,
+	}
+}
 
 func InitArea() {
 	info := JyBiMysql.Find("d_area_code_back", nil, "", "", -1, -1)

+ 1 - 0
rpc/biservice.go

@@ -32,6 +32,7 @@ func main() {
 	entity.InitMongo(c.Mongo.Qfw.MongodbAddr, c.Mongo.Qfw.DbName, c.Mongo.Qfw.Size)
 	entity.InitBiddingMgo(c.Mongo.Bidding.MongodbAddr, c.Mongo.Bidding.DbName, c.Mongo.Bidding.UserName, c.Mongo.Bidding.Password, c.Mongo.Bidding.Size)
 	entity.InitEs(c.Es.Version, c.Es.Address, c.Es.UserName, c.Es.Password, c.Es.DbSize)
+	entity.InitEntEs(c.EntEs.Version, c.EntEs.Address, c.EntEs.UserName, c.EntEs.Password, c.EntEs.DbSize)
 	entity.InitArea()
 	entity.InitRedis(c.RedisAddress)
 	//合力亿捷

+ 9 - 1
rpc/etc/biservice.yaml

@@ -74,6 +74,14 @@ Es:
   Password: 
   Index: projectset
   IType: projectset
+EntEs:
+  Address: http://192.168.3.241:9205
+  DbSize: 5
+  Version: v7
+  UserName:
+  Password:
+  Index: projectset
+  IType: projectset
 Logx:
   Mode: console #console|file|volume
   Path: logs
@@ -86,7 +94,7 @@ TopicName: jy_position_sync
 NsqUrl: 192.168.3.240:4161
 #合力亿捷account_token存储
 RedisAddress:
-  - newother=192.168.3.11:1712
+  - newother=192.168.3.149:1712
   - session=192.168.3.149:1713
 #合力亿捷相关调用参数
 Hlyj:

+ 9 - 0
rpc/internal/config/config.go

@@ -42,6 +42,15 @@ type Config struct {
 		UserName string
 		Password string
 	}
+	EntEs struct {
+		Address  string
+		DbSize   int
+		Index    string
+		IType    string
+		Version  string
+		UserName string
+		Password string
+	}
 	Mode           string
 	CustomerCol    string
 	AddCountLimit  int

+ 2 - 2
service/sqlService.go

@@ -3,7 +3,7 @@ package service
 import (
 	"app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
-	elastic "app.yhyue.com/moapp/jybase/es"
+
 	"app.yhyue.com/moapp/jybase/redis"
 	MC "bp.jydev.jianyu360.cn/BaseService/biService/entity"
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
@@ -35,7 +35,7 @@ func (l SqlService) SqlManage(in *biservice.SqlManageReq) []byte {
 	count := int64(0)
 	switch dbType {
 	case "es":
-		count, rs = elastic.GetWithCount(common.InterfaceToStr((*sqlData)["db_name"]), common.InterfaceToStr((*sqlData)["db_name"]), "", Sqlformat(common.InterfaceToStr((*sqlData)["content"]), *in))
+		count, rs = MC.EntEs.GetWithCount(common.InterfaceToStr((*sqlData)["db_name"]), common.InterfaceToStr((*sqlData)["db_name"]), "", Sqlformat(common.InterfaceToStr((*sqlData)["content"]), *in))
 	}
 	for k, v := range *rs {
 		(*rs)[k]["id"] = encrypt.EncodeArticleId2ByCheck(common.InterfaceToStr(v["_id"]))