CN102682043A - Method for connecting distributed databases - Google Patents

Method for connecting distributed databases Download PDF

Info

Publication number
CN102682043A
CN102682043A CN2011100933325A CN201110093332A CN102682043A CN 102682043 A CN102682043 A CN 102682043A CN 2011100933325 A CN2011100933325 A CN 2011100933325A CN 201110093332 A CN201110093332 A CN 201110093332A CN 102682043 A CN102682043 A CN 102682043A
Authority
CN
China
Prior art keywords
database
server
internal memory
handle
information
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.)
Granted
Application number
CN2011100933325A
Other languages
Chinese (zh)
Other versions
CN102682043B (en
Inventor
陈繁荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHANGHAI TVMINING CULTURE MEDIA CO., LTD.
Original Assignee
TVMining Beijing Media Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by TVMining Beijing Media Technology Co Ltd filed Critical TVMining Beijing Media Technology Co Ltd
Priority to CN2011100933325A priority Critical patent/CN102682043B/en
Publication of CN102682043A publication Critical patent/CN102682043A/en
Application granted granted Critical
Publication of CN102682043B publication Critical patent/CN102682043B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method for connecting distributed databases. The information of the databases is stored in each object relational mapping (ORM) class, a slave server can be configured in each database, the problem of master and slave read-write separation can be solved, the databases are required to be connected during database operation of Model classes, and useless database connection is eliminated. By adoption of the technical scheme provided by the invention, redundant database connection can be eliminated, so a developer does not need to maintain database connection and code complexity caused by the database connection; connection of a professional hypertext preprocessor (PHP) and a database server is reduced, and the memory space of the PHP is reduced; the network time and network flow for connection of the database server are reduced, the quantity of connected clients of the database server is decreased, and the connection speed of the databases is improved; the performance overheads of a WEB server and the database server are reduced; and the whole response time of the server is shortened, and the experience of a user is improved.

Description

A kind of distributed data base method of attachment
Technical field
The present invention relates to database technical field, relate in particular to a kind of distributed data base method of attachment.
Background technology
Along with the development of web technologies and service end technology, major applications all adopts the web mode, like web office, web os etc.And the LAMP structure system is the most popular current, a WEB development scheme the most efficiently.The service end operating system that LINUX increases income, security effectiveness is high.Occupancy the highest web http server in Aapache market is safeguarded exploitation by the Apache foundation of increasing income.Mysql is the present most widely used relational database of increasing income, and, high-level efficiency concurrent with height is celebrated.PHP then is the cross-platform web development language of a shop front to object, explanation type.
The user of online is more and more, and data of database also begins rapid expansion, from an original station server; Split into independently mysql database server; Or make read-write and separate two-server, to the independent station server of each database, monopolize a server to each table then again; And be the principal and subordinate and read and write separation, this database server that will use increase gradually from one to up to a hundred.
No matter be general PHP program, or framework, all be to be that unit carries out the data connection with the database, next the framework Zend Framework that increases income with PHP official is the connection management mode that example is explained existing P HP mysql.
What Zend Framework adopted is classical MVC three-tier architecture pattern; Be mapped to a Model class to each tables of data with ORM; Each Model class all can comprise the database information at its place; To comprise database account, password and server address in the connected mode of each database of initial configuration file the inside configuration.Want then to connect this database being carried out initialization at once, could use corresponding Model class to carry out database manipulation.So the database of total system all will connect when system initialization, and when the PHP end of run, discharge.At this moment the network that in the WEB server memory, will safeguard all databases connects, and all databases are waited for the database manipulation of client no matter whether use and all can have a client to connect.
Thereby cause wasting a lot of databases that take and connect thread, not only will safeguard that a database connects handle at the PHP end memory, a network that take operating system connects; And to be connected to the account password checking that database server gets on to carry out the database connection, and wasted the network processes time, increase the response time of server; Make the user experience variation; And take one of database server and connect number clients, can cause the queue waiting time of big client when concurrent, when carrying out the database account password authentification; Cpu, the internal memory of waste database server also have network traffics etc.
If system has only a database, and is then no problem, but along with the increase of system data, or upgrade database hardware of server level, or just carry out distributed fractionation management.If upgrading hardware can reach bottleneck again soon, and expensive, general enterprise all is unaffordable, so the general common server of cheapness that adopts carries out distributed management.And the data of database server at this moment will be pursued increasing of Zhejiang, and when reaching a certain amount of, even remove to connect each database server of initialization, shared resource and time all are intolerable.
So adopt the data base administration mode of Zend Framework, spent resource, performance all is sizable under the ever-increasing situation of the continuous increase of tackling database data and database server.
Summary of the invention
The objective of the invention is to propose a kind of distributed data base method of attachment, can accelerate the whole response time of database server, improve user experience.
For reaching this purpose, the present invention adopts following technical scheme:
A kind of distributed data base method of attachment is characterized in that, may further comprise the steps:
A, client in internal memory, comprise that the principal and subordinate reads and writes separate information and the handle information that is connected database with all database server information configuration;
The database of B, client connects when carrying out package module execution database manipulation, judges that said operation is read operation or write operation, if read operation goes to step C, if write operation goes to step F;
C, judge whether internal memory has existed the handle of the server that is connected to said database place, if exist, then goes to step D, if do not exist, then goes to step e;
D, obtain the handle of the server that is connected to said database place, and carry out database manipulation, return result, flow process finishes;
E, according to the said database server information of storing in the internal memory, set up and being connected of said database server, carry out database manipulation, return result, and will connect handle and be stored in the internal memory flow process end;
F, judge whether internal memory has existed the handle of the server that is connected to said database place, if exist, then goes to step G, if do not exist, then goes to step H;
G, execution database manipulation, return result, flow process finishes;
H, judge that the principal and subordinate of the server whether said database place is arranged in the internal memory reads and writes separate information,, then go to step I,, then return step C if do not have if having;
I, read and write to create the separate information from the principal and subordinate of the server at said database place and connect handle, be stored in the internal memory, and carry out database manipulation, return result, flow process finishes.
In the steps A, employing PHP array in internal memory, comprises that the principal and subordinate reads and writes the array key assignments of separate information and the handle that is connected database with all database server information configuration.
In the steps A, database server information comprises account number cipher information.
Adopted technical scheme of the present invention, can eliminate redundant database and connect, the code complexity that makes the developer not need maintenance data base to connect and bring; Reduced being connected and the memory headroom of use of PHP program and database server, connected the network time and the network traffics of database server in addition, reduced the client linking number of database server, the connection of accelerating database removes row; Reduced the performance cost of WEB server and database server; Accelerate the whole response time of server, improve user experience.
Description of drawings
Fig. 1 is the process flow diagram that distributed data base connects in the specific embodiment of the invention.
Embodiment
Further specify technical scheme of the present invention below in conjunction with accompanying drawing and through embodiment.
The main thought of technical scheme of the present invention is the information that database is all arranged in each ORM class the inside; In each storehouse, can also dispose from server; Can solve the principal and subordinate and read and write separation; The database connection is only just carried out database and is connected when the Model class is carried out database manipulation, do not exist useless database to connect.
Fig. 1 is the process flow diagram that distributed data base connects in the specific embodiment of the invention.As shown in Figure 1, this flow process may further comprise the steps:
Step 101, customer end adopted PHP array in internal memory, comprise that the principal and subordinate reads and writes the array key assignments of separate information and the handle that is connected database with all database server information configuration, and account number cipher information.
The database of step 102, client connects when carrying out package module execution database manipulation, judges that this operation is read operation or write operation, if read operation goes to step 103, if write operation goes to step 106.
Step 103, judge whether internal memory has existed the handle of the server that is connected to database place, if exist, then goes to step 104, if do not exist, then goes to step 105.
Step 104, obtain the handle of the server that is connected to database place, and carry out database manipulation, return result, flow process finishes.
Step 105, according to the database server information of storing in the internal memory, set up and being connected of database server, carry out database manipulation, return result, and will connect handle and be stored in the internal memory flow process end.
Step 106, judge whether internal memory has existed the handle of the server that is connected to database place, if exist, then goes to step 107, if do not exist, then goes to step 108.
Step 107, execution database manipulation, return result, flow process finishes.
Step 108, judge that the principal and subordinate of the server whether database place is arranged in the internal memory reads and writes separate information,, then go to step 109,, then return step 103 if do not have if having.
Step 109, read and write to create the separate information from the principal and subordinate of the server at database place and connect handle, be stored in the internal memory, and carry out database manipulation, return result, flow process finishes.
Under the management mode that this database connects, the database that only is used just can produce database and connect, and does not exist redundant database to connect, and all databases of automatic cutout connect when the PHP EOP (end of program).
The above; Be merely the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, anyly is familiar with this technological people in the technical scope that the present invention disclosed; The variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.

Claims (3)

1. a distributed data base method of attachment is characterized in that, may further comprise the steps:
A, client in internal memory, comprise that the principal and subordinate reads and writes separate information and the handle information that is connected database with all database server information configuration;
The database of B, client connects when carrying out package module execution database manipulation, judges that said operation is read operation or write operation, if read operation goes to step C, if write operation goes to step F;
C, judge whether internal memory has existed the handle of the server that is connected to said database place, if exist, then goes to step D, if do not exist, then goes to step e;
D, obtain the handle of the server that is connected to said database place, and carry out database manipulation, return result, flow process finishes;
E, according to the said database server information of storing in the internal memory, set up and being connected of said database server, carry out database manipulation, return result, and will connect handle and be stored in the internal memory flow process end;
F, judge whether internal memory has existed the handle of the server that is connected to said database place, if exist, then goes to step G, if do not exist, then goes to step H;
G, execution database manipulation, return result, flow process finishes;
H, judge that the principal and subordinate of the server whether said database place is arranged in the internal memory reads and writes separate information,, then go to step I,, then return step C if do not have if having;
I, read and write to create the separate information from the principal and subordinate of the server at said database place and connect handle, be stored in the internal memory, and carry out database manipulation, return result, flow process finishes.
2. a kind of distributed data base method of attachment according to claim 1; It is characterized in that; In the steps A, employing PHP array in internal memory, comprises that the principal and subordinate reads and writes the array key assignments of separate information and the handle that is connected database with all database server information configuration.
3. according to claim 1 or 2 described a kind of distributed data base methods of attachment, it is characterized in that in the steps A, database server information comprises account number cipher information.
CN2011100933325A 2011-04-14 2011-04-14 Method for connecting distributed databases Expired - Fee Related CN102682043B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011100933325A CN102682043B (en) 2011-04-14 2011-04-14 Method for connecting distributed databases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011100933325A CN102682043B (en) 2011-04-14 2011-04-14 Method for connecting distributed databases

Publications (2)

Publication Number Publication Date
CN102682043A true CN102682043A (en) 2012-09-19
CN102682043B CN102682043B (en) 2013-11-27

Family

ID=46813989

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011100933325A Expired - Fee Related CN102682043B (en) 2011-04-14 2011-04-14 Method for connecting distributed databases

Country Status (1)

Country Link
CN (1) CN102682043B (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105279197A (en) * 2014-07-24 2016-01-27 中国银联股份有限公司 Method and apparatus for establishing connection between JavaEE application server and database
CN105677915A (en) * 2016-02-29 2016-06-15 浪潮通用软件有限公司 Distributed service data access method based on engine
CN105893521A (en) * 2016-03-31 2016-08-24 南京烽火软件科技有限公司 Reading-and-writing separation HBase warehousing method
CN107180110A (en) * 2017-06-13 2017-09-19 北京京润恒远科技有限公司 A kind of implementation method of the efficient data bank interface based on DataTable
CN108241641A (en) * 2016-12-23 2018-07-03 航天星图科技(北京)有限公司 A kind of operating method of distributed data base
CN109086432A (en) * 2018-08-10 2018-12-25 纳里健康科技有限公司 A kind of distributed data base read-write middleware
CN109345353A (en) * 2018-10-15 2019-02-15 广东鸭梨云信息科技有限公司 A kind of novel second based on relationship type distributed data base kills method
CN111431969A (en) * 2020-02-28 2020-07-17 平安科技(深圳)有限公司 Unified deployment system and method for connection pool
WO2020238057A1 (en) * 2019-05-29 2020-12-03 平安科技(深圳)有限公司 Redis-based mqtt cluster monitoring method, apparatus, and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111010401A (en) * 2019-12-23 2020-04-14 华中科技大学 Token-based network security framework for distributed water resource management support system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1756190A (en) * 2004-09-30 2006-04-05 北京航空航天大学 Distributed performance data acquisition method
CN101320392A (en) * 2008-07-17 2008-12-10 中兴通讯股份有限公司 High-capacity data access method and device of internal memory database
US20090043786A1 (en) * 2007-08-08 2009-02-12 Schmidt Brian K Network repository for metadata

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1756190A (en) * 2004-09-30 2006-04-05 北京航空航天大学 Distributed performance data acquisition method
US20090043786A1 (en) * 2007-08-08 2009-02-12 Schmidt Brian K Network repository for metadata
CN101320392A (en) * 2008-07-17 2008-12-10 中兴通讯股份有限公司 High-capacity data access method and device of internal memory database

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105279197A (en) * 2014-07-24 2016-01-27 中国银联股份有限公司 Method and apparatus for establishing connection between JavaEE application server and database
CN105677915A (en) * 2016-02-29 2016-06-15 浪潮通用软件有限公司 Distributed service data access method based on engine
CN105893521A (en) * 2016-03-31 2016-08-24 南京烽火软件科技有限公司 Reading-and-writing separation HBase warehousing method
CN108241641A (en) * 2016-12-23 2018-07-03 航天星图科技(北京)有限公司 A kind of operating method of distributed data base
CN107180110A (en) * 2017-06-13 2017-09-19 北京京润恒远科技有限公司 A kind of implementation method of the efficient data bank interface based on DataTable
CN109086432A (en) * 2018-08-10 2018-12-25 纳里健康科技有限公司 A kind of distributed data base read-write middleware
CN109345353A (en) * 2018-10-15 2019-02-15 广东鸭梨云信息科技有限公司 A kind of novel second based on relationship type distributed data base kills method
CN109345353B (en) * 2018-10-15 2022-04-22 广东鸭梨云信息科技有限公司 Novel killing method based on relational distributed database
WO2020238057A1 (en) * 2019-05-29 2020-12-03 平安科技(深圳)有限公司 Redis-based mqtt cluster monitoring method, apparatus, and storage medium
CN111431969A (en) * 2020-02-28 2020-07-17 平安科技(深圳)有限公司 Unified deployment system and method for connection pool

Also Published As

Publication number Publication date
CN102682043B (en) 2013-11-27

Similar Documents

Publication Publication Date Title
CN102682043B (en) Method for connecting distributed databases
CN110062924B (en) Capacity reservation for virtualized graphics processing
US10990288B2 (en) Systems and/or methods for leveraging in-memory storage in connection with the shuffle phase of MapReduce
JP6542785B2 (en) Implementation of semi-structured data as first class database element
US11442961B2 (en) Active transaction list synchronization method and apparatus
KR20140112427A (en) Low latency query engine for apache hadoop
JP2015072688A (en) Background format optimization for enhanced sql-like queries in hadoop
US9501313B2 (en) Resource management and allocation using history information stored in application's commit signature log
EP3040865A1 (en) Database management system and computer system
CN101694626A (en) Script execution system and method
CN106559484A (en) The method that instance system exempts from installation and operation application
CN116601606A (en) Multi-tenant control plane management on a computing platform
CN110134496A (en) Container monitors method, apparatus, equipment and computer readable storage medium
CN103399942A (en) Data engine system supporting SaaS multi-tenant function and working method of data engine system
US20110202564A1 (en) Data store switching apparatus, data store switching method, and non-transitory computer readable storage medium
US11055123B1 (en) System, method, and computer program for providing an ultra-high availability cloud emulator in a multi-tenant SaaS environment controlled by another party
CN108270626A (en) A kind of method, apparatus, equipment and the readable storage medium storing program for executing of upgrade server firmware
WO2018052814A1 (en) Data integration job conversion
US20120137297A1 (en) Modifying scheduled execution of object modification methods associated with database objects
US9588707B2 (en) Object storage power consumption optimization
CN103164347A (en) Method and device of data-caching mechanism
US10803030B2 (en) Asynchronous SQL execution tool for zero downtime and migration to HANA
US20150222485A1 (en) Dynamic server configuration and initialization
JP6366812B2 (en) Computer and database management method
Jordan et al. Wrangler's user environment: A software framework for management of data-intensive computing system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: SHANGHAI TIANMAI JUYUAN CULTURE AND MEDIA CO., LTD

Free format text: FORMER OWNER: TVMINING (BEIJING) MEDIA TECHNOLOGY CO., LTD.

Effective date: 20141226

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100007 DONGCHENG, BEIJING TO: 200436 ZHABEI, SHANGHAI

TR01 Transfer of patent right

Effective date of registration: 20141226

Address after: 200436, No. 166, No. three, 6 Shanghai Road, Zhabei District, China

Patentee after: SHANGHAI TVMINING CULTURE MEDIA CO., LTD.

Address before: 100007, room 2, building 28, No. 816 East Main Street, Dongcheng District, Beijing, Andingmen

Patentee before: TVMining (Beijing) Media Technology Co., Ltd.

PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A method of connecting distributed database

Effective date of registration: 20201224

Granted publication date: 20131127

Pledgee: Inner Mongolia Huipu Energy Co.,Ltd.

Pledgor: SHANGHAI TIANMAI JUYUAN CULTURE MEDIA Co.,Ltd.

Registration number: Y2020990001505

PE01 Entry into force of the registration of the contract for pledge of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20131127

Termination date: 20210414

CF01 Termination of patent right due to non-payment of annual fee