#1 2025-09-25 12:06:23

DonAlfredo
Member
Registered: 2023-10-31
Posts: 24

Replication to external database

Hello to all.

Usecase.

An intranet mORMot2 interface-based server. Many clients.
The intranet cannot be reached from the outside.
So, an external replication slave cannot reach this (master) database.

I want this database mirrored on an external (same as above) mORMot2 database (located at AWS).
This database can already be reached by clients in readonly-mode.

So, I need to push changes from intranet master to external AWS.

I have tried to use the normal (working) client, created inside of the intranet server, to push towards the external AWS database. But this gives a socket error (socket closed #5).

Any ideas ?

Offline

#2 2025-09-25 17:53:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,226
Website

Re: Replication to external database

Perhaps the socket is closed by the HTTP server because the payload is too big.

It is difficult to investigate without further information.

What is the exact error context in the logs, on both client and server sides?

Offline

#3 2025-09-27 06:05:05

DonAlfredo
Member
Registered: 2023-10-31
Posts: 24

Re: Replication to external database

Some additional info.
The server tries to send data towards the remote server through its own client.
This errors with message
ENetSock on SockInReadLn [#5 Closed]
Location

procedure DoInputSock(r: PTextRec; const ctx: ShortString; notvoid: boolean);
var
  res: integer;
begin
  res := InputSock(r^);
  if res <> NO_ERROR then

However, very remarkable.
I I perform some kind of action within the first few (2-3) seconds after the start of the server, the remote database is reached by the client inside the server and updated with the changes.
So, all works as expected, but only for the first few seconds after start of the server with the build-in client.

Edit: all running on Windows 11. Latest mORMot.

Last edited by DonAlfredo (2025-09-27 06:12:00)

Offline

#4 2025-09-27 07:07:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,226
Website

Re: Replication to external database

What are the timeout values you are using on client side?

Offline

#5 2025-09-27 07:30:21

DonAlfredo
Member
Registered: 2023-10-31
Posts: 24

Re: Replication to external database

Normal (embedded) client:   fClient := TRestHttpClient.CreateWithOwnModel(uri.Address, uri.Port,'root',true);
Gives error.
Also (embedded) tried:   fClient := TRestHttpClient.CreateWithOwnModel(uri.Address, uri.Port,'root',true,'','',30000,30000,30000);
Gives same error.
Again. Remarkable.
If I send something to the remote server time after time within a couple of seconds, all ok. If I wait for 3-4 seconds: socket error.
Inside of TSChannelNetTls.Receive:

        if read = 0 then
          result := nrClosed

Edit: the remote server response contains a keep-alive-timeout of 5 seconds.

Last edited by DonAlfredo (2025-09-27 08:14:11)

Offline

#6 2025-09-27 08:48:11

DonAlfredo
Member
Registered: 2023-10-31
Posts: 24

Re: Replication to external database

Please consider this issue as a non-issue. As the same is happening with a direct client connection towards the external database. So, this is not caused by embedding a client into a server.
Sorry about the noise !

Offline

Board footer

Powered by FluxBB