Micro course lesson 3 common installation method

Time:2020-11-27

https://v.youku.com/v_show/id…

In the last issue, we introduced how to install dble through docker. If it is a normal installation method, what should we do?

Micro course lesson 3 common installation method

I also have an installation video demo. In theory, we should build two real MySQL environments, but MySQL is not our focus today, so MySQL is still done in container mode. Our dble is installed in a separate package. There is a quick start in the dble manual. You can take time to read it. Next, install the demo.

https://v.youku.com/v_show/id…

MySQL installation

First, download the installation package published on GitHub. After decompressing, a directory named dble is generated under the current directory. Since the MySQL service is not installed and enabled, it is very convenient to start the MySQL service with docker first. Next, specify the name of the container where the MySQL service is located, and specify the login password and mapping port. In docker, the MySQL port is 3306, and the port mapping host is 33061. You can understand that the port of MySQL database is 33061, and the first one is completed. The second is to change the container name and port to avoid conflicts. In this way, two MySQL databases can be used. Then use docker PS to check that both MySQL are running. This completes the preparation of MySQL. Next, prepare dble.

Installation and configuration of dble

Let me give you a perceptual understanding of dble installation. The default installation package in our dble directory will have three XML template files. It is already configured, just copy the template file into the official file name. Then modify the corresponding properties in the configuration, that is, point to the two MySQL I just built. Next, I’m going to revise it schema.xml Properties of. Our schema file is used to organize schema, table, database and data nodes. Delete some redundant configurations from the template file, which are basically additional functions. After we delete some redundant configuration, it is a clean configuration file. There are two datahosts, one writehost IP1 in each datahost. Literally, it means the data write node. We need to change the IP and port of the write node to the database we just installed, including URL, MySQL user name and password. After the corresponding attributes of the two sets have been changed, dble has pointed to the nodes of the two MySQL installed just now in terms of configuration. There is also a value of our data node. After changing, we will save it. After this modification, we will start.

Start of dble

Let’s find the start file of dble entered under bin and start it. How can I prove that my dble is started? We see a successful one in the log and it will start. Of course, you can use PS to observe the progress. After grep, we found that there are three dble related processes, one is the dble daemons, the second is the dble java process, and the third is the grep process. The results showed that I installed a dble service and then changed to another terminal. At the other terminal, the dble is pointed through 8066. As you can see, the version related information of dble will be written in the version status. Weshow datebasesThere are two libraries that have been configured. Execute in TestDBshow tablesNo watch! But my schema file obviously has a lot of tables just now. This is because when building from scratch, both MySQL databases are empty and no database tables have been created. Therefore, it is reasonable to fail to see the results. Now we need to create databases and tables to make these tables in dble configuration available. Check it out first schema.xml File, which databases do I use. We’ll be right after that schema.xml Explain in detail. Now let’s be perceptual. We have six datanotes, which point to my two datahosts: datahost1 and datahost2. There are three databases on each. Therefore, we need to build the database through the application on the management side. We can also operate on the real MySQL database node, and the effect is the same. Let me show you how to create a database through dble.

Management side operation of dble

We need to use the user manager on the management side, and the corresponding port is 9066. Log in to dble with the user name and password of the management side to rebuild the database. In fact, the database transmits the command of creating database to the backend MySQL database node through dble. If the library already exists, there is no need to create it. If the library is not created, it is created additionally. Because it is a command from the management side. This command is defined by ourselves. The details of the command can be found in our manual. I refer to the database in MySQL instance through the datanote in database. This part can be done through the wildcard, which is 1 to 6, so write 1-6 like this. The libraries in the two MySQL instances have been established. Here, we only need to modify port 33061 and establish db1-3-5 database. The schema in the configuration file defines the database with mapping relationship of 1-3-5. Create another database in the same way. Then create a table, and then I prepare a temporary table here in advance_ table.sql Documents. The contents are some table building statements and some simple insert statements. Log in to 8066 again, and execute the statement through MySQL Source command. Now let’s check the status of my table and see that I have established the table and inserted some initialization data into the node. So let’s seeshow databases。 Select one of the databases,show all tablesSee a split table. Then go to another TESTDB2. TESTDB2 only shows the ability of another dble. In fact, it is not a split table, but dble forwards it here. A non split and split table can also be provided. Then we can look at a watch at randomshow create table, a column of ID and a column of content. select ,insert ,update delete。 Prove that the database is running.

Some notes

You can see that the order of the results of each selection is different. Dble is unstable at this level. Without order by, the data sorting and clustering index are not guaranteed to be consistent. As you can see, this table is actually split according to the modulus, so now we explain the query results, which are DN2, DN3, DN4 and DN1. Because my modulus result starts from 0, so 1 will route to the second node, 1234 corresponds to 2341. This is the demo we installed. In fact, we should have a lot of questions. It doesn’t matter. We can take the problem to the demo later. OK, that’s all for today.

In order to facilitate reading, some spoken words are optimized without affecting learning. The manuscript and the video will be consistent as far as possible.

Dble and related project code address:

https://github.com/actiontech…
https://github.com/actiontech…
https://github.com/actiontech…