wcc 1 рік тому
батько
коміт
a87d2e6f1d
4 змінених файлів з 24 додано та 17 видалено
  1. 1 1
      createEsIndex/attachment.go
  2. 13 12
      createEsIndex/common.toml
  3. 3 1
      createEsIndex/init.go
  4. 7 3
      createEsIndex/main.go

+ 1 - 1
createEsIndex/attachment.go

@@ -115,7 +115,7 @@ func attachmentBiddingTask(mapInfo map[string]interface{}, other config.OthersDa
 					{"$set": update},
 				}
 			}
-
+			// 这里直接放入存 es库 bidding的通道
 			saveEsPool <- newTmp
 		}(tmp)
 		tmp = map[string]interface{}{}

+ 13 - 12
createEsIndex/common.toml

@@ -92,19 +92,20 @@ api = "http://172.17.145.179:19281/_send/_mail"
 
 [[others]]
 [others.attachment] ## 附件补充程序,更新入库 bidding ES
- mgoaddr = "127.0.0.1:27083"       ## bidding查询地址
- mgocoll = "bidding_downloadfile_log"       ## bidding表名
- mgodb = "qfw"         ## 库名
- mgousername="SJZY_RWbid_ES"     ## 用户名
- mgopassword="SJZY@B4i4D5e6S"     ## 密码
-# esaddr = "127.0.0.1:19805"        ## 存入的es 地址
-# esindex= "bidding"        ## 存入的es 表
-# esusername="es_all"      ## es 用户名
-# espassword=""      ## es 密码
- nextaddr ="172.17.145.179"       ## udp 下个地址
- nextport =1782      ## udp 下个地址 的端口
+     mgoaddr = "127.0.0.1:27083"       ## bidding查询地址
+     mgocoll = "bidding_downloadfile_log"       ## bidding表名
+     mgodb = "qfw"         ## 库名
+     mgousername="SJZY_RWbid_ES"     ## 用户名
+     mgopassword="SJZY@B4i4D5e6S"     ## 密码
+    ## 目前附件补充的数据也是进  bidding,不需要单独配置,复用 bidding 索引
+#     esaddr = "127.0.0.1:19805"        ## 存入的es 地址
+#     esindex= "bidding"        ## 存入的es 表
+#     esusername="es_all"      ## es 用户名
+#     espassword=""      ## es 密码
+     nextaddr ="172.17.145.179"       ## udp 下个地址
+     nextport =1782      ## udp 下个地址 的端口
  [others.attachment.data]             ## 下个udp 节点传递的数据
-  stype="update"
+     stype="update"
 
 
 

+ 3 - 1
createEsIndex/init.go

@@ -164,6 +164,7 @@ func InitEs() {
 		log.Debug("InitEs", zap.String("IndexBuyer", config.Conf.DB.Es.IndexBuyer))
 	}
 
+	//采集爬虫  单服务器部署的es
 	Es1 = &elastic.Elastic{
 		S_esurl:  config.Conf.DB.Es.AddrP,
 		I_size:   config.Conf.DB.Es.Size,
@@ -172,6 +173,7 @@ func InitEs() {
 	}
 	Es1.InitElasticSize()
 
+	//华为云 部署的es
 	if config.Conf.DB.Es.Addr2 != "" {
 		Es2 = &elastic.Elastic{
 			S_esurl:  config.Conf.DB.Es.Addr2,
@@ -180,7 +182,7 @@ func InitEs() {
 			Password: config.Conf.DB.Es.Password2,
 		}
 		Es2.InitElasticSize()
-		log.Info("InitEs", zap.String("Addr2", config.Conf.DB.Es.Addr2))
+		log.Info("InitEs", zap.String("华为云Addr2", config.Conf.DB.Es.Addr2))
 	}
 
 	log.Info("InitEs", zap.Any("duration", time.Since(now).Seconds()))

+ 7 - 3
createEsIndex/main.go

@@ -383,8 +383,10 @@ func SaveEsMethod() {
 					}()
 					Es.BulkSave(config.Conf.DB.Es.IndexB, arru)
 					if config.Conf.DB.Es.IndexTmp != "" {
-						Es2.BulkSave(config.Conf.DB.Es.IndexTmp, arru) // 新集群
-						Es.BulkSave(config.Conf.DB.Es.IndexTmp, arru)  //老集群
+						if config.Conf.DB.Es.Addr2 != "" {
+							Es2.BulkSave(config.Conf.DB.Es.IndexTmp, arru) // 新集群
+						}
+						Es.BulkSave(config.Conf.DB.Es.IndexTmp, arru) //老集群
 					}
 					if config.Conf.DB.Es.Addr2 != "" {
 						Es2.BulkSave(config.Conf.DB.Es.Indexb2, arru)
@@ -403,7 +405,9 @@ func SaveEsMethod() {
 					}()
 					Es.BulkSave(config.Conf.DB.Es.IndexB, arru)
 					if config.Conf.DB.Es.IndexTmp != "" {
-						Es2.BulkSave(config.Conf.DB.Es.IndexTmp, arru)
+						if config.Conf.DB.Es.Addr2 != "" {
+							Es2.BulkSave(config.Conf.DB.Es.IndexTmp, arru) // 新集群
+						}
 						Es.BulkSave(config.Conf.DB.Es.IndexTmp, arru)
 					}
 					if config.Conf.DB.Es.Addr2 != "" {