Home  >  Q&A  >  body text

php - yii2跨多服务器事物处理?

开发语言PHP、开发框架YII2、数据库mysql(都是硬性条件)
现状:因业务需求,数据库会分布在不同的服务器,服务器之间都有业务往来
问题1:yii2并发多服务器,但php不支持夸服务器事物处理,如何保证数据的准确性
问题2:yii2修改三条数据,三条数据分别在三台服务器上,处理时间居然达到了15秒,单个操作很正常。yii2的数据库是动态连接的。
问题3:在满足硬性条件上,请高手给予解决方案。

PHP中文网PHP中文网2772 days ago799

reply all(5)I'll reply

  • cloudmam

    cloudmam2020-06-22 18:18:28

    You can try the server management tool Cloud Helper, which can manage servers of different *** across clouds and manage multiple servers in batches

    reply
    0
  • 哪儿

    哪儿2020-02-27 14:53:58

    Recommend an artifact that should be able to help you. Cloud Helper is a powerful and comprehensive centralized management cloud host software. Not only is it compatible with Linux systems, Windows can also be used. In fact, the use of functions is quite good, because the functions are comprehensive and the installation is simple. Basically, it can be done with one click by a fool. If you add a cloud host in the middle, you need to add a probe for the first time, and then you can basically operate it on the panel. This is quite convenient. I have tried basically all the mainstream clouds and there are no problems, and there are no problems with the system. This is quite worry-free. I won’t say that there are any cloud providers or systems that cannot be used, and I have to find another software. The general functions are as follows: 1. Batch management of multiple cloud hosts; 2. Strong compatibility, compatible with basically all cloud business cloud hosts on the market, and compatible with operating systems; 3. Simple operation, visual interface preview resources, one-click repair, one-click deployment ; 4. You can remotely log in to the FTP desktop of the cloud host and process files on the cloud host; 5. Monitoring and resources also have an alarm function, which is very good, and you don’t have to stare at it; 6. System repair function, this is very practical It is also quite necessary; 7. Free to use. Generally speaking, the functions are quite complete, and there is no need to find another software. A cloud helper software basically meets all needs.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-10 17:44:16

    1、如果Yii同时连接多个不同的数据库,那么对比起,这种你除了异步队列来加速没什么好办法,如果是一主多从,Yii在执行事务的时候回始终在主上面执行SQL;
    2、同上
    3、你可以考虑一主多从的模式,执行事务很快。如果是三个不同的业务系统,并且要求数据必须是实时的话,呵呵。我可以把执行时间假设为0,光算连接时间,不可接受。。。

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-10 17:44:16

    yii2修改三条数据,三条数据分别在三台服务器上,处理时间居然达到了15秒,单个操作很正常
    是否有相关数据来定位排查问题。你可以试着定位一下,到底问题在哪里。

    可以考虑用队列拆分业务。

    reply
    0
  • 高洛峰

    高洛峰2017-04-10 17:44:16

    架构有问题,PHP写入MYSQL,写入哪台mysql不是由PHP去做的,用MYSQL中间件去代理这些操作

    reply
    0
  • Cancelreply