Table of Contents
安装环境
安装SymmetricDS
安装数据库、创建业务表、导入初始数据、创建系统表
启动SymmetricDS
注册节点
发起初始负载
推送数据
拉取数据
Home Database Mysql Tutorial SymmetricDS安装记录

SymmetricDS安装记录

Jun 07, 2016 pm 04:11 PM
based on Install Record

本安装记录基于SymmetricDS Quick Start Guide中的样例,安装在两个机器上。 安装环境 Machine1:hadoop3.highgo.com Machine2:hadoop4.highgo.com 安装SymmetricDS 1. 下载SymmetricDS服务器程序,当前是Symmetric-3.6.14,下载Symmetric-3.6.14-server.zi

本安装记录基于SymmetricDS Quick Start Guide中的样例,安装在两个机器上。

安装环境

Machine1:hadoop3.highgo.com

Machine2:hadoop4.highgo.com

安装SymmetricDS

1. 下载SymmetricDS服务器程序,当前是Symmetric-3.6.14,下载Symmetric-3.6.14-server.zip文件。解压到两台机器的/opt/目录下,更改SymmetricDS根目录拥有者为highgo。

2. Hadoop4.highgo.com作为root端,负责corp数据库,hadoop3.highgo.com作为store端,负责store001数据库。在hadoop4端,将SymmetricDS安装副本根目录下的samples目录下的corp-000.properties文件复制到engines目录下,在hadoop3端,将SymmetricDS安装副本根目录下的samples目录下的store-001.properties文件复制到engines目录下。修改两个配置文件的数据库信息,我的配置如下:

db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://hadoop3/4.highgo.com/store001
db.user=highgo
db.password=highgo
Copy after login

3. Store端的配置文件需要配置registration.url

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

SymmetricDS层面上的主从关系,也就是这么来的,真正运行起来,SymmetricDS就跟它的名字一样Symmetric,各个节点是对等的。

安装数据库、创建业务表、导入初始数据、创建系统表

1. 分别在两台机器上安装了一个PostgreSQL数据库实例,分别创建数据库用户highgo,密码为highgo。在hadoop3.highgo.com 上创建store001数据库,owner为highgo,在hadoop4.highgo.com上创建corp数据库,owner为highgo。

2. 在hadoop4端的SymmetricDS安装副本的samples目录下执行下面的命令:

../bin/dbimport --engine corp-000 --format XMLcreate_sample.xml
Copy after login

这是文档上的做法,不过执行上边的命令后,报错,找不到create_sample.xml这个文件。于是打开这个文件发现就是几张表的定义,是以xml这种通用的格式定义的。一共四张表item,item_selling_price,sale_transaction,sale_return_line_item。索性根据xml文件中的描述,直接写SQL语句,写成的SQL语句如下:

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
)
Copy after login

这四个表是我们这个分销业务的例子的业务表。

3. 还是在hadoop4端,执行下面的命令:

../bin/symadmin --engine corp-000create-sym-tables
Copy after login

这个命令是创建SymmetricDS的系统表,这个执行成功,没有报错什么的。

4. 还是在hadoop4端,执行下面的命令:

../bin/dbimport --engine corp-000insert_sample.sql
Copy after login

Insert_sample.sql文件主要分两部分,一个是往业务表里插入样例数据,另一部分是往SymmetricDS的系统表里插入本样例的系统数据。首先创建了两个节点,然后创建了两个channel,又创建了6个trigger,接着创建了3个Router,最后创建了6个Trigger-Router Links,这里所谓的创建,其实就是往系统表里插入创建的信息而已。

顺便说下,这条命令执行的时候,也是报错,找不到insert_sample.sql文件,我是打开这个文件,一部分一部分,在PostgreSQL的命令行执行的。估计执行整个文件也可以。

5. 在hadoop3端,进入到store001的SymmetricDS安装副本的根目录下的samples目录,执行下面的命令:

../bin/dbimport --engine store-001 --format XMLcreate_sample.xml
Copy after login

这条命令跟第二条在hadoop4端执行的目的是一样的,都是创建本样例的业务表。当然了,执行也是报错的,找不到文件,将上边的SQL语句,在这在执行一遍就可以了。

启动SymmetricDS

1. 在hadoop4端,也就是root端,corp端,在SymmetricDS安装副本的根目录下的samples目录下执行下面的命令:

../bin/sym --engine corp-000 --port 8080
Copy after login

这个过程会根据之前的配置文件和在SymmetricDS系统表中插入的数据,创建必要的Trigger等等的组件。然后等待其他节点的注册。

2. 在hadoop3端,也就是client端,store端在SymmetricDS安装副本的根目录下的samples目录下执行下面的命令:

../bin/sym --engine store-001 --port 8080
Copy after login

这条命令,启动hadoop3上的SymmetricDS程序。并根据配置信息尝试连接root节点。当然,由于这时候,root端的注册还没开启,这时候,在root端可以收到hadoop3上的SymmetricDS的注册请求,但是认证会失败。

注册节点

在hadoop4上的SymmetricDS安装副本的根目录下的samples目录下执行下面的命令:

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

为store 001 开启注册,这时候就能看到注册成功的信息了。为了方便,可以先把两台机器的防火墙先关闭。

发起初始负载

开始我们在hadoop4端的数据库的业务表上插入了几条数据,但是hadoop3上的数据库的业务表都是空的。既然要同步,那我们必须先把这一部分的数据同步,这一部分数据的同步就叫做同步初始负载。要发起这个初始负载同步,要执行下面的命令,还是在hadoop3的SymmetricDS安装副本的samples目录下执行:

../bin/symadmin --engine corp-000reload-node 001
Copy after login

推送数据

从上边的insert_sample.sql文件中往SymmetricDS系统表中插入的数据可以知道,item表和item_selling_price表的同步配置是从corp端(hadoop4)到store端(hadoop3),单向的,也就是说,我们从corp端插入一条数据,数据会被推送到store端,而我们从store端增加一条数据,则不会影响到corp端的数据。

下面我们在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);
Copy after login

在hadoop4端执行完这两条插入语句后,在hadoop3端的数据查看一下,数据应该已经同步了。

拉取数据

从上边的insert_sample.sql文件中往SymmetricDS系统表中插入的数据可以知道,sale_transaction表和sale_return_line_item表的同步配置是从store端(hadoop3)同步到corp端(hadoop4),单向的,也就是说,我们从store端(hadoop3)增加一条数据,数据会被推送到corp端(hadoop4),而从corp端(hadoop4)增加一条数据,则不会影响到store端(hadoop3)的数据。

下面我们在store端的数据库中插入两条数据:

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);
Copy after login

在hadoop3端执行完这两条插入语句后,在hadoop4端的数据库查看一下,数据应该已经同步了。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solution to the problem that Win11 system cannot install Chinese language pack Solution to the problem that Win11 system cannot install Chinese language pack Mar 09, 2024 am 09:48 AM

Solution to the problem that Win11 system cannot install Chinese language pack With the launch of Windows 11 system, many users began to upgrade their operating system to experience new functions and interfaces. However, some users found that they were unable to install the Chinese language pack after upgrading, which troubled their experience. In this article, we will discuss the reasons why Win11 system cannot install the Chinese language pack and provide some solutions to help users solve this problem. Cause Analysis First, let us analyze the inability of Win11 system to

Unable to install guest additions in VirtualBox Unable to install guest additions in VirtualBox Mar 10, 2024 am 09:34 AM

You may not be able to install guest additions to a virtual machine in OracleVirtualBox. When we click on Devices>InstallGuestAdditionsCDImage, it just throws an error as shown below: VirtualBox - Error: Unable to insert virtual disc C: Programming FilesOracleVirtualBoxVBoxGuestAdditions.iso into ubuntu machine In this post we will understand what happens when you What to do when you can't install guest additions in VirtualBox. Unable to install guest additions in VirtualBox If you can't install it in Virtua

Where can I view the records of things I have purchased on Pinduoduo? How to view the records of purchased products? Where can I view the records of things I have purchased on Pinduoduo? How to view the records of purchased products? Mar 12, 2024 pm 07:20 PM

Pinduoduo software provides a lot of good products, you can buy them anytime and anywhere, and the quality of each product is strictly controlled, every product is genuine, and there are many preferential shopping discounts, allowing everyone to shop online Simply can not stop. Enter your mobile phone number to log in online, add multiple delivery addresses and contact information online, and check the latest logistics trends at any time. Product sections of different categories are open, search and swipe up and down to purchase and place orders, and experience convenience without leaving home. With the online shopping service, you can also view all purchase records, including the goods you have purchased, and receive dozens of shopping red envelopes and coupons for free. Now the editor has provided Pinduoduo users with a detailed online way to view purchased product records. method. 1. Open your phone and click on the Pinduoduo icon.

What should I do if Baidu Netdisk is downloaded successfully but cannot be installed? What should I do if Baidu Netdisk is downloaded successfully but cannot be installed? Mar 13, 2024 pm 10:22 PM

If you have successfully downloaded the installation file of Baidu Netdisk, but cannot install it normally, it may be that there is an error in the integrity of the software file or there is a problem with the residual files and registry entries. Let this site take care of it for users. Let’s introduce the analysis of the problem that Baidu Netdisk is successfully downloaded but cannot be installed. Analysis of the problem that Baidu Netdisk downloaded successfully but could not be installed 1. Check the integrity of the installation file: Make sure that the downloaded installation file is complete and not damaged. You can download it again, or try to download the installation file from another trusted source. 2. Turn off anti-virus software and firewall: Some anti-virus software or firewall programs may prevent the installation program from running properly. Try disabling or exiting the anti-virus software and firewall, then re-run the installation

How to install Android apps on Linux? How to install Android apps on Linux? Mar 19, 2024 am 11:15 AM

Installing Android applications on Linux has always been a concern for many users. Especially for Linux users who like to use Android applications, it is very important to master how to install Android applications on Linux systems. Although running Android applications directly on Linux is not as simple as on the Android platform, by using emulators or third-party tools, we can still happily enjoy Android applications on Linux. The following will introduce how to install Android applications on Linux systems.

How to install Podman on Ubuntu 24.04 How to install Podman on Ubuntu 24.04 Mar 22, 2024 am 11:26 AM

If you have used Docker, you must understand daemons, containers, and their functions. A daemon is a service that runs in the background when a container is already in use in any system. Podman is a free management tool for managing and creating containers without relying on any daemon such as Docker. Therefore, it has advantages in managing containers without the need for long-term backend services. Additionally, Podman does not require root-level permissions to be used. This guide discusses in detail how to install Podman on Ubuntu24. To update the system, we first need to update the system and open the Terminal shell of Ubuntu24. During both installation and upgrade processes, we need to use the command line. a simple

How to install creo-creo installation tutorial How to install creo-creo installation tutorial Mar 04, 2024 pm 10:30 PM

Many novice friends still don’t know how to install creo, so the editor below brings relevant tutorials on creo installation. Friends in need should take a look at it. I hope it can help you. 1. Open the downloaded installation package and find the License folder, as shown in the figure below: 2. Then copy it to the directory on the C drive, as shown in the figure below: 3. Double-click to enter and see if there is a license file, as shown below As shown in the picture: 4. Then copy the license file to this file, as shown in the following picture: 5. In the PROGRAMFILES file of the C drive, create a new PLC folder, as shown in the following picture: 6. Copy the license file as well Click in, as shown in the figure below: 7. Double-click the installation file of the main program. To install, check the box to install new software.

How to Install and Run the Ubuntu Notes App on Ubuntu 24.04 How to Install and Run the Ubuntu Notes App on Ubuntu 24.04 Mar 22, 2024 pm 04:40 PM

While studying in high school, some students take very clear and accurate notes, taking more notes than others in the same class. For some, note-taking is a hobby, while for others, it is a necessity when they easily forget small information about anything important. Microsoft's NTFS application is particularly useful for students who wish to save important notes beyond regular lectures. In this article, we will describe the installation of Ubuntu applications on Ubuntu24. Updating the Ubuntu System Before installing the Ubuntu installer, on Ubuntu24 we need to ensure that the newly configured system has been updated. We can use the most famous "a" in Ubuntu system

See all articles