renyupeng 3 yıl önce
ebeveyn
işleme
fe220cd092
1 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. 8 3
      monitor/ApplicationCDCMonitor.py

+ 8 - 3
monitor/ApplicationCDCMonitor.py

@@ -30,9 +30,14 @@ class ApplicationCDCMonitor:
                             headers=headers)
         errrepo = requests.get(url='http://{}:{}{}?state=error'.format(self.cdc_url, self.cdc_port, self.cdc_changefeeds_url),
                                headers=headers)
-        print(errrepo.json(),'---error---')
+        errtask = errrepo.json()
+        if errtask is not None:
+            os.system(
+                'cd /data/tidb-deploy/cdc-8300/bin; ./cdc cli changefeed create --pd=http://192.168.0.184:2379 '
+                '--sink-uri="mysql://data:hcst@2021@139.186.27.96:3390" --config ../conf/{task_id}.toml '
+                '--changefeed-id={task_id} '.format(task_id=errtask['id']))
         message = repo.json()
-        print(message)
+        #print(message)
         for json in message:
             task_id = json['id']
             tso = json['checkpoint_tso']
@@ -45,7 +50,7 @@ class ApplicationCDCMonitor:
                     'cd /data/tidb-deploy/cdc-8300/bin; ./cdc cli changefeed create --pd=http://192.168.0.184:2379 '
                     '--sink-uri="mysql://data:hcst@2021@139.186.27.96:3390" --config ../conf/{task_id}.toml '
                     '--changefeed-id={task_id} --start-ts {tso}'.format(tso=tso, task_id=task_id))
-                print(status)
+                #print(status)
 
                 backResult = requests.get(
                     url='http://{}:{}{}/{}'.format(self.cdc_url, self.cdc_port, self.cdc_changefeeds_url, task_id),