In the actual project contact, you can more or less hear some distributed databases. After a long time, I think about learning it myself.
Ali's cobar is a commonly used distributed database middleware
First we download cobar on github
After downloading, I found that there are only java files in it. At the beginning, I directly clicked the startup error in the bin. In fact,
At this time we need to compile it, clean install in the idea
After compiling there is a cobar-server-1.2.7.zip
after decompression
Modify the configuration of schema.xml
schema name='dbtest' is defined for you to be exposed, or it can be said to encapsulate the database name exposed to the user
dataNode is the database node
datasource is the database configuration,
Create three databases dbtest1, 2, 3 in your local mysql and create a table for user
Configure database access in server.xml
Then these configurations are basically done, click on startup under bin
cobar starts, there are log records under the log folder
Insert a few pieces of data View the database save information according to the id save rule of the rule
Insert two new data, go to the database to verify
The first insert with id 1 is in dbtest2
The insert with id 555 is in dbtest3