SymmetricDS installation records and metrics ricds records

Source: Internet
Author: User

SymmetricDS installation records and metrics ricds records

This installation record is based on the example in the getting ricds Quick Start Guide and installed on two machines.

Installation environment

Machine1: hadoop3.highgo.com

Machine2: hadoop4.highgo.com

Install javasricds

1. Download The ricdsserver program and download the ric-3.6.14 file. Decompress the package to the/opt/directory of the two machines and change the root directory owner of mongoricds to highgo.

2. As the root, Hadoop4.highgo.com is responsible for the corp Database, hadoop3.highgo.com is the store, And store001 is the database. On the hadoop4 side, copy the corp-000.properties file under the samples directory under the mongoricds installation copy root directory to the engines directory, on the hadoop3 side, copy the store-001.properties file under the samples directory under the mongoricds installation copy root directory to the engines directory. Modify the database information of two configuration files. My configuration is as follows:

db.driver=org.postgresql.Driverdb.url=jdbc:postgresql://hadoop3/4.highgo.com/store001db.user=highgodb.password=highgo

3. Configure registry. url in the configuration file of the Store.

registration.url=http://hadoop4.highgo.com:8080/sync/corp-000

In this way, the master-slave relationship at the metrics ricds layer is equivalent to that of the primary ricds node.

Install databases, create business tables, import initial data, and create system tables

1. One PostgreSQL database instance is installed on both machines, and the database user highgo and password highgo are created respectively. Create a store001 database on hadoop3.highgo.com, the owner is highgo, the corp database is created on hadoop4.highgo.com, and the owner is highgo.

2. Run the following command in the samples directory of the replica installed on the hadoop4:

../bin/dbimport --engine corp-000 --format XMLcreate_sample.xml

This is the practice in the document. However, after executing the preceding command, an error is reported and the file create_sample.xml cannot be found. Open this file and you will find that the definitions of several tables are defined in a common xml format. There are four tables, item_selling_price, sale_transaction, and sale_return_line_item. Write SQL statements directly based on the description in the xml file. The SQL statements written are as follows:

createtable item(item_id INTEGER PRIMARY KEY,name VARCHAR(100)) createtable item_selling_price(item_id INTEGER REFERENCES item(item_id),store_idVARCHAR(5),priceDECIMAL(10,2),costDECIMAL(10,2),PRIMARYKEY(item_id,store_id)) createtable sale_transaction(tran_id INTEGER PRIMARY KEY,  store_id VARCHAR(5) NOT NULL,workstation VARCHAR(3) NOT NULL,day VARCHAR(10) NOT NULL,seq INTEGER NOT NULL) createtable sale_return_line_item(tran_id INTEGER PRIMARY KEY REFERENCES sale_transaction(tran_id),item_id INTEGER NOT NULL REFERENCES item(item_id),price DECIMAL(10,2) NOT NULL,quantity INTEGER NOT NULL,returned_quantity INTEGER)

These four tables are the business tables of our distribution business example.

3. On the hadoop4 side, execute the following command:

../bin/symadmin --engine corp-000create-sym-tables

This command is used to create the system table of the metrics ricds instance. If the execution is successful, no error is reported.

4. On the hadoop4 side, execute the following command:

../bin/dbimport --engine corp-000insert_sample.sql

The Insert_sample. SQL file consists of two parts: one is to insert sample data into the business table, and the other is to insert the system data of this sample to the system table of metrics ricds. First, two nodes are created, then two channels are created, six triggers are created, three routers are created, and six triggers-Router Links are created, the so-called creation here is actually to insert the created information to the system table.

By the way, an error is also reported when this command is executed. The insert_sample. SQL file cannot be found. I opened this file and executed it on the PostgreSQL command line part. It is estimated that the entire file can be executed.

5. On the hadoop3 end, go to the samples directory under the root directory of the mongoricds installation copy of store001 and execute the following command:

../bin/dbimport --engine store-001 --format XMLcreate_sample.xml

The purpose of this command is the same as that of the second command on hadoop4. It is to create a business table for this example. Of course, an error is also reported during execution. If the file cannot be found, run the preceding SQL statement here.

Start javasricds

1. Run the following command in the samples directory under the root directory of the primary ricds installation copy on hadoop4, that is, root, and corp:

../bin/sym --engine corp-000 --port 8080

This process will create necessary triggers and other components based on the previous configuration file and the data inserted in the metrics ricds system table. Wait for registration of other nodes.

2. On the hadoop3 side, that is, the client side, the store side executes the following command in the samples directory under the root directory where the replica is installed on mongoricds:

../bin/sym --engine store-001 --port 8080

Run this command to start the javasricds program on hadoop3. And try to connect to the root node according to the configuration information. Of course, at this time, the registration of the root end has not been enabled. At this time, the root end can receive the registration request of the primary ricds on hadoop3, but the authentication will fail.

Register nodes

Run the following command in the samples directory under the root directory of the replica installed in mongoricds on hadoop4:

../bin/symadmin --engine corp-000open-registration store 001

Enable registration for store 001, And then you can see the successful registration information. For convenience, You can first disable the firewalls of the two machines.

Initiate initial load

At first, we inserted several pieces of data into the business table of the database on hadoop4, but the business tables of the database on hadoop3 were empty. To synchronize data, we must first synchronize this part of data, which is called the initial synchronization load. To initiate this initial load synchronization, run the following command:

../bin/symadmin --engine corp-000reload-node 001

Push data

You can see from the data inserted in the preceding insert_sample. SQL file to the metrics ricds system table that the synchronization configuration of the item table and item_selling_price table is from the corp end (hadoop4) to the store end (hadoop3 ), one-way data, that is, when we insert a piece of data from the corp end, the data will be pushed to the store end, while adding a piece of data from the store end will not affect the data on the corp end.

Below we insert two pieces of data into the database of corp:

insert into "item" ("item_id","name") values (110000055, 'Soft Drink');insert into"item_selling_price" ("item_id", "store_id","price") values (110000055, '001', 0.65); insert into "item_selling_price"("item_id", "store_id", "price") values(110000055, '002', 1.00);

After the two insert statements are executed on the hadoop4 end, check the data on the hadoop3 end. The data should have been synchronized.

Pull data

You can see from the data inserted in the preceding insert_sample. SQL file to the mongoricds system table that the synchronization configuration of the sale_transaction table and sale_return_line_item table is synchronized from store (hadoop3) to corp (hadoop4 ), one-way, that is, if we add a piece of data from the store (hadoop3), the data will be pushed to the corp (hadoop4), and add a piece of data from the corp (hadoop4, this does not affect the data on the store (hadoop3.

Below we insert two pieces of data into the database at the store end:

insert into "sale_transaction" ("tran_id","store_id", "workstation", "day","seq") values (1000, '001', '3', '2007-11-01', 100);insert into"sale_return_line_item" ("tran_id", "item_id","price", "quantity") values (1000, 110000055, 0.65, 1);

After the two insert statements are executed on the hadoop3 end, check the database on the hadoop4 end and check that the data has been synchronized.

Related Article

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.