Summary of the invention
In view of this, the embodiment of the invention provides a kind of blog is carried out reading and writing method of operating and system, the lower problem of efficient when in order to solve in the prior art blog being carried out the reading and writing operation.
A kind of method that blog is carried out read or write, said method comprises:
The master receives the read or write request that the user sends with load-balanced server, discerns the information of the network of this user attaching;
According to the network of this user attaching of discerning, in the web server cluster, select the web server of corresponding network;
This read or write request is sent to the said web server of selection, corresponding database is carried out read or write through said web server.
Said web server carries out write operation to corresponding database and comprises:
Said web server carries out write operation through the gateway mode to MDL.
Said web server carries out write operation to corresponding database, comprising:
Said web server carries out the blog identification information of write operation according to said user, searches the corresponding tables of data of this identification information, and this tables of data is carried out write operation.
Said method also comprises:
The Web backstage is synchronized to the write operation of user to said MDL from database.
Said web server carries out read operation to corresponding database and comprises:
Said web server is selected to postpone less database according to said MDL with from the delay of database, and the database less to this delay carries out read operation.
Said web server carries out read operation to corresponding database and comprises:
Said web server is searched the corresponding tables of data of this identification information according to the blog identification information that said user carries out read operation, and this tables of data is carried out read operation.
Said method also comprises:
When said master is broken down with load-balanced server, notify the reading and writing operation requests of subsequent use load-balanced server process user through HA.
A kind of system that blog is carried out read or write, said system comprises:
User side is used to send user's read or write request;
The master uses load-balanced server, is used to receive the read or write request that the user sends, and discerns the information of the network of this user attaching; According to the network of this user attaching of discerning, in the web server cluster, select the web server of corresponding network; This read or write request is sent to the said web server of selection;
The web server is used for corresponding database is carried out read or write.
Said web server specifically is used for through the gateway mode MDL being carried out write operation.
Said web server specifically is used for carrying out according to said user the identification information of the blog of write operation, searches the corresponding tables of data of this identification information, and this tables of data is carried out write operation.
Said system also comprises:
The Web backstage is used for the write operation to said MDL with the user, is synchronized to from database.
Said web server specifically is used for selecting to postpone less database according to said MDL with from the delay of database, and the database less to this delay carries out read operation.
Said web server specifically is used for carrying out according to said user the identification information of the blog of read operation, searches the corresponding tables of data of this identification information, and this tables of data is carried out read operation.
Said system also comprises:
Subsequent use load-balanced server, the HA that sends when being used to receive said master and breaking down notice, the reading and writing operation of process user with load-balanced server.
The embodiment of the invention provides a kind of blog has been carried out reading and writing method of operating and system; This method comprises: the main read or write request that receives user's transmission with load-balanced server; According to the network of user attaching, adopt the web server of map network that this user's read or write request is handled.Owing to pass through the network of load-balanced server according to user attaching in the embodiment of the invention; User's read or write request is sent to the web server of map network; This read or write request is handled; Thereby the web server of avoiding belonging to heterogeneous networks is handled user's read or write request, has improved the efficient that blog is read or write.
Embodiment
In order to improve the efficient of blog being carried out the reading and writing operation; The invention provides and a kind of blog is carried out reading and writing method of operating and system; Through the network of load-balanced server according to user attaching; User's read or write request is sent to the web server of map network; Web server by this map network is handled this read or write request, thereby avoids the web server different with the user attaching network that user's read or write request is handled, and has improved the efficient that the user reads or writes blog.
Below in conjunction with Figure of description, the present invention is elaborated.
Fig. 1 carries out the process of write operation for a kind of of the embodiment of the invention to blog, and this process may further comprise the steps:
S101: the master discerns the information of the network of this user attaching with the user's of load-balanced server reception user side transmission write operation requests.
Receive the write operation requests that the user sends through load-balanced server in the present invention, load-balanced server is according to the information of the network of user attaching, the write operation requests of dispatch user.
In addition; In the present invention in order to guarantee the stability of system; Load-balanced server adopts active/standby mode, when the master is in normal condition with load-balanced server, receives the also write operation requests of dispatch user by main with load-balanced server; Can't operate as normal (power down, fault, the machine of delaying) time, inform that through HA communication subsequent use load-balanced server receives the also write operation requests of dispatch user with load-balanced server when main.
S102:, in the web server cluster, select the web server of corresponding network according to the network of this user attaching of discerning.
In the web server cluster, be provided with the web server that belongs to every kind of network among the present invention, and many web servers arranged to every kind of network settings.Main with the network of load-balanced server according to user attaching, select the web server of map network for this user.Promptly, select communication network web server,, mainly select the network web of Netcom server with load-balanced server when this user attaching during in Netcom's network when user attaching during in communication network.
S103: this write operation requests is sent to the web server of selection, corresponding database is carried out write operation through this web server.
Concrete, the web server comprises when corresponding database is carried out write operation: the web server carries out write operation through the gateway mode to MDL.The web server adopts the gateway mode that database is carried out write operation in embodiments of the present invention, can effectively improve data processing efficiency.
Owing to disposed the web server cluster in embodiments of the present invention, realize load balancing through load-balanced server, thereby alleviated the visit pressure of web server, therefore guaranteed the stability of web server.
In addition; This user's data table is set to each user in the prior art, more when same user's blog quantity, and Blog content more for a long time; Will cause the capacity of this tables of data very big, also can receive very big influence so call the speed of this tables of data.In order to improve the efficient of calling tables of data, blog is distinguished in the embodiment of the invention, and corresponding tables of data is set, this tables of data is kept in the database to each blog according to the identification information of each blog.
When the web server carried out write operation to corresponding database, the web server carried out the identification information of the blog of write operation according to said user, searched the corresponding tables of data of this identification information, and this tables of data is carried out write operation.The concrete corresponding tables of data of the identification information that can set up each blog in embodiments of the present invention.For example, the identification information of blog can be the ID of blog, behind the ID delivery to blog; The tables of data corresponding according to the information setting behind the ID delivery of this blog; And when carrying out write operation, carry out the ID of the blog of write operation according to the user who receives, to the ID delivery of this blog; Search the corresponding tables of data of information behind the ID delivery of this blog, this tables of data is carried out write operation get final product.
In addition; Can also further divide this tables of data in embodiments of the present invention; To the corresponding tables of data of the identification information of each blog; This tables of data is divided into first tables of data and second tables of data again, and wherein first tables of data supplies the user when browse operation, to use, and second tables of data supplies the user when concrete write operation, to use.
In order further to improve the efficient that the user carries out the reading and writing operation to blog, be provided with MDL in embodiments of the present invention and from database, the corresponding tables of data of each blog is kept at MDL and simultaneously from database.When the user carried out write operation to blog, the web server directly was written to these data in the corresponding tables of data of the identification information of this blog of MDL, and through the web backstage with the write operation of user to MDL, be synchronized to from database.The Web backstage can be carried out to MDL with from the simultaneous operation of database in real time, also can carry out at one's leisure, specifically can select flexibly as required.
Fig. 2 a kind ofly carries out the detailed process of write operation to blog for what the embodiment of the invention provided, and this process may further comprise the steps:
S201: the master receives the write operation requests that the user sends with load-balanced server, discerns the information of the network of this user attaching.
S202:, in the web server cluster, select the web server of corresponding network according to the network of this user attaching of discerning.
S203: the main web server that this write operation requests is sent to selection with load-balanced server.
The S204:web server is searched the corresponding tables of data of this identification information according to the identification information that this user carries out the blog of write operation.
The S205:web server carries out write operation through the gateway mode to this tables of data in the MDL according to this tables of data that finds.
The S206:web backstage was arrived the information synchronization in the MDL from database according to the time interval of setting.
Above-mentioned for blog being carried out the explanation of write operation in the embodiment of the invention, describe in the face of the process of in the embodiment of the invention blog being carried out read operation down.
A kind of process that blog is carried out read operation that Fig. 3 provides for the embodiment of the invention, this process may further comprise the steps:
S301: the master receives the read operation request that the user sends with load-balanced server, discerns the information of the network of this user attaching.
Specifically as among the step S101 to the corresponding description of write operation requests.
S302:, in the web server cluster, select the web server of corresponding network according to the network of this user attaching of discerning.
Specifically as among the step S102 to the corresponding description of write operation requests.
S303: this read operation request is sent to the web server of selection, corresponding database is carried out read operation through the web server.
The concrete web server that passes through carries out read operation to corresponding database and comprises: the web server is selected to postpone less database according to said MDL with from the delay of database, and the database less to this delay carries out read operation.
In addition; Owing to preserve the corresponding tables of data of identification information of each blog at MDL with from database; Concrete when corresponding database is carried out read operation; Carry out the identification information of the blog of read operation according to this user, search the corresponding tables of data of this identification information, this tables of data is carried out read operation.
A kind of detailed process that blog is carried out read operation that Fig. 4 provides for the embodiment of the invention, this process may further comprise the steps:
S401: the master receives the read operation request that the user sends with load-balanced server, discerns the information of the network of this user attaching.
S402:, in the web server cluster, select the web server of corresponding network according to the network of this user attaching of discerning.
S403: the main web server that this read operation request is sent to selection with load-balanced server.
The S404:web server is searched the corresponding tables of data of this identification information according to the identification information that this user carries out the blog of read operation.
The S405:web server selects to postpone less database according to this tables of data that finds from MDL with from database, and the tables of data that this identification information is corresponding in this database is carried out read operation.
Fig. 5 carries out reading and writing operated system configuration diagram for what the embodiment of the invention provided to blog, in this system, comprises:user side 51, main with load-balanced server 52, web server 53.And also comprise in this system: subsequent use load-balanced server 54 and web backstage 55.
User side 51 is used to send user's read or write request;
Main with load-balanced server 52, be used to receive the read or write request that the user sends, discern the information of the network of this user attaching; According to the network of this user attaching of discerning, in the web server cluster, select the web server of corresponding network; This read or write request is sent to the said web server of selection;
Web server 53 is used for corresponding database is carried out read or write.
Saidweb server 53 specifically is used for through the gateway mode MDL being carried out write operation.
Saidweb server 53 specifically is used for carrying out according to said user the blog identification information of write operation, searches the corresponding tables of data of this identification information, and this tables of data is carried out write operation.
Said system also comprises:
Web backstage 55 is used for the write operation to said MDL with the user, is synchronized to from database.
Saidweb server 53 specifically is used for selecting to postpone less database according to said MDL with from the delay of database, and the database less to this delay carries out read operation.
Saidweb server 53 specifically is used for carrying out according to said user the identification information of the blog of read operation, searches the corresponding tables of data of this identification information, and this tables of data is carried out read operation.
Said system also comprises:
Subsequent use load-balanced server 54, the HA that sends when being used to receive said master and breaking down notice, the reading and writing operation of process user with load-balanced server.
The embodiment of the invention provides a kind of blog has been carried out reading and writing method of operating and system; This method comprises: the main read or write request that receives user's transmission with load-balanced server; According to the network of user attaching, adopt the web server of map network that this user's read or write request is handled.Owing to pass through the network of load-balanced server according to user attaching in the embodiment of the invention; User's read or write request is sent to the web server of map network; This read or write request is handled; Thereby avoid the web server different that user's read or write request is handled, improved the efficient that the user reads or writes blog with the user attaching network.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, belong within the scope of claim of the present invention and equivalent technologies thereof if of the present invention these are revised with modification, then the present invention also is intended to comprise these changes and modification interior.