Tag:python mysqldump script parameter
Python script reference and Python call Mysqldump<pre name= "code" class= "Python" > #coding =utf-8import mysqldbimport sysimport os# Li Hongying Write, user Hunan CLV data segmentation using print ' Dump database: ', sys.argv[1] # #传入的第一个参数, database name print ' Dump table: ', sys.argv[2] # #传入的第二个参数, Table name Dbname=sys.argv[1]tablename=sys.argv[2] #同步数据值分析服务器2: # region_id:b C D edump101= ' Mysqldump-h10.33.2.71-uprobe- P5029 [email protected]--database ' +dbname+ '--table ' +tablename+ '-W ' region_id in (\ ' b\ ', \ ' c\ ', \ ' d\ ', \ ' e\ ') "| Mysql-h192.168.106.101-uprobe [email protected]-p5029 ' +dbnameresult=os.system (dump101) #同步数据值分析服务器3: # Region _id:f G H idump102= ' mysqldump-h10.33.2.71-uprobe-p5029 [email protected]--database ' +dbname+ '--table ' +tablenam E+ '-W ' region_id in (\ ' f\ ', \ ' g\ ', \ ' h\ ', \ ' i\ ') ' | Mysql-h192.168.106.102-uprobe [email protected]-p5029 ' +dbnameresult=os.system (dump102) #同步数据值分析服务器4: # Region _id:j K L M ndump103= ' mysqldump-h10.33.2.71-uprobe-p5029 [email protected]--database ' +dbname+ '--table ' +tablen Ame+ '-W "region_id in (\ ' j\ ', \ ' k\ ', \ ' l\ ', \ ' m\ ', \ ' n\ ')" | Mysql-h192.168.106.103-uprobe [email protected]-p5029 ' +dbnameresult=os.system (dump103)