[firebird-support] Firebird 4 RC1 settings for replication

285 views
Skip to first unread message

Eric Guéguiniat

unread,
Apr 28, 2021, 2:25:39 PM4/28/21
to firebird...@googlegroups.com
Hello,

I hope I am in the good group to ask my questions.

I try to set replication.conf and I don't know what to do to set this parameter : source_guid 
This parameter is required ? where to find this value ?
Must I do GFIX -replica on my replica database or it's not required ?

Other question about built in function  RSA_PRIVATE
With FB3 I use my own UDF to sign records, and I wonder If I can replace it with the new RSA_XXX functions.
What is the best way to set my own private_key ? Actually my private key is crypted in my UDF.
RSA_PRIVATE returns an unique priivate_key by database ?, how it works ?

Thank you
Eric

Dmitry Yemanov

unread,
Apr 29, 2021, 12:10:05 AM4/29/21
to firebird...@googlegroups.com
28.04.2021 21:25, Eric Guéguiniat wrote:
>
> I hope I am in the good group to ask my questions.
>
> I try to set replication.conf and I don't know what to do to set this
> parameter : source_guid
> This parameter is required ? where to find this value ?

gstat -h <primary database> shows the database GUID

It's not required, just a protection from possible mistakes (multiple
journals inside the same directory, for example).

> Must I do GFIX -replica on my replica database or it's not required ?

Yes, it should be done.


Dmitry

eric.gu...@gmail.com

unread,
Apr 29, 2021, 5:49:59 AM4/29/21
to firebird-support
Thank you Dmitry

My setting in replication.conf are :

database = 127.0.0.1/3040:D:\base\devFB4\source.fdb
  {
source_guid = AF766288-0231-4849-B226-5719121AA109
sync_replica = sysdba:mast...@127.0.0.1/3040:D:\base\devFB4\replica\replica.fdb
  }
  
database = sysdba:mast...@127.0.0.1/3040:D:\base\devFB4\replica\replica.fdb
 {
   log_source_directory = D:\base\devFB4\replica\log_source_directory
 } 

In replication.log I have this only this message and no replication happends when I make changes in source database

ERIC-DELL (replica) Thu Apr 29 11:44:18 2021
Database: sysdba:mast...@127.0.0.1\3040:D:\base\devFB4\replica\replica.fdb
VERBOSE: No new segments found, suspending for 10 seconds

I did  ALTER DATABASE ENABLE PUBLICATION;  on source database

Have I missed something ? Thank in advance for your help

PS : These is a mistake in Firebird_v4.0.0.ReleaseNotes.pdf at page 103
ALTER DATABASE ENABLE REPLICATION allows replication to begin
Instead
ALTER DATABASE ENABLE PUBLICATION allows replication to begin

Thank you
Eric

Dimitry Sibiryakov

unread,
Apr 29, 2021, 5:53:48 AM4/29/21
to firebird...@googlegroups.com
29.04.2021 11:49, eric.gu...@gmail.com wrote:
> Have I missed something ?

It looks like you missed whole doc/README.replication.md because your setup is meaningless.

--
WBR, SD.

Dmitry Yemanov

unread,
Apr 29, 2021, 6:00:26 AM4/29/21
to firebird...@googlegroups.com, eric.gu...@gmail.com
29.04.2021 12:49, eric.gu...@gmail.com wrote:
>
> My setting in replication.conf are :
>
> database = 127.0.0.1/3040:D:\base\devFB4\source.fdb

Server address is not needed, just:

database = D:\base\devFB4\source.fdb

>   {
> source_guid = AF766288-0231-4849-B226-5719121AA109

It should be added (if needed) to the replica side config.

> sync_replica =
> sysdba:mast...@127.0.0.1/3040:D:\base\devFB4\replica\replica.fdb

Correct (if you need synchronous replication).

> database =
> sysdba:mast...@127.0.0.1/3040:D:\base\devFB4\replica\replica.fdb

database = D:\base\devFB4\replica\replica.fdb

>  {
>    log_source_directory = D:\base\devFB4\replica\log_source_directory
>  }

This is needed for asynchronous replication only. But for that the
primary side should define log_directory / log_archive_directory.

Which mode (sync or async) are you attempting to setup?


Dmitry
Message has been deleted
Message has been deleted
Message has been deleted

Dmitry Yemanov

unread,
May 1, 2021, 5:41:17 AM5/1/21
to firebird...@googlegroups.com
29.04.2021 18:09, eric.gu...@gmail.com wrote:
>
> Now I know how to use replication sync and async ;)

Good ;-)

> My final async replication setting :
>
> # (for asynchronous replication)
> #
> # (for the primary side)
> database = D:\base\devFB4\source.fdb
>  {
> log_directory = D:\base\devFB4\replica\log_directory
> log_archive_directory = D:\base\devFB4\replica\log_archive_directory
> log_archive_command = "copy $(logpathname)
> D:\base\devFB4\replica\log_source_directory\$(logfilename)"

I'd better setup:
log_archive_directory = D:\base\devFB4\replica\log_source_directory

and remove the "log_archive_command" setting. It's intended for more
complex tasks than just copying.

> # (for the replica side)
> database = D:\base\devFB4\replica\replica.fdb
>  {
>    log_source_directory = D:\base\devFB4\replica\log_source_directory
>    source_guid = AF766288-0231-4849-B226-5719121AA109
>  }
>
> Remarks :
> - With source_guid = {AF766288-0231-4849-B226-5719121AA109} (with
> brackets) I have this error in firebird.log when I try to connect source
> database (without bracket it works)
> Authentication error
> cannot attach to password database
> Error in isc_attach_database() API call when working with legacy
> security database
> C:\Firebird\Firebird_4_0\replication.conf: illegal line <source_guid =
> {AF766288-0231-4849-B226-5719121AA109}>

Thanks, this smells like a bug. Curly brackets confuse the config parser
and thus must be excluded but I'm afraid the engine expects them. I will
double check.

> - On replica side in log_source_directory I have this
> file {AF766288-0231-4849-B226-5719121AA109}, It's just to have the date
> of the last replication ?

It contains the replication state: last applied segment/offset and list
of active transactions (if any).


Dmitry

Eric Guéguiniat

unread,
May 1, 2021, 10:17:24 AM5/1/21
to firebird...@googlegroups.com
Hello,

>I'd better setup:
>log_archive_directory = D:\base\devFB4\replica\log_source_directory

>and remove the "log_archive_command" setting. It's intended for more
>complex tasks than just copying.

If I put files directly in log_source_directory I will not have files in log_archive_directory in this case
Is it better to keep a copy of all files in  log_archive_directory or not ?
In log_archive_command I will plan to have a script to do 2 copies of files (with a return 0 or 1 as result), one copy in archive directory and one in source directory, but is it the right way of doing ?
log_source_directory  will be a drive directory by example.

Thanks
Eric



--
You received this message because you are subscribed to the Google Groups "firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-suppo...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/firebird-support/b5ac1c20-e2ad-d747-259e-b10619ce6e20%40yandex.ru.

Dmitry Yemanov

unread,
May 1, 2021, 10:43:54 AM5/1/21
to firebird...@googlegroups.com, Eric Guéguiniat
01.05.2021 17:17, Eric Guéguiniat wrote:
>
> >I'd better setup:
> >log_archive_directory = D:\base\devFB4\replica\log_source_directory
>
> >and remove the "log_archive_command" setting. It's intended for more
> >complex tasks than just copying.
>
> If I put files directly in log_source_directory I will not have files in
> log_archive_directory in this case

Sure. I just wasn't sure whether you need them there.

> Is it better to keep a copy of all files in log_archive_directory or not ?

Well, it depends ;-) In the simplest case - not. If you want to preserve
the whole replication history (e.g. for point-in-time recovery purposes)
- why not. Also see below.

> In log_archive_command I will plan to have a script to do 2 copies of
> files (with a return 0 or 1 as result), one copy in archive directory
> and one in source directory, but is it the right way of doing ?
> log_source_directory  will be a drive directory by example.

I suppose you want to protect yourself from possible network issues
(unavailable log_source_directory) stopping the replication. In this
case your log_archive_command should copy to both local "archive" +
remote "source" destinations but return "false" only if both failed. If
"source" will be unavailable, journal segments will be successfully
collected inside "archive", but you'll have to synchronize "archive"
with "source" manually (or via a scheduled script) once "source" is
available again.


Dmitry
Reply all
Reply to author
Forward
0 new messages