Summary of the invention
The tenant's partition method and device for being designed to provide a kind of multi-tenant of the embodiment of the present invention, to solve existing skill
There is only the limitations for the operating system for relying on bottom for Hadoop multi-tenant mechanism (Yarn) in art, and realize inaccurate
Ground resource isolation also cannot achieve the isolation of platform class;The energy of IaaS must be relied on using the multi-tenant mechanism of IaaS layers of ability
Power, deployment IaaS manage platform software, not only increase cost, and deploy multiple Hadoop clusters, cannot achieve bottom
The problem of data sharing.
To achieve the goals above, tenant's partition method of a kind of multi-tenant provided in an embodiment of the present invention, the method
Include:
Receive the scheduling of resource service request of multiple tenants;The scheduling of resource service request at least carries tenant request
The service arrangement node of service and tenant request;
According to the scheduling of resource service request, according to target copy Distribution Strategy in the tenant request for needing local data
Service arrangement node on dispose n copy of the local data;Wherein, n is the integer more than or equal to 2;
According to the scheduling of resource service request, on the service arrangement node of each tenant request respectively deployment with it is described
The corresponding scheduling of resource service strategy of the service of tenant request.
Wherein, the scheduling of resource service request also carries the instruction information whether instruction tenant needs local data;
It is described according to the scheduling of resource service request, on the service arrangement node for the tenant request for needing local data
The step of disposing n copy of the local data according to target copy Distribution Strategy, comprising:
According to the instruction information, the quantity N for needing the tenant of local data is determined;
The quantity N of the tenant of local data as needed and the service arrangement section for the tenant request for needing local data
Point configures target copy Distribution Strategy;Wherein, the target copy Distribution Strategy includes: the deployment of the quantity n, copy of copy
Node;
Dispose the copy of local data respectively on the deployment node of the copy.
Wherein, the quantity N of the tenant of the local data as needed and the tenant request for needing local data
The step of service arrangement node, configuration target copy Distribution Strategy, comprising:
If desired the service arrangement node of the first tenant request of local data includes the second tenant for needing local data
Whole service arrangement nodes of request obtain the quantity of the second tenant;
The quantity n of configuration copy is equal to the quantity for needing the quantity N of the tenant of local data to subtract the second tenant;
The service arrangement node division that the tenant request of local data will be needed each of other than the second tenant is one
A logical groups obtain m logical groups, and wherein m is equal to n;
It configures and stores a copy in each logical groups, and any one service arrangement node in the logical groups is institute
State the deployment node of copy.
Wherein, if the quantity n of the copy is less than 3, which comprises
Institute is disposed respectively on any n-3 node of all service arrangement nodes for the tenant request for needing local data
State copy.
Wherein, described according to the scheduling of resource service request, on the service arrangement node of each tenant request respectively
After the step of disposing scheduling of resource service strategy corresponding with the service of the tenant request, the method also includes:
The target copy Distribution Strategy and scheduling of resource service strategy correspondence are sent to the multiple tenant.
The embodiment of the present invention also provides a kind of tenant's isolating device of multi-tenant, and described device includes:
Request receiving module, for receiving the scheduling of resource service request of multiple tenants;The scheduling of resource service request
At least carry the service of tenant request and the service arrangement node of tenant request;
Copy deployment module, for being needed according to target copy Distribution Strategy according to the scheduling of resource service request
N copy of the local data is disposed on the service arrangement node of the tenant request of local data;Wherein, n be greater than or
Integer equal to 2;
Scheduling deployment module is used for according to the scheduling of resource service request, in the service arrangement section of each tenant request
Scheduling of resource service strategy corresponding with the service of the tenant request is disposed on point respectively.
Wherein, the scheduling of resource service request also carries the instruction information whether instruction tenant needs local data;
The copy deployment module includes:
First determines submodule, for determining the quantity N for needing the tenant of local data according to the instruction information;
Strategy configuration submodule, the quantity N of the tenant for local data as needed and needs local data
The service arrangement node of tenant request configures target copy Distribution Strategy;Wherein, the target copy Distribution Strategy includes: pair
The deployment node of quantity n originally, copy;
Copy disposes submodule, for disposing the copy of local data respectively on the deployment node of the copy.
Wherein, the strategy configuration submodule includes:
Acquiring unit, the service arrangement node of the first tenant request for if desired local data include to need local number
According to the second tenant request whole service arrangement nodes, obtain the second tenant quantity;
Configuration unit, the quantity n for configuring copy, which is equal to, needs the quantity N of the tenant of local data to subtract second
The quantity of tenant;
Division unit, for the service arrangement of the tenant request of local data will to be needed each of other than the second tenant
Node division is a logical groups, obtains m logical groups, and wherein m is equal to n;
Configuration unit stores a copy for configuring in each logical groups, and any one clothes in the logical groups
Business deployment node is the deployment node of the copy.
Wherein, described device further include:
Deployment unit, if the quantity n for the copy less than 3, in all clothes for the tenant request for needing local data
The copy is disposed respectively on any n-3 node of business deployment node.
Wherein, described device further include:
Sending module, for the target copy Distribution Strategy and scheduling of resource service strategy correspondence to be sent to institute
State multiple tenants.
The above-mentioned technical proposal of the embodiment of the present invention has the beneficial effect that:
In the scheme of the embodiment of the present invention, after each tenant proposes scheduling of resource service request, according to tenant whether needs
Local data does not depend on Yarn bottleneck to need the tenant of local data that target copy Distribution Strategy is arranged and disposing copy, real
Existing data are shared;Different scheduling of resource service strategies is disposed for each tenant simultaneously, the isolation of resource is realized, utilizes in this way
Existing Hadoop technology, under the premise of not depending on lass platform capabilities, the tenant's isolation for accomplishing platform class, and make full use of
Existing Hadoop investment, does not increase lass platform investment budgey.
Specific embodiment
To keep the technical problem to be solved in the present invention, technical solution and advantage clearer, below in conjunction with attached drawing and tool
Body embodiment is described in detail.
As shown in Figure 1, the embodiment of the present invention provides a kind of tenant's partition method of multi-tenant, which comprises
Step 11, the scheduling of resource service request of multiple tenants is received;The scheduling of resource service request at least carries rent
The service of family request and the service arrangement node of tenant request.
In this step, scheduling of resource service request, which can be user and log in, to be initiated after multi-tenant manager, can also be with
It is that user is initiated by certain signalings or information, is not specifically limited herein.
Wherein, the service of tenant request includes but is not limited to be distributed merger to calculate MR, distributed memory system Hbase, big
Data query engine Hive, memory iterative calculation frame Spark, big data inquiry library Impala, another resource coordination person
Yarn etc..
Step 12, according to the scheduling of resource service request, local data is being needed according to target copy Distribution Strategy
N copy of the local data is disposed on the service arrangement node of tenant request;Wherein, n is whole more than or equal to 2
Number.
In this step, the effect of copy is also to be further ensured that each local data that needs to guarantee data security
Tenant is able to access that local data, realizes the data sharing between different tenants.It should be noted that n copy needs to dispose
On n service arrangement node.
Step 13, according to the scheduling of resource service request, portion is distinguished on the service arrangement node of each tenant request
Affix one's name to scheduling of resource service strategy corresponding with the service of the tenant request.
In this step, it is the corresponding scheduling of resource service strategy of service arrangement of each tenant request, realizes different tenants
Between data isolation.
To sum up, after each tenant proposes scheduling of resource service request in the above embodiment of the present invention, according to tenant whether
Local data is needed, to need the tenant of local data that target copy Distribution Strategy is arranged and disposing copy, does not depend on Yarn bottles
Neck realizes the shared of data;Different scheduling of resource service strategies is disposed for each tenant simultaneously, realizes the isolation of resource, this
Sample utilizes existing Hadoop technology, under the premise of not depending on lass platform capabilities, the tenant's isolation for accomplishing platform class, and fill
Divide and invested using existing Hadoop, does not increase lass platform investment budgey
Specifically, in the above embodiment of the present invention, the scheduling of resource service request also carries whether instruction tenant needs
Want the instruction information of local data.
Such as after multiple tenants propose scheduling of resource service request, summarize specific requirement required for each tenant, have
The requirement of body is stored in an array service Request (), and wherein service Request is defined as follows:
class service Request()
{
// the service needed, including but not limited to MR, Hbase, Hive, Spark, Impala
String[]service Name;
// instruction information, indicates whether the tenant needs local data
Boolean is Local Data;
Which service arrangement node the // service needs to be deployed on, is usually indicated with host name or IP
String[]nodes;
}
Correspondingly, step 12 includes:
Step 121, according to the instruction information, the quantity N for needing the tenant of local data is determined;
Step 122, the clothes of the quantity N of the tenant of local data as needed and the tenant request for needing local data
Business deployment node, configures target copy Distribution Strategy;Wherein, the target copy Distribution Strategy includes: the quantity n of copy, pair
This deployment node;
Step 123, the copy of local data is disposed respectively on the deployment node of the copy.
Preferably, step 122 in the above embodiment of the present invention, comprising:
If desired the service arrangement node of the first tenant request of local data includes the second tenant for needing local data
Whole service arrangement nodes of request obtain the quantity of the second tenant;That is the service arrangement node of the second tenant request is first
The subset of the service arrangement node of tenant request.For example, according to the service arrangement section of each tenant request for needing local data
The quantity sequence from small to large (or from big to small) of point successively compares the service arrangement node of each tenant request, to determine the
The quantity of two tenants.
For another example the service arrangement node of the first tenant is 1-5 node, the service arrangement node of the second tenant is 1-3
Number node, then the service arrangement node of the second tenant request is the subset of the service arrangement node of the first tenant request.
For example, the specific algorithm of n is as follows:
1.1: setting n=1;
1.2: circuiting sequentially each tenant from small to large according to the number of the service arrangement node of each tenant request.
1.21: if the service department of any one tenant request before currently the service arrangement node of tenant request includes
Affix one's name to node, that is to say, that the service arrangement node of any one tenant request before is the service arrangement section of current tenant request
The subset of point, then this circulation section end, jumps to 1.2;
1.3:n++.
The quantity n of configuration copy is equal to the quantity for needing the quantity N of the tenant of local data to subtract the second tenant;If
The quantity of second tenant is 0, then the quantity n of copy is equal to the quantity N for needing the tenant of local data.
The service arrangement node division that the tenant request of local data will be needed each of other than the second tenant is one
A logical groups obtain m logical groups, and wherein m is equal to n;
It configures and stores a copy in each logical groups, and any one service arrangement node in the logical groups is institute
State the deployment node of copy.
Specifically, every part of local data generates n copy, needs all service arrangement nodes of local data to be divided into m and patrol
Volume group (m is equal to n), includes all service arrangement nodes of corresponding tenant request in each logical groups, when deployment each logic
At least provided with a copy of local data in group.
It should be noted that the data safety in order to guarantee local data, the quantity of copy need to be more than or equal to 3;But
If being (to need the tenant of local data less than 3 according to the quantity n of the copy obtained by the above method provided by the present application
Quantity N subtract value that the quantity of the second tenant obtains less than 3), which comprises
Institute is disposed respectively on any n-3 node of all service arrangement nodes for the tenant request for needing local data
State copy.3-n i.e. other copy is randomly dispersed on any service arrangement node.
Further, in the above embodiment of the present invention after step 13, the method also includes:
The target copy Distribution Strategy and scheduling of resource service strategy correspondence are sent to the multiple tenant.
Corresponding strategy, which is sent a tenant, enables tenant to define which partial data can be shared, which part resource is real
Isolation is showed.
To sum up, this programme accomplishes platform class under the premise of not depending on IaaS platform capabilities using existing Hadoop technology
Tenant isolation.This programme makes full use of existing Hadoop to invest, and does not increase IaaS platform investment budgey.And this programme can
To accomplish the resource isolation of platform class, independent of Yarn bottleneck.In addition, the abundant shared data of this programme, avoids multiple clusters
Isolated data can not share.
As shown in Fig. 2, the application flow of the embodiment of the present invention is exemplified below.
Step 201, user logs in.
Step 202, it chooses whether to need local data.
Step 203, the service needed is selected.
Step 204, the service arrangement node Configuration Type needed according to selection, then specifies specific service arrangement section
Point.
Step 205, apply successfully, user obtains the access entrance address URL, client and the strategy of various services of cluster
Inventory.
The overall flow of the embodiment of the present invention is exemplified below.
Assuming that three tenants respectively represent tri- fields B, O, M, it is used in conjunction with a Hadoop cluster, to realize that data are total
The component enjoyed and respectively used strictly is isolated, and the demand that three tenants propose is summarized as follows first according to the process of this paper:
//Bss tenant wants deployment Yarn, Hive, Impala, Spark, needs local data, resource is strictly limited in 1-
On No. 5 nodes
Bss Service Request(){
String service Name={ Yarn, Hive, Impala, Spark };
Boolean is Local Data=true;
String [] nodes={ 10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5 };}
//Oss tenant ratio Bss tenant's multi-section affixes one's name to Hbase, needs local data, resource is strictly limited on 6-11 node
Oss Service Request(){
String service Name={ Yarn, Hive, Impala, Spark, Hbase };
Boolean is Local Data=true;
String [] nodes=10.1.1.6,10.1.1.7,10.1.1.8,10.1.1.9,10.1.1.10,
10.1.1.11};}
//Mss tenant only disposes Yarn and Hive, does not need local data, and resource is strictly limited on 1-3 node
Mss Service Request(){
String service Name={ Yarn, Hive };
Boolean is Local Data=false;
String [] nodes={ 10.1.1.1,10.1.1.2,10.1.1.3 };}
Firstly, determining the only Bss and Oss tenant for needing local data according to the method for the offer of the embodiment of the present invention;
And the service arrangement node of Oss tenant request and the service arrangement node of Bss tenant request are not mutually subset, the then quantity of copy
N=needs quantity=2 of the tenant of local data, then the quantity m of logical groups is also 2, the service arrangement that a logical groups include
Node is 1-5 node, and the service arrangement node that another logical groups includes is 6-11 node.Then first copy is deployed in
On any one node of 1-5 node, second copy is deployed on any one node of 6-11 node, due to this Shen
It middle please provide that copy amount is more than or equal to 3, then when n is less than 3, using 3 replication policies;Specifically, third copy portion
Administration is determined by the way of random distribution on any one node of 1-11 node, guarantees that it is evenly distributed.
Secondly, disposing the service respectively needed respectively according to the node requirements that each tenant proposes.
After the completion of disposing in this way, three tenant datas can be shared, while various components are independent of each other, independently of each other.Together
When, each tenant still has the mechanism of Yarn, can distribute resource to each user inside tenant.
It assumes again that three tenants respectively represent tri- fields B, O, M, is used in conjunction with a Hadoop cluster, to realize data
Component that is shared and respectively using strictly is isolated, and the demand that three tenants propose is summarized as follows first according to the process of this paper:
//Bss tenant wants deployment Yarn, Hive, Impala, Spark, needs local data, resource is strictly limited in 1-
On No. 5 nodes
Bss Service Request(){
String service Name={ Yarn, Hive, Impala, Spark };
Boolean is Local Data=true;
String [] nodes={ 10.1.1.1,10.1.1.2,10.1.1.3,10.1.1.4,10.1.1.5 };}
//Oss tenant ratio Bss tenant's multi-section affixes one's name to Hbase, needs local data, resource is strictly limited on 6-11 node
Oss Service Request(){
String service Name={ Yarn, Hive, Impala, Spark, Hbase };
Boolean is Local Data=true;
String [] nodes=10.1.1.6,10.1.1.7,10.1.1.8,10.1.1.9,10.1.1.10,
10.1.1.11};}
//Mss tenant only disposes Yarn and Hive, needs local data, and resource is strictly limited on 1-3 node
Mss Service Request(){
String service Name={ Yarn, Hive };
Boolean is Local Data=true;
String [] nodes={ 10.1.1.1,10.1.1.2,10.1.1.3 };}
Only Bss tenant, the Oss of local data is needed to rent firstly, determining according to the method for the offer of the embodiment of the present invention
Family and Mss tenant, but the service arrangement node of Mss tenant request is the subset of the service arrangement node of Bss tenant request,
I.e. the quantity of the second tenant is 1;Then the quantity n=of copy need the quantity of the second tenant of quantity N- of the tenant of local data=
2.Then the quantity m of logical groups is also 2, and the service arrangement node that a logical groups include is 1-5 node, another logical groups packet
The service arrangement node contained is 6-11 node.Then first copy is deployed on any one node of 1-5 node, and second
A copy is deployed on any one node of 6-11 node, due to providing that copy amount is more than or equal to 3 in the application,
Then when n is less than 3, using 3 replication policies;Specifically, third copy is deployed on any one node of 1-11 node,
It is determined by the way of random distribution, guarantees that it is evenly distributed.
Secondly, disposing the service respectively needed respectively according to the node requirements that each tenant proposes.
After the completion of disposing in this way, three tenant datas can be shared, while various components are independent of each other, independently of each other.Together
When, each tenant still has the mechanism of Yarn, can distribute resource to each user inside tenant.
As shown in figure 3, the embodiment of the present invention also provides a kind of tenant's isolating device of multi-tenant, described device includes:
Request receiving module 31, for receiving the scheduling of resource service request of multiple tenants;The scheduling of resource service is asked
Seek the service arrangement node of the service and tenant request that at least carry tenant request;
Copy deployment module 32, for being needed according to target copy Distribution Strategy according to the scheduling of resource service request
Want the n copy that the local data is disposed on the service arrangement node of the tenant request of local data;Wherein, n be greater than or
Person is equal to 2 integer;
Scheduling deployment module 33 is used for according to the scheduling of resource service request, in the service arrangement of each tenant request
Scheduling of resource service strategy corresponding with the service of the tenant request is disposed on node respectively.
Specifically, in the above embodiment of the present invention, the scheduling of resource service request also carries whether instruction tenant needs
Want the instruction information of local data;
The copy deployment module includes:
First determines submodule, for determining the quantity N for needing the tenant of local data according to the instruction information;
Strategy configuration submodule, the quantity N of the tenant for local data as needed and needs local data
The service arrangement node of tenant request configures target copy Distribution Strategy;Wherein, the target copy Distribution Strategy includes: pair
The deployment node of quantity n originally, copy;
Copy disposes submodule, for disposing the copy of local data respectively on the deployment node of the copy.
Specifically, in the above embodiment of the present invention, the strategy configuration submodule includes:
Acquiring unit, the service arrangement node of the first tenant request for if desired local data include to need local number
According to the second tenant request whole service arrangement nodes, obtain the second tenant quantity;
Configuration unit, the quantity n for configuring copy, which is equal to, needs the quantity N of the tenant of local data to subtract second
The quantity of tenant;
Division unit, for the service arrangement of the tenant request of local data will to be needed each of other than the second tenant
Node division is a logical groups, obtains m logical groups, and wherein m is equal to n;
Configuration unit stores a copy for configuring in each logical groups, and any one clothes in the logical groups
Business deployment node is the deployment node of the copy.
Specifically, in the above embodiment of the present invention, described device further include:
Deployment unit, if the quantity n for the copy less than 3, in all clothes for the tenant request for needing local data
The copy is disposed respectively on any n-3 node of business deployment node.
Specifically, in the above embodiment of the present invention, described device further include:
Sending module, for the target copy Distribution Strategy and scheduling of resource service strategy correspondence to be sent to institute
State multiple tenants.
In the scheme of the embodiment of the present invention, after each tenant proposes scheduling of resource service request, according to tenant whether needs
Local data does not depend on Yarn bottleneck to need the tenant of local data that target copy Distribution Strategy is arranged and disposing copy, real
Existing data are shared;Different scheduling of resource service strategies is disposed for each tenant simultaneously, the isolation of resource is realized, utilizes in this way
Existing Hadoop technology, under the premise of not depending on lass platform capabilities, the tenant's isolation for accomplishing platform class, and make full use of
Existing Hadoop investment, does not increase lass platform investment budgey.
It should be noted that tenant's isolating device of multi-tenant provided in an embodiment of the present invention is to be able to carry out above-mentioned more rents
Tenant's isolating device of tenant's partition method at family, then all embodiments of tenant's partition method of above-mentioned multi-tenant are suitable for
The device, and can reach the same or similar friendship effect.
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art
For, without departing from the principles of the present invention, it can also make several improvements and retouch, these improvements and modifications
It should be regarded as protection scope of the present invention.