dongren1011 2019-06-18 06:18
浏览 264

PHP / MySQL数据库同步

Scenario: I have a project which reads data from multiple different databases on different hosts with read-only access. All of them store the same type of information (for demo: Users).

Every database stores the information in their own way (different table names, column names, types etc.)

Now I want to get every User from every database and insert them into my own table 'User'.

Currently I am doing this by having 2 cronjobs - 1 imports Users & 1 updates Users (Select from Read-Only DB and insert into own DB the way I want).

Now I don't really like the idea of having multiple cronjobs running, just to import/update Users - plus I want to have the newest data in my database all the time - which means I need to run the cronjobs atleast every minute.

This with multiple tables are way too many minute-cronjobs IMO.


Question: Is there any way to achieve the same thing easier? Or is this already the correct way to do so?

Next issue is, that there is in most case no information which data is updated or not - meaning I need to import the same data over and over just to have the newest.

Any help will be gladly appreciated.


Using PHP 7+, Mysql with Symfony & Doctrine - if that helps.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作