AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Administrar bases de datos / HFSQL / Gestión de la replicación / Replicación basada en registros
  • Overview
  • Log-based replication by network
  • What is it?
  • The possible actions
  • How to replicate by network and through programming
  • Constraints and tips
  • Log-based replication via portable media
  • What is it?
  • The possible actions
  • Constraints and tips
  • Programmatically
  • WLanguage functions for managing log-based replication
  • Functions for managing log-based replication
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Log-based replication: Programming the log-based replication in WLanguage
HFSQL ClassicDisponible solo con este tipo de conexión
Overview
Several WLanguage functions allow you to include log-based replication in your application and to customize it. In this case, no external tool is required: the replication of data between your databases is managed by programming.
Two modes of log-based replication can be implemented through programming:
  • log-based replication by network (case of a laptop that connects to the company network on a regular basis).
  • log-based replication via portable media (case of remote sites that do not connect via a network).
Log-based replication by network

What is it?

Log-based replication by network corresponds to the operation performed to synchronize two databases accessible on the same network.
The most common example is a salesman who regularly connects to the company network via his laptop computer. The replication allows him to update the company database with the new orders entered during the week.
During this operation, the company database and the laptop database are accessible via network. The replication can be performed via network.

The possible actions

Log-based replication by network is used to perform:
  • a unidirectional replication:
    • from the master computer to the subscriber computers.
    • from the subscriber computers to the master computer.
  • a bidirectional replication, which means from the master computer to the subscriber computer (and conversely).

How to replicate by network and through programming

The following operations must be performed:
  1. Creating the master replica on the master computer (HCreateMasterReplica).
  2. Creating the subscriber replica on the subscriber computer (HCreateSubscriberReplica). The subscriber computer must have read/write access to the disk where the master application is installed (directory of data files).
  3. Using the master and subscriber applications.
  4. Synchronization (HSynchronizeReplica):
    • from the subscriber computer to the master computer (rplToMaster constant constant): the subscriber computer must have read/write rights on the disk where the master application is installed.
    • from the master computer to the subscriber computer (rplToSubscriber constant): the master computer must have read/write rights on the disk where the subscriber application is installed.
    • bidirectional (rplBidirectional constant): the master computer must have read/write rights on the disk where the subscriber application is installed and the subscriber computer must have read/write rights on the disk where the master application is installed.
Caution: This paragraph assumes that the necessary operations have been performed in the application analysis before installing the application on the different computers. For more details, see Log-based replication: Modifying the analysis.

Constraints and tips

  • When creating the subscriber replica, the computer where the subscriber replica is installed must have read/write access onto the directory where the master replica is installed.
  • To perform the log-based replication, the path of the data files to replicate can be identified by:
    • a drive letter. In this case, the two computers involved in the replication must use the same drive letter. For example, if the replication is started from the subscriber computer:
      • on the master computer, the directory of the data files is found on X,
      • on the subscriber computer, the letter X must be associated with the drive containing the data files of the master computer.
    • UNC paths
    • relative paths.
  • To manage journaled replication in an application, the table of journal operations (JournalOperation.fic file) must be identical for all replicated files in the same analysis.
  • It is advisable to save the files required for log replication (*.rpm and *.rpl files) in an RPL subdirectory of the application data files.
  • If the log process is used for the replication only, the log files can be located in the directory of application (or in a subdirectory).
  • If the log process is used to keep a backup of the files, these files should be located on a disk other than the one used for the data files (for better security).
Log-based replication via portable media

What is it?

Log-based replication via portable media corresponds to the operation performed to synchronize two databases not connected to each other.
The most common example corresponds to two sites that are geographically distant: a site in Montpellier and a site in Paris for example. The databases are updated on a regular basis via different media: transfer via FTP, CD ROM, etc.

The possible actions

Log-based replication via portable media allows you to perform a unidirectional replication:
  • from the master computer to the subscriber computers.
  • from the subscriber computers to the master computer.

Constraints and tips

  • To manage journaled replication in an application, the table of journal operations (JournalOperation.fic file) must be identical for all replicated files in the same analysis.
  • It is advisable to save the files required for replication (*.rpm and *.rpl files) in an RPL subdirectory of the application data files.
  • If the log process is used for the replication only, the log files can be located in the directory of application (or in a subdirectory).
  • If the log process is used to keep a backup of the files, these files should be located on a disk other than the one used for the data files (for better security).

Programmatically

The following operations must be performed in order to synchronize the master computer with the subscriber computer:
  1. Creating:
    • the master replica on the master computer (HCreateMasterReplica).
    • the subscriber replica on the subscriber computer (HCreateSubscriberReplica). Each subscriber computer must be associated with a specific identifier. This identifier will be used during the synchronization.
      These two replicas can be created in the same directory (not recommended).
  2. Installing the file of subscriber replica on the subscriber computer. This file can be installed:
    • in the replication directory specified in the analysis (\RPL subdirectory of data files by default).
    • in another directory. In this case, the subscriber application must use HChangeRplDir to specify where to search for the file of the subscriber replica. Indeed, when the subscriber data file is opened, the RPL file is read in order to define the range of automatic identifiers used by the data file.
  3. Using the master and subscriber applications.
  4. On the subscriber computer, creating the movable replica (HCreateMovableReplica). A file with a WDZ extension is created by default. This file must be transmitted to the master computer.
  5. Synchronization on the master computer (HSynchronizeReplica). To perform this synchronization, you must specify:
    • the name and path of the movable replica on the master computer
    • the identifier of the subscriber replica (specified when creating the subscriber replica).
Caution: This paragraph assumes that the necessary operations have been performed in the application analysis before installing the application on the different computers. For more details, see Replication with WINDEV.
WLanguage functions for managing log-based replication

Functions for managing log-based replication

The following WLanguage functions are used to manage log-based replication:
HChangeRplDirModifies the location of the subscriber replica's description ("*.rpl" file).
HCreateMasterReplicaCrea el archivo description de una Réplica Maestra (réplica registrada o réplica universal).
HCreateMovableReplicaCreates a movable replication.
HCreateSubscriberReplicaCrea el archivo description de una réplica de un suscriptor.
HInitSubscriberInicializa el rango de identificadores automáticos de un archivo de descripción de una réplica esclavo (extensión ".rpl").
HSetReplicationDesactiva temporalmente (o vuelve a activar) la replicación.
HSynchronizeReplicaSincroniza la réplica maestra y la réplica del suscriptor.: las operaciones realizadas en una de las réplicas se transfieren a la otra réplica.
Versión mínima requerida
  • Versión 12
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 11/04/2024

Señalar un error o enviar una sugerencia | Ayuda local