Federico Fanton wrote: > On 14/07/2015 14:18, Michelle Sullivan wrote: > >>> I'm (still) setting up multi-master replication between two nodes. >>> What is the recommended way to handle sequences? I've seen posts >>> saying that you should make one instance generate even numbers while >>> the other should generate odd numbers, but they were quite old >>> posts... Is this still the recommended way? >>> > >> Sequences can be replicated but if you're going to have concurrent >> inserts into both DBs you probably should go with the offset sequences >> or do as I did add a 'server ID' to the pks and not worry about >> replicating the sequences. > > What do you mean by "server ID"? Defining PKs as "nodeN_" + sequence? > Something like this? Yes - though I did 'server-id' as a separate col and set the default using:
postgresql.conf: custom_variable_classes = 'server_info' server_info.location = 'AT1, USA' server_info.id = 102 server_info.admin = '[email protected]' server_info.hostname = 'corkscrew.xxx.net' and tables defined like this: # \d hosts Table "public.hosts" Column | Type | Modifiers --------------+-------------------+------------------------------------------------------------ hostsid | bigint | not null default nextval('hosts_hostsid_seq'::regclass) host | character varying | not null sysstatus | integer | not null serverid | integer | default (current_setting('server_info.id'::text))::integer Indexes: "hosts_pk" PRIMARY KEY, btree (hostsid,serverid), tablespace "indexes" -- Michelle Sullivan http://www.mhix.org/ _______________________________________________ Bucardo-general mailing list [email protected] https://mail.endcrypt.com/mailman/listinfo/bucardo-general
