In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. A simple schema.xml file:
1. Contents of the file:
Select user ()
2. Description:
(2.1),
In this line of parameters, schema name defines the name of the logical database that can be displayed at the front end of the MyCAT
When the parameter checkSQLschema is False, it indicates that MyCAT will automatically ignore the database name before the table name, such as mydatabase1.test1, and will be treated as test1
SqlMaxLimit specifies a limit on the number of rows returned by the SQL statement; if limit appears in the sql statement, the sqlMaxLimit here will be overwritten.
(2.2),
Global indicates that the compay table is a global table in the database corresponding to the node node_db01
(2.3),
(2.4), mod-long in rule.xml:
Id
Mod-long
three
The count value is the number of nodes in the database
If there are three databases db1,db2,db3
DataHost only wrote one indicating that there is only one physical database and there are three different logical libraries.
(2.5). Whether balance enables read-write separation:
When balance=0, the read operations are all on localhost (when localhost fails, the backend fails directly).
In the case of balance=1, the read operation is randomly distributed over the localhost1 and the two readhost (when the localhost fails, the write operation is on the localhost1, and if the localhost1 fails again, the write operation cannot be performed).
In balance=2, the write operation will be on the localhost, and the read operation will be randomly distributed on the localhost1,localhost1 and the two readhost (ditto)
We only have a database server hostM1 here, so balance=0.
The writeType write operation is only written to a few nodes:
In the case of writeType=0, the write operation will only be on localhost. If localhost fails, it will automatically switch to localhost1,localhost and will not switch back to localhost for write operation after recovery.
During writeType=1, write operations will be randomly distributed on localhost and localhost1. A single point of failure will not affect the write operation of the cluster, but the slave database at the back end will not be able to get updates from the dead master database, and there will be data inconsistencies when reading data.
We only have a database server hostM1 here, so balance=0.
(2. 7), whether master-slave switching is enabled or not in switchType= "- 1, 1, 1, 7, 7, 7, 5, 5, 5, 5, 4, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 and 4.
-1: indicates that master-slave switching is not enabled
1: the default value, automatically switched
2: decide whether to switch based on the status of master-slave synchronization, corresponding to the show slave status heartbeat
3: based on multi-master galary cluster switching, corresponding to show status like 'wsrep%' heartbeat
Note: multiple writeHost nodes need to be configured for switchType=1, 2 and 3.
Heartbeat heartbeat detection: switchType and heartbeat are used together.
Show slave status-heartbeat detection statement, usually select user ()
If it is switchType=2, whether to switch is decided based on the master-slave synchronization status, then the heartbeat is set to show slave status
If it is switchType=3, the heartbeat is set to show status like 'wsrep%'
Second, a slightly more complex schema.xml file:
1. Contents of the file:
Select user ()
2. Description:
(2.1),
This row represents the global table, which means that the item_test table will hold a complete copy of the data in all four dataNode, so the query will only be distributed to one node.
Configuration of primaryKey did not find where the role, just ignore it, later found and then make up.
Childtable is a structure that depends on the parent table, which means that the joinkey of childtable will be split together according to the policy of the parentKey of the parent table.
When the parent table joins the child table and the join condition is childtable.joinKey=parenttable.parentKey, no cross-library join occurs.
(2. 3), writeType and balance are the key parameters used to control the read-write separation of the backend cluster. Here, the cluster configuration of double master and double slaves is used.
So writeType= "1", balance= "1"
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.