Common Database sharding and table sharding methods for Mysql Databases

Source: Internet
Author: User

Common Database sharding and table sharding methods for Mysql Databases
1. Database sharding 1.1 database sharding according to functions. It is commonly divided into six major databases:
1. User Class Library: used to save user information. For example, db_user, db_system, and db_company.
2. Business Library: used to store information about major businesses. For example, the main business is joke, and the library is used to save the joke business. For example, db_joke and db_temp_joke.
3. Memory Class Library: It mainly uses the Mysql memory engine. The front-end data is quickly searched from the memory library. For example, heap.
4. Image Library: Stores image indexes and associations. For example, db_img_index and db_img_res.
5. Log Class Library: Record click, refresh, logon, and other log information. For example, db_log_click, db_log_fresh, and db_log_login.
6. Statistics class library: business statistics, such as clicks and refreshes. For example, db_stat.

1.2 install the City Station sub-database. if the business is spread all over the country, copy the same database in each city according to the function sub-database, but the database suffix is the city name. For example, db_log_click_bj, db_log_click_tj, and db_log_click_sh;

2. Table sharding 2.1 users or businesses can be divided into n tables according to the Number % n of users or businesses.

Example: joke table.

Tb_joke_01, tb_joke_02, tb_joke_03, tb_joke_04 ........


2.2 date-based table sharding for tables with logs or statistical classes. The table can be sharded by year, month, day, and week.

For example, click count statistics.

Tb_click_stat_201601, tb_click_stat_201602, tb_click_stat_201603


3. Core Architecture of Mysql Databases: one master, multiple slave databases, and read/write splitting.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.