vendredi 17 novembre 2017

What is the proper way to save a record to the BDR databases in Laravel 5?

Environment

  • Laravel Version : 5.1.45 (LTS)

  • PHP Version : 7.1.4

  • HA BDR


Description

I have a BDR set up for my databases.

I have 2 databases: db1, db2.

  • db2 is a clone of db1.
  • db2 is a slave, and db1 is master

The sequence of my db is suddenly out of sync.

This is how to usually save 1 record into the database.

Ex.

$flight = new Flight;
$flight->name = 'Jet Blue';
$flight->number = '1234';
$flight->save();

  • db1 - max id is 13
  • db2 - max id is 18

I'm trying to pin down the error here to see if this is a Laravel issue.

Is this something that I did wrong ?

$flight = new Flight;
$flight->name = 'Jet Blue';
$flight->number = '1234';
$flight->save(); // <-----

Do I need to do anything special to the way I save a record into the database to make sure both of my databases will be in synced ?

I look through all the Laravel 5.1 doc : http://ift.tt/1PfnkV8


Questions

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2zLHNQU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire