Summary of the invention
The impact that other business of relevant database has been caused during data transmission between Hadoop and relevant database in order to have reduced connector, the embodiment of the invention provides a kind of method and connector of control data transmission.Described technical scheme is as follows:
On the one hand, provide a kind of method of control data transmission, described method comprises:
When Hadoop and relevant database carried out data transmission, connector obtained the load information of the server at described relevant database place;
Described connector is controlled described data transmission according to described load information.
Wherein, connector obtains the load information of the server at described relevant database place, comprising:
Described connector receives the load information that the monitor agent on the described server sends;
Perhaps, described connector is surveyed the load information that obtains described server.
Wherein, described connector is controlled described data transmission according to described load information, comprising:
Described connector judges according to described load information whether described server is overload state;
If so, then stop described data transmission; Otherwise, continue described data transmission.
Wherein, described connector judges that according to described load information whether described server is overload state, comprising:
Described connector compares described load information and the first threshold of presetting;
If described load information, determines then that described server has reached overload state more than or equal to described first threshold;
If described load information, determines then that described server does not reach overload state less than described first threshold.
Wherein, determine that described server does not reach after the overload state, also comprises:
Described connector compares described load information and the Second Threshold of presetting;
If described load information more than or equal to described the second threshold values, then reduces the speed of described data transmission;
If described load information less than described the second threshold values, then improves the speed of described data transmission.
Wherein, the above-described method of any one, described load information comprises following at least a: the central processing unit load information of described server, input and output load information and current EMS memory occupation information.
On the other hand, provide a kind of connector, described connector comprises: acquisition module and control module;
Described acquisition module is used for obtaining the load information of the server at described relevant database place when Hadoop and relevant database carry out data transmission;
Described control module is used for controlling described data transmission according to described load information.
Wherein, described acquisition module comprises:
Receiving element is used for receiving the load information that the monitor agent on the described server sends;
Perhaps, probe unit is used for surveying the load information that obtains described server.
Wherein, described control module comprises:
Judging unit is used for judging according to described load information whether described server is overload state;
Performance element is yes if be used for the result of described judging unit, then stops described data transmission; Otherwise, continue described data transmission.
Wherein, described judging unit is used for:
Described load information and the first threshold of presetting are compared;
If described load information, determines then that described server has reached overload state more than or equal to described first threshold;
If described load information, determines then that described server does not reach overload state less than described first threshold.
Wherein, described judging unit also is used for:
After described server does not reach overload state, described load information and the Second Threshold of presetting are compared;
If described load information more than or equal to described the second threshold values, then reduces the speed of described data transmission;
If described load information less than described the second threshold values, then improves the speed of described data transmission.
Wherein, the above-described connector of any one, described load information comprises following at least a: the central processing unit load information of described server, input and output load information and current EMS memory occupation information.
The beneficial effect that the technical scheme that the embodiment of the invention provides is brought is:
By when Hadoop and relevant database carry out data transmission, connector obtains the load information of the server at relevant database place, then according to the load information control data transmission, reduced the impact that connector causes other business of relevant database when data transmission.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, embodiment of the present invention is described further in detail below in conjunction with accompanying drawing.
Data transmission between Hadoop and the relevant database comprises the data importing in the relevant database in Hadoop, perhaps with the data importing among the Hadoop in relevant database.Wherein, referring to Fig. 3, data communication device in the relevant database is crossed the Map task and is imported among the HDFS among the Hadoop, each Map task is responsible for a database table (the perhaps part of a database table) in the relevant database is imported among the HDFS, and Hadoop can carry out a plurality of Map tasks simultaneously; Referring to Fig. 4, data among the Hadoop import in the relevant database by a plurality of Map tasks equally, each Map task is responsible for the transmission of a database table (the perhaps part of a database table), and Hadoop can carry out a plurality of Map tasks simultaneously.
Embodiment one
Referring to Fig. 5, present embodiment provides a kind of method of control data transmission, and described method comprises:
Step 101: when Hadoop and relevant database carried out data transmission, connector obtained the load information of the server at relevant database place;
Step 102: connector is according to the load information control data transmission.
The method of the control data transmission that present embodiment provides, by when Hadoop and relevant database carry out data transmission, connector obtains the load information of the server at relevant database place, then according to the load information control data transmission, reduced the impact that connector causes other business of relevant database when data transmission.
Embodiment two
The embodiment of the invention provides a kind of method of control data transmission, and referring to Fig. 6, described method comprises:
Step 201: connector receives user's input message;
Connector receives the order that the user carries out data transmission, comprising: with the data importing among the Hadoop of appointment in the relevant database of appointment, perhaps, with the data importing in the relevant database of appointment in the Hadoop of appointment.
Step 202: connect the information of obtaining the relevant database of appointment in the input message according to input message, and the generated data transformation task;
Connector can be accessed the data that are stored in the relevant database by JDBC, and checks character and the type of data.
For example, when Hadoop was arrived in the data importing in the relevant database, connector at first used JDBC to check the tables of data that will import, and retrieves the SQL type of row all in the tables of data and row; When the relevant database, connector at first needs to check character and the type of relevant database with the data importing among the Hadoop, generates corresponding class according to the definition of the table in the relevant database.
Step 203: connector sends to Hadoop with data transfer task, carries out data transmission between the Hadoop that begins in appointment and the relevant database of appointment;
Connector sends to Hadoop with data transfer task, Hadoop generates corresponding MapReduce operation according to data transfer task, wherein, a data transfer task obtains a MapReduce operation, each MapReduce operation is then finished in parallel mode by a plurality of map tasks, each Map task is responsible for transmitting a database table (the perhaps part of a database table), and a Hadoop server can be carried out a plurality of Map tasks simultaneously.
Step 204: connector receives the load information that the monitor agent on the server at relevant database place sends:
Load information can comprise following at least a: the central processing unit load information of server, input and output load information and current EMS memory occupation information, when if the load information of server comprises multiple load information, can be with a load information as current server of currency maximum in the load information of all kinds, for example, the load information of server comprises following three kinds: the central processing unit load information of server, input and output load information and current EMS memory occupation information, and the currency of three kinds of load informations is respectively: ten Percent, 20 percent and 30 percent, then the load information of current server is 30 percent.Server deploy monitor agent that can be on relational data periodically obtains the load information of server, then by monitor agent load information is sent connector.
Referring to Fig. 7, connector at first obtains the relational data library information, check character and the type of relational data database data, then submit job is to Hadoop, Hadoop carries out data transmission by carrying out a plurality of Map tasks, each Map task is responsible for the transmission of a database table (the perhaps part of a database table), connector receives the load information that the monitor agent on the server at relevant database place sends, and then controls the control that each Map task realizes data transmission according to load information.
Step 205: connector judges according to load information whether described server is overload state, if then execution in step 206, otherwise, execution in step 207;
Wherein, connector adopts following concrete mode to judge whether server is overload state according to load information:
Connector compares load information and the first threshold of presetting;
If load information, determines then that server has reached overload state more than or equal to first threshold;
If load information, determines then that server does not reach overload state less than first threshold.
The user can specify arbitrarily numerical value to the first threshold values.For example, the user can be made as 90% with the first threshold values, if the load information of server, determines that server has reached overload state more than or equal to 90%; If load information, determines then that server does not reach overload state less than 90%.
Step 206: stop data transmission, flow process finishes;
Step 207: continue data transmission, flow process finishes;
Wherein, step 207 can also comprise:
Connector compares described load information and the Second Threshold of presetting, if load information more than or equal to described the second threshold values, reduces the speed of data transmission, if load information less than described the second threshold values, improves the speed of data transmission.
Then the different load informations constantly of record server carry out statistical study to all different load informations constantly that record obtains, and obtain the second threshold values according to the result of statistical study.In addition, the second threshold values also can be specified by the user, and the user can arrange concrete numerical value to the second threshold values according to actual conditions.
For example, the speed of current data transmission is V
1, load information is compared with the second threshold values, if load information greater than the second threshold values, can be with the speed of current data transmission from V
1Be down to V
2, and V
2=90%V
1If, when the speed of data transmission is V
2The time server load information still more than or equal to the second threshold values, then continue to reduce the speed of data transmission; If load information is less than the second threshold values, the speed that current data can be transmitted is from V
1Be increased to V
3, and V
3=110%V
1If, when the speed of data transmission is V
3The time server load information still less than the second threshold values, then continue to improve the speed of data transmission.
The method of the control data transmission that present embodiment provides, by when Hadoop and relevant database carry out data transmission, connector obtains the load information of the server at relevant database place, then according to the load information control data transmission, reduced the impact that connector causes other business of relevant database when data transmission.
Embodiment three
Referring to Fig. 8, present embodiment provides a kind of method of control data transmission, and described method comprises:
Step 301 ~ 303 are identical with step 201 ~ 203;
Step 304: connector is surveyed the load information of the server that obtains the relevant database place;
Load information can comprise following at least a: the central processing unit load information of server, input and output load information and current EMS memory occupation information, when if the load information of server comprises multiple load information, can be with a load information as current server of currency maximum in the load information of all kinds, for example, the load information of server comprises following three kinds: the central processing unit load information of server, input and output load information and current EMS memory occupation information, and the currency of three kinds of load informations is respectively: ten Percent, 20 percent and 30 percent, then the load information of current server is 30 percent.Connector can periodically be surveyed the load information that obtains server.
Referring to Fig. 9, connector at first obtains the relational data library information, check character and the type of relational data database data, then submit job is to Hadoop, Hadoop carries out data transmission by carrying out a plurality of Map tasks, each Map task is responsible for the transmission of a database table (the perhaps part of a database table), connector is surveyed the load information of the server that obtains the relevant database place, then controls the control that each Map task realizes data transmission according to load information.
Step 305: connector judges according to load information whether described server is overload state, if then execution in step 306, otherwise, execution in step 307;
Wherein, connector adopts following concrete mode to judge whether server is overload state according to load information:
Connector compares load information and the first threshold of presetting;
If load information, determines then that server has reached overload state more than or equal to first threshold;
If load information, determines then that server does not reach overload state less than first threshold.
The user can specify arbitrarily numerical value to the first threshold values.For example, the user can be made as 90% with the first threshold values, if the load information of server, determines that server has reached overload state more than or equal to 90%; If load information, determines then that server does not reach overload state less than 90%.
Step 306: stop data transmission, flow process finishes;
Step 307: continue data transmission, flow process finishes;
Wherein, step 307 can also comprise:
Connector compares load information and the Second Threshold of presetting, if load information more than or equal to the second threshold values, reduces the speed of data transmission, if load information less than the second threshold values, improves the speed of data transmission.
Then the different load informations constantly of record server carry out statistical study to all different load informations constantly that record obtains, and obtain the second threshold values according to the result of statistical study.In addition, the second threshold values also can be specified by the user, and the user can arrange concrete numerical value to the second threshold values according to actual conditions.
For example, the speed of current data transmission is V
1, load information is compared with the second threshold values, if load information greater than the second threshold values, can be with the speed of current data transmission from V
1Be down to V
2, and V
2=90%V
1If, when the speed of data transmission is V
2The time server load information still more than or equal to the second threshold values, then continue to reduce the speed of data transmission; If load information is less than the second threshold values, the speed that current data can be transmitted is from V
1Be increased to V
3, and V
3=110%V
1If, when the speed of data transmission is V
3The time server load information still less than the second threshold values, then continue to improve the speed of data transmission.
The method of the control data transmission that present embodiment provides, by when Hadoop and relevant database carry out data transmission, connector obtains the load information of the server at relevant database place, then according to the load information control data transmission, reduced the impact that connector causes other business of relevant database when data transmission.
Embodiment four
Referring to Figure 10, the embodiment of the invention provides a kind of connector, and this connector comprises: acquisition module 401 and control module 402;
Acquisition module 401 is used for obtaining the load information of the server at this relevant database place when Hadoop and relevant database carry out data transmission;
Control module 402 is used for controlling described data transmission according to this load information.
Wherein, acquisition module 401 comprises:
Receiving element is used for receiving the load information that the monitor agent on the server sends;
Perhaps, acquisition module 401 comprises:
Probe unit is used for surveying the load information that obtains server.
Wherein, referring to Figure 11, control module 402 comprises:
Judging unit 4021 is used for judging according to load information whether server is overload state;
Performance element 4022 is yes if be used for the result of judging unit 4021, then stops data transmission; Otherwise, continue data transmission.
Wherein, judging unit 4021 is used for:
Load information and the first threshold of presetting are compared;
If load information, determines then that server has reached overload state more than or equal to first threshold;
If load information, determines then that server does not reach overload state less than first threshold.
Wherein, judging unit 4021 also is used for:
After server does not reach overload state, load information and the Second Threshold of presetting are compared;
If load information more than or equal to the second threshold values, then reduces the speed of data transmission;
If load information less than the second threshold values, then improves the speed of data transmission.
The connector that present embodiment provides, by when Hadoop and relevant database carry out data transmission, connector obtains the load information of the server at relevant database place, then according to the load information control data transmission, reduced the impact that connector causes other business of relevant database when data transmission.
The invention described above embodiment sequence number does not represent the quality of embodiment just to description.
The all or part of step that one of ordinary skill in the art will appreciate that realization above-described embodiment can be finished by hardware, also can come the relevant hardware of instruction to finish by program, described program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium of mentioning can be ROM (read-only memory), disk or CD etc.
The above only is preferred embodiment of the present invention, and is in order to limit the present invention, within the spirit and principles in the present invention not all, any modification of doing, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.