CN109241028A - A kind of database multi-tenant implementation method based on Mycat - Google Patents
A kind of database multi-tenant implementation method based on Mycat Download PDFInfo
- Publication number
- CN109241028A CN109241028A CN201810870967.3A CN201810870967A CN109241028A CN 109241028 A CN109241028 A CN 109241028A CN 201810870967 A CN201810870967 A CN 201810870967A CN 109241028 A CN109241028 A CN 109241028A
- Authority
- CN
- China
- Prior art keywords
- tenant
- mycat
- user
- business
- library
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 20
- 238000005538 encapsulation Methods 0.000 claims abstract description 7
- 235000014510 cooky Nutrition 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 3
- 238000002955 isolation Methods 0.000 abstract description 4
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
- G06F8/24—Object-oriented
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The database multi-tenant implementation method based on Mycat that the present invention is more particularly directed to a kind of.The database multi-tenant implementation method based on Mycat encapsulates login interface, obtains affiliated business library tenant according to user name and password, the tenant of return is as the first parameter for accessing other business;Control layer blocker is encapsulated, user has got business library tenant after logining successfully, tenant is passed to control layer blocker before all business accesses;Encapsulation business bearing interface rewrites sql sentence using the note that sql blocker and Mycat are provided, and Mycat agency can be routed automatically to execution sql sentence in tenant business library in parsing.The database multi-tenant implementation method based on Mycat, can allow multiple users to share a set of application program, in the environment configurations cost and O&M cost for guaranteeing that IT application in enterprises cost can be effectively reduced while data isolation and safety, reduce software vendor.
Description
Technical field
The present invention relates to technical field of computer software development, in particular to a kind of database multi-tenant based on Mycat
Implementation method.
Background technique
With the rapid development of Internet technology, software product and service also experienced earth-shaking variation.Relative to
Traditional software service mode, SaaS(Software-as-a-Service, software service) significantly reduce company information chemical conversion
This, puts into concentration of enterprises energy in business activities, and multi-tenant is that SaaS service mode is different from traditional software mode
Most essential distinction.
Multi-tenant is a kind of software architecture technology, and it is identical to be how a kind of discussion shares under multi-user environment with realization
System or program assembly, and can ensure that the isolation of data between each user.
For above situation, the database multi-tenant implementation method based on Mycat that the invention proposes a kind of is ensureing number
Identical system or program assembly are shared under multi-user environment according to realizing while isolation.
Summary of the invention
In order to compensate for the shortcomings of the prior art, the present invention provides a kind of database based on Mycat being simple and efficient is more
Tenant's implementation method.
The present invention is achieved through the following technical solutions:
A kind of database multi-tenant implementation method based on Mycat, it is characterised in that: encapsulation login interface, according to user name with
Password obtains affiliated business library tenant, and the tenant of return is as the first parameter for accessing other business;Encapsulate control layer
Blocker, user have got business library tenant after logining successfully, tenant is passed to control layer before all business accesses
Blocker;Encapsulation business bearing interface rewrites sql sentence using the note that sql blocker and Mycat are provided, and Mycat agency exists
Execution sql sentence in tenant business library can be routed automatically to when parsing.
Specifically includes the following steps:
(1) user generates unique tenant ID, while the affiliated business library of distributing user according to registration user name in Registering product
And business library belonging to generating identifies tenant;
(2) when user logs in, tenant ID is obtained by user name, then the mark of business library belonging to the user is obtained by tenant ID
tenant;
(3) after user logins successfully, affiliated business library mark tenant is stored together with session information;
(4) it is explained using Mycat and rewrites sql sentence, be routed automatically to sql sentence in business library in parsing.
The step (1) specifically includes the following steps:
(a) user automatically creates unique tenant ID with user name binding according to the user name of typing and deposits in Registering product
Store up database;
(b) after generating tenant ID according to user name, the affiliated business library with tenant ID binding is distributed automatically and generates affiliated business
Library identifies tenant storage to database, and affiliated business library mark tenant is obtained after logging in for each user and used.
In the step (2), when user logs in software, tenant ID is obtained by user name, then base is inquired by tenant ID
Plinth library configures mapping relations and obtains the affiliated business library mark tenant of login user.
In the step (3), after user logins successfully and gets affiliated business library, affiliated business library is identified into tenant
Be stored in session(session) or cookie(be stored in data on user local terminal), whens other easily accessible business, is obtained
The mark of business library belonging to taking tenant.
The step (4) specifically includes the following steps:
(a) note for encapsulating Sql blocker and being provided using Mycat rewrites Sql sentence sql="/*!mycat:schema="
+ tenant + " */" + sql;
(b) Mycat can be routed automatically in tenant business library in parsing and execute the processing of Sql sentence finishing service.
The beneficial effects of the present invention are: being somebody's turn to do the database multi-tenant implementation method based on Mycat, multiple users can be allowed total
With a set of application program, it is soft that IT application in enterprises cost, reduction can be effectively reduced while guaranteeing data isolation with safety
The environment configurations cost and O&M cost of part supplier.
Detailed description of the invention
Attached drawing 1 is that the present invention is based on the database multi-tenant implementation method schematic diagrames of Mycat.
Specific embodiment
In order to which technical problems, technical solutions and advantages to be solved are more clearly understood, tie below
Drawings and examples are closed, the present invention will be described in detail.It should be noted that specific embodiment described herein is only used
To explain the present invention, it is not intended to limit the present invention.
The database multi-tenant implementation method based on Mycat encapsulates login interface, obtains institute according to user name and password
The business library tenant of category, the tenant of return is as the first parameter for accessing other business;Encapsulate control layer blocker, user
It has got business library tenant after logining successfully, tenant is passed into control layer blocker before all business accesses;Encapsulation
Service bearer interface rewrites sql sentence using the note of sql blocker and Mycat offer, and Mycat agency can be certainly in parsing
It is dynamic to be routed to execution sql sentence in tenant business library.
The database multi-tenant implementation method based on Mycat, comprising the following steps:
(1) user generates unique tenant ID, while the affiliated business library of distributing user according to registration user name in Registering product
And business library belonging to generating identifies tenant;
(2) when user logs in, tenant ID is obtained by user name, then the mark of business library belonging to the user is obtained by tenant ID
tenant;
(3) after user logins successfully, affiliated business library mark tenant is stored together with session information;
(4) it is explained using Mycat and rewrites sql sentence, be routed automatically to sql sentence in business library in parsing.
The step (1) specifically includes the following steps:
(a) user automatically creates unique tenant ID with user name binding according to the user name of typing and deposits in Registering product
Store up database;
(b) after generating tenant ID according to user name, the affiliated business library with tenant ID binding is distributed automatically and generates affiliated business
Library identifies tenant storage to database, and affiliated business library mark tenant is obtained after logging in for each user and used.
In the step (2), when user logs in software, tenant ID is obtained by user name, then base is inquired by tenant ID
Plinth library configures mapping relations and obtains the affiliated business library mark tenant of login user.
In the step (3), after user logins successfully and gets affiliated business library, affiliated business library is identified into tenant
Be stored in session(session) or cookie(be stored in data on user local terminal), whens other easily accessible business, is obtained
The mark of business library belonging to taking tenant.
The step (4) specifically includes the following steps:
(a) note for encapsulating Sql blocker and being provided using Mycat rewrites Sql sentence sql="/*!mycat:schema="
+ tenant + " */" + sql;
(b) Mycat can be routed automatically in tenant business library in parsing and execute the processing of Sql sentence finishing service.
Claims (6)
1. a kind of database multi-tenant implementation method based on Mycat, it is characterised in that: encapsulation login interface, according to user name
Affiliated business library tenant is obtained with password, the tenant of return is as the first parameter for accessing other business;Encapsulation control
Layer blocker, user have got business library tenant after logining successfully, tenant is passed to control before all business accesses
Layer blocker;Encapsulation business bearing interface rewrites sql sentence, Mycat agency using the note that sql blocker and Mycat are provided
Execution sql sentence in tenant business library can be routed automatically in parsing.
2. the database multi-tenant implementation method according to claim 1 based on Mycat, which is characterized in that including following
Step:
User generates unique tenant ID in Registering product, according to registration user name, while the affiliated business library of distributing user is simultaneously
Business library belonging to generating identifies tenant;
When user logs in, tenant ID is obtained by user name, then the mark of business library belonging to the user is obtained by tenant ID
tenant;
After user logins successfully, affiliated business library mark tenant is stored together with session information;
It is explained using Mycat and rewrites sql sentence, be routed automatically to sql sentence in business library in parsing.
3. the database multi-tenant implementation method according to claim 2 based on Mycat, which is characterized in that the step
(1) specifically includes the following steps:
User automatically creates unique tenant ID with user name binding according to the user name of typing and stores number in Registering product
According to library;
After generating tenant ID according to user name, the affiliated business library with tenant ID binding is distributed automatically and generates affiliated business library mark
Tenant storage is known to database, and affiliated business library mark tenant is obtained after logging in for each user and used.
4. the database multi-tenant implementation method according to claim 2 based on Mycat, it is characterised in that: the step
(2) in, when user logs in software, tenant ID is obtained by user name, then base library is inquired by tenant ID and configures mapping relations
It obtains the affiliated business library of login user and identifies tenant.
5. the database multi-tenant implementation method according to claim 2 based on Mycat, it is characterised in that: the step
(3) in, user logins successfully and after business library belonging to getting, by affiliated business library mark tenant be stored in session or
Cookie, obtain when other easily accessible business belonging to business library identify tenant.
6. the database multi-tenant implementation method according to claim 2 based on Mycat, which is characterized in that the step
(4) specifically includes the following steps:
The note for encapsulating Sql blocker and being provided using Mycat rewrites Sql sentence sql="/*!mycat:schema=" +
tenant + " */" + sql;
Mycat can be routed automatically in tenant business library in parsing and execute the processing of Sql sentence finishing service.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810870967.3A CN109241028A (en) | 2018-08-02 | 2018-08-02 | A kind of database multi-tenant implementation method based on Mycat |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810870967.3A CN109241028A (en) | 2018-08-02 | 2018-08-02 | A kind of database multi-tenant implementation method based on Mycat |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109241028A true CN109241028A (en) | 2019-01-18 |
Family
ID=65072776
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810870967.3A Pending CN109241028A (en) | 2018-08-02 | 2018-08-02 | A kind of database multi-tenant implementation method based on Mycat |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109241028A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110163002A (en) * | 2019-05-29 | 2019-08-23 | 上海有谱网络科技有限公司 | A kind of method of SaaS software tenant data isolation |
CN110389821A (en) * | 2019-07-24 | 2019-10-29 | 广州小鹏汽车科技有限公司 | More account processing methods, processing unit, application program and electronic device |
CN110765489A (en) * | 2019-10-30 | 2020-02-07 | 深圳前海环融联易信息科技服务有限公司 | Multi-tenant database isolation method and system, electronic device and computer storage medium |
CN111008220A (en) * | 2019-11-14 | 2020-04-14 | 珠海格力电器股份有限公司 | Dynamic identification method and device of data source, storage medium and electronic device |
CN111177776A (en) * | 2019-12-20 | 2020-05-19 | 平安资产管理有限责任公司 | Multi-tenant data isolation method and system |
CN112653665A (en) * | 2020-11-25 | 2021-04-13 | 航天信息股份有限公司广州航天软件分公司 | Data isolation interaction method and system based on cloud service |
CN112905630A (en) * | 2021-03-31 | 2021-06-04 | 浙江太美医疗科技股份有限公司 | Data manipulation method, server, and computer-readable medium |
CN112905636A (en) * | 2021-03-31 | 2021-06-04 | 浙江太美医疗科技股份有限公司 | Data manipulation method, server, and computer-readable medium |
CN112995126A (en) * | 2021-01-25 | 2021-06-18 | 上海契云科技有限公司 | Management method for supporting multiple data isolation strategies by multi-tenant platform |
CN113449323A (en) * | 2021-07-17 | 2021-09-28 | 绿漫科技有限公司 | Data isolation system combined with authority control |
CN114546563A (en) * | 2022-02-23 | 2022-05-27 | 北京京航计算通讯研究所 | Multi-tenant page access control method and system |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101639835A (en) * | 2008-07-30 | 2010-02-03 | 国际商业机器公司 | Method and device for partitioning application database in multi-tenant scene |
CN102708316A (en) * | 2012-04-19 | 2012-10-03 | 北京华胜天成科技股份有限公司 | Method for isolating data in multi-tenant architecture |
CN103036856A (en) * | 2011-10-09 | 2013-04-10 | 镇江金软计算机科技有限责任公司 | Multi-tenant system achievement based on software as a service (SAAS) application |
US20140114805A1 (en) * | 2012-10-19 | 2014-04-24 | International Business Machines Corporation | System and method for custom-fitting services to consumer requirements |
CN105872055A (en) * | 2016-03-31 | 2016-08-17 | 浪潮通用软件有限公司 | Online monitoring method and system for computer systems in network distributed deployment mode |
CN107533616A (en) * | 2015-03-02 | 2018-01-02 | 销售力网络公司 | System and method for making data safety |
-
2018
- 2018-08-02 CN CN201810870967.3A patent/CN109241028A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101639835A (en) * | 2008-07-30 | 2010-02-03 | 国际商业机器公司 | Method and device for partitioning application database in multi-tenant scene |
CN103036856A (en) * | 2011-10-09 | 2013-04-10 | 镇江金软计算机科技有限责任公司 | Multi-tenant system achievement based on software as a service (SAAS) application |
CN102708316A (en) * | 2012-04-19 | 2012-10-03 | 北京华胜天成科技股份有限公司 | Method for isolating data in multi-tenant architecture |
US20140114805A1 (en) * | 2012-10-19 | 2014-04-24 | International Business Machines Corporation | System and method for custom-fitting services to consumer requirements |
CN107533616A (en) * | 2015-03-02 | 2018-01-02 | 销售力网络公司 | System and method for making data safety |
CN105872055A (en) * | 2016-03-31 | 2016-08-17 | 浪潮通用软件有限公司 | Online monitoring method and system for computer systems in network distributed deployment mode |
Non-Patent Citations (1)
Title |
---|
PRESTIGEDING: "Mycat 多租户方案", 《HTTPS://BLOG.CSDN.NET/PRESTIGEDING/ARTICLE/DETAILS/52662426》 * |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110163002A (en) * | 2019-05-29 | 2019-08-23 | 上海有谱网络科技有限公司 | A kind of method of SaaS software tenant data isolation |
CN110163002B (en) * | 2019-05-29 | 2023-06-13 | 上海有谱网络科技有限公司 | Data isolation method for SaaS software tenants |
CN110389821A (en) * | 2019-07-24 | 2019-10-29 | 广州小鹏汽车科技有限公司 | More account processing methods, processing unit, application program and electronic device |
CN110765489A (en) * | 2019-10-30 | 2020-02-07 | 深圳前海环融联易信息科技服务有限公司 | Multi-tenant database isolation method and system, electronic device and computer storage medium |
CN111008220A (en) * | 2019-11-14 | 2020-04-14 | 珠海格力电器股份有限公司 | Dynamic identification method and device of data source, storage medium and electronic device |
CN111177776A (en) * | 2019-12-20 | 2020-05-19 | 平安资产管理有限责任公司 | Multi-tenant data isolation method and system |
CN112653665A (en) * | 2020-11-25 | 2021-04-13 | 航天信息股份有限公司广州航天软件分公司 | Data isolation interaction method and system based on cloud service |
CN112995126A (en) * | 2021-01-25 | 2021-06-18 | 上海契云科技有限公司 | Management method for supporting multiple data isolation strategies by multi-tenant platform |
CN112905630A (en) * | 2021-03-31 | 2021-06-04 | 浙江太美医疗科技股份有限公司 | Data manipulation method, server, and computer-readable medium |
CN112905636A (en) * | 2021-03-31 | 2021-06-04 | 浙江太美医疗科技股份有限公司 | Data manipulation method, server, and computer-readable medium |
CN113449323A (en) * | 2021-07-17 | 2021-09-28 | 绿漫科技有限公司 | Data isolation system combined with authority control |
CN114546563A (en) * | 2022-02-23 | 2022-05-27 | 北京京航计算通讯研究所 | Multi-tenant page access control method and system |
CN114546563B (en) * | 2022-02-23 | 2023-04-28 | 北京京航计算通讯研究所 | Multi-tenant page access control method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109241028A (en) | A kind of database multi-tenant implementation method based on Mycat | |
CN108920494B (en) | Isolated access method of multi-tenant database, server and storage medium | |
US11930015B2 (en) | Systems and method for authenticating users of a data processing platform from multiple identity providers | |
US9047462B2 (en) | Computer account management system and realizing method thereof | |
CN107526624B (en) | Intelligent contract execution engine based on Java virtual machine | |
Mietzner et al. | Towards provisioning the cloud: On the usage of multi-granularity flows and services to realize a unified provisioning infrastructure for saas applications | |
CN104283875B (en) | Cloud disk right management method | |
CN105991734B (en) | A kind of cloud platform management method and system | |
CA2894894C (en) | Computer-implemented method, system and computer program product for deploying an application on a computing resource | |
KR102243793B1 (en) | Method and apparatus for code virtualization and remote process call generation | |
CN106411857B (en) | A kind of private clound GIS service access control method based on virtual isolation mech isolation test | |
CN101408899B (en) | Method and apparatus for switching website multiple data sources | |
CN103297410B (en) | Account intercommunication system and its application method | |
CN103023933B (en) | A kind of log-on message Integrated Processing System and method | |
US20130254761A1 (en) | Granular application sessions tagging | |
US10091179B2 (en) | User authentication framework | |
CN103336709B (en) | A kind of method and system for realizing the distributed unified management of virtualization in the cluster | |
CN104639603B (en) | A kind of RESTful Service Design methods based on Spring MVC | |
CA2915619A1 (en) | Method and apparatus for customized software development kit (sdk) generation | |
CN106980501A (en) | A kind of software package management method, device and system | |
CN104572099B (en) | Lower coupling frame data processing method and system based on component and middleware | |
CN104660997A (en) | Service oriented multi-source heterogeneous video surveillance adaptation method and system | |
CN108156009B (en) | Service calling method and device | |
CN104967515B (en) | A kind of identity identifying method and server | |
JP4641506B2 (en) | Session management program, session management method, and session management apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190118 |