RE: [PHP] Creating a unique index ID
| From: | Tim A. Yarbrough | Date: | Mon, 13 Mar 2006 15:50:19 +0000 |
| Subject: | RE: [PHP] Creating a unique index ID | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-231859@lists.php.net to get a copy of this message | ||
Using the auto_increment_offset will take care of this problem. Because
say server A can be configured to use odd numbers and server B can be
configured to use even numbers. You can also set this up in a more
complex fashion for the offsets if your running more then 2 servers.
-----Original Message-----
From: Jeff [mailto:jsmforum@optonline.net]
Sent: Monday, March 13, 2006 9:41 AM
To: Jared.Williams1@ntlworld.com; php-general@lists.php.net
Subject: RE: [PHP] Creating a unique index ID
> -----Original Message-----
> From: Jared Williams [mailto:jared.williams1@ntlworld.com]
> Sent: Monday, March 13, 2006 10:16
> To: 'Jeff'; php-general@lists.php.net
> Subject: RE: [PHP] Creating a unique index ID
>
>
>
>
> > Hey all,
> >
> > I've got a project where I'm taking form information from the
> > user and writing records to several tables in a MySQL database.
> >
> > The problem I'm having is I need to write a unique number for
> > the ID column of the records. Auto increment won't work
> > because I could have conflicts due to replication of the
> > database servers. Anyone have any techique they use for
> > creating unique ID field entries in a db table?
> >
>
> Autoincrements can work in a replicated enviroment, lookup
> mysql settings auto_increment_increment & auto_increment_offset.
>
> Each server gets its own unique auto_increment_offset, and
> auto_increment_increment is set to the number of servers you have.
>
> Jared
>
Hmm,
actually I'm using circular replication, so it's a bit different than
one way replication.
A replicates to B which replicates to A.
I've looked at the MySQL docs and can't find anything on how to make
Auto_Increment work in Circular Replication.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php