Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ MySQL uses Federate engine mapping table to achieve operation of the local remote operation table     - Taught you how to install Ubuntu Linux (Linux)

- Java synchronization mechanism used in locking Thought (Programming)

- Oracle local user login authentication fails ORA-01031 insufficient privileges (Database)

- Rman Oracle database backup and recovery plan (Database)

- Linux using RAID how to use Mdadm Tool Management Software RAID (Linux)

- Hadoop - Task Scheduling System Comparison (Server)

- RHEL7.0 log system (Linux)

- You must ask yourself four questions before deploying Docker (Server)

- MySQL5.7 implement virtual column expression index (Database)

- Linux command line to put on your coat GUI (Linux)

- Linux System Getting Started Learning: hard disk partition, and to deal with traps (Linux)

- Spring classic face questions Share (Programming)

- Ubuntu 14.04 LTS to compile the source code Android4.4.2 (Linux)

- Zabbix installation under Linux (Server)

- MNIST presentation and database conversion (Database)

- IOS interview questions Summary (Programming)

- Linux SSH remote connection service slow Solutions (Linux)

- MongoDB common optimization settings in Linux (Database)

- HTTPS Encryption Algorithm (Linux)

- C # get the current screenshot (Programming)

 
         
  MySQL uses Federate engine mapping table to achieve operation of the local remote operation table
     
  Add Date : 2018-11-21      
         
         
         
  Consider a scenario where there are multiple agent systems (each with its own database are) done after each operation, will trigger the respective database stored procedures for complex operations are required after each completed a Master of the machine to the remote database table rubbed into a message to notice the operation is completed. Initial idea there are two options to achieve.

In the agent inside the system through java code to call stored procedures, stored procedure until after the execution is completed, then the information is written to the end of the Executive Master database system.
By establishing a remote mapping tables for each agent in the system database, in order to achieve agent system stored procedure execution is completed, then the information through stored procedures written in the local mapping table from mysql automatically synchronize data to the Master. (Here also highlights mysql a short board, locally stored procedure can not call a stored procedure in the remote database, you can not operate the remote database table, looks like Oracle, sqlserver so can, or would not be so troublesome
Because in the actual project, the first approach because of run-time stored procedure is too long (half an hour or even longer), it will cause the system performance agent influential rogue forced to use the second option.

First, make sure the engine is turned on federated, you can show engines command to check whether the installation. Then follow these steps:

First, the establishment of projects in the Master machine table, we only need to establish a mapping table projects each agent database

CREATE TABLE `projects` (
    `Project_id` INT (11) NOT NULL AUTO_INCREMENT,
    `Project_code` VARCHAR (50) NOT NULL,
    `Test_code` VARCHAR (50) NOT NULL,
    `Create_time` BIGINT (11) NULL DEFAULT NULL,
    `Result` VARCHAR (255) NULL DEFAULT NULL,
    `Ts` BIGINT (11) NOT NULL,
    PRIMARY KEY ( `id`)
)
COLLATE = 'utf8_general_ci'
ENGINE = FEDERATED
CONNECTION = 'mysql: // user: password@202.59.232.211: 3306 / testdb / tb_projects_tests';

Note that the set connection statement, the corresponding information needs remote Master database user name, password and the mapping table, and then after the completion of each stored procedure execution can execute an insert statement for local projects.

PS: It should be noted that this approach is not suitable for large amounts of data synchronization.
     
         
         
         
  More:      
 
- Linux system security Comments (Linux)
- Linux text processing tool of awk (Linux)
- C ++: Postmodern systems programming language (Programming)
- Linux directory permissions to read and execute permissions difference (Linux)
- Oracle 11g RAC automatically play GI PSU patch (11.2.0.4.8) (Database)
- Java Set and List in the relationship and difference (Programming)
- iOS in the event delivery and the responder chain (Programming)
- CentOS7 Minimal minimize installation and then install the GNOME graphical interface (Linux)
- How to use the Docker Machine cluster deployment Swarm (Server)
- Linux operating system must know the security command (Linux)
- Oracle () trunc function usage (Database)
- Bootable ISO image using GRUB (Linux)
- VPN built on CentOS (Server)
- Java Learning: elegant string (Programming)
- Installed in the desktop version of Ubuntu Unity Tweak Tool (Linux)
- CentOS7 compile and install Tengine + PHP + MariaDB notes (Server)
- Ubuntu install ruby (Linux)
- Linux command -nohup & (Linux)
- Java garbage collection and heap memory layout (Programming)
- wget command usage Explanation (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.