In recent work, we need to design a complete system, including B/S web services and databases, and the C/S structure of the application layer private communication protocol.ProgramModule, involving interaction with external databases and external modules.
Because I am really a little bit of a design, and I am not familiar with database and web, after I have divided modules of the entire system, I have to interact with the database, or there are a lot of questions about the internal database construction method of the system.
So I chatted with a DB expert from our company for a short time with curiosity. Benefits! Now I will summarize my experiences.
The interaction permission control between the application layer and the database is generally designed in two forms:
1. Database: Assign user permissions to the database. Different applications use different user names to interact with the database. This method is suitable for each module with clearly defined permissions.
2. Application Layer: the database assigns certain permissions to an application (main module), and then the application provides a set of APIs to encapsulate some operations on the database. It can be called by other applications. This method is suitable for sub-modules (sub-users) that frequently need to change permissions)
Try to use a database at the initial stage of system design: (logical)
Unless it is determined that there is no intersection between the two databases, it can be separated in design as different databases. Otherwise, you can use the entire system database at the initial stage of the system design to Configure permissions and create tables as a whole. This is because it is very simple to separate data. If the initial design involves logical separation, it is likely to cause greater trouble in the future.
About database clusters:
Both Oracle and MySQL provide database clusters.
The cluster is generally divided into two types: 1. equivalent to Server Load balancer (performance) 2. Backup (Security)
During database design, the storage space is not considered for Small and Medium Scales. (If not, add the hard disk .) Even if a large database needs to consider the storage space, database vendors have many mature solutions and do not need to consider them themselves ..
A database cluster is similar to a distributed system. It uses a unified gateway server to transmit data between machines through fiber cables (if needed. -- This is all about the research of database vendors, and there are also many mature solutions.
MySQL may not be worse than oracle. Even now, using MySQL may not be unprofessional.
Finally,
I am very grateful to our DB expert Kong for your patience in literacy ~