Rocket Software UniVerse 11.3.1 U2 Data Replication User Guide
ಜಾಹಿರಾತು
ಜಾಹಿರಾತು
Rocket UniVerse
U2 Data Replication User Guide
Version 11.3.1
October 2016
UNV-1131-REP-1
Notices
Edition
Publication date
: October 2016
Book number
: UNV-1131-REP-1
Product version
: Version 11.3.1
Copyright
©
Rocket Software, Inc. or its affiliates 1985-2016. All Rights Reserved.
Trademarks
Rocket is a registered trademark of Rocket Software, Inc. For a list of Rocket registered trademarks go to: www.rocketsoftware.com/about/legal . All other products or services mentioned in this document may be covered by the trademarks, service marks, or product names of their respective owners.
Examples
This information might contain examples of data and reports. The examples include the names of individuals, companies, brands, and products. All of these names are fictitious and any similarity to the names and addresses used by an actual business enterprise is entirely coincidental.
License agreement
This software and the associated documentation are proprietary and confidential to Rocket Software,
Inc. or its affiliates, are furnished under license, and may be used and copied only in accordance with the terms of such license.
Note: This product may contain encryption technology. Many countries prohibit or restrict the use, import, or export of encryption technologies, and current use, import, and export regulations should be followed when exporting this product.
2
Corporate information
Rocket Software, Inc. develops enterprise infrastructure products in four key areas: storage, networks, and compliance; database servers and tools; business information and analytics; and application development, integration, and modernization.
Website: www.rocketsoftware.com
Rocket Global Headquarters
77 4 th
Avenue, Suite 100
Waltham, MA 02451-1468
USA
To contact Rocket Software by telephone for any reason, including obtaining pre-sales information and technical support, use one of the following telephone numbers.
Country
United States
Australia
Belgium
Canada
China
France
Germany
Italy
Japan
Netherlands
New Zealand
South Africa
United Kingdom
Toll-free telephone number
1-855-577-4323
1-800-823-405
0800-266-65
1-855-577-4323
800-720-1170
08-05-08-05-62
0800-180-0882
800-878-295
0800-170-5464
0-800-022-2961
0800-003210
0-800-980-818
0800-520-0439
Contacting Technical Support
The Rocket Customer Portal is the primary method of obtaining support. If you have current support and maintenance agreements with Rocket Software, you can access the Rocket Customer Portal and report a problem, download an update, or read answers to FAQs. To log in to the Rocket Customer
Portal or to request a Rocket Customer Portal account, go to www.rocketsoftware.com/support .
In addition to using the Rocket Customer Portal to obtain support, you can use one of the telephone numbers that are listed above or send an email to [email protected]
.
3
Contents
4
Contents
5
Contents
6
Contents
7
Chapter 1: Introduction and terminology
Use data replication to automatically transmit read-only copies of UniVerse files to other UniVerse systems.
The system where the source data resides is called the publisher. A system requesting copies of file updates from the publisher is called a subscriber.
Terminology
This section describes terminology used throughout this manual.
Replication objects
The following objects are used in the U2 Data Replication system:
▪
▪
▪
Replication object
A U2 Data Replication object can be any UniVerse database file, including static files, dynamic files, sequentially hashed files, directory files, or multilevel files. Each replication object has a unique object name and an account in which it is defined. The object name is the VOC name in the account.
Publishing object
A publishing object is the replication object being replicated. One publishing object may have multiple corresponding subscribing objects on multiple replication sites.
Subscribing object
A subscribing object is a replica of the publishing object. The subscribing object does not have to have the same physical structure as the publishing object. For example, a subscribing object could be a sequentially hashed file, while its publishing object is a static hashed file. A subscribing object must have the same object name as the publishing object.
Replication system
A replication system is a UniVerse system in a replication environment. The replication system replicates data from one system (publishing system), to other systems (subscribing systems), or both.
8
Replication group
Replication group
In a replication environment, a replication group is a group of replication objects belonging to one
UniVerse account. The replication group is the basic unit of replication. Organizing related database objects into a replication group makes it easier to administer many objects together.
You can create and use a replication group to organize the database objects necessary to support a particular database application. You can define multiple replication groups in the same account, but one replication object can belong to only one replication group.
You can replicate one replication group from one publishing account to multiple subscribing accounts.
On a publishing system, a publishing group is the replication group defined in a publishing account of a local system and replicated to remote replication systems.
On a subscribing system, a subscribing group is a replication group defined on a remote replication system and replicated to a local subscribing account.
Group distribution
Group distribution defines a copy or replica of objects in a replication group. A replication group must have one publisher distribution and one or more subscriber distributions. A publisher distribution defines the replication system where the group is published. A subscriber distribution defines the replication system(s) that the group subscribes to and the replication type.
You can set up a replication environment that uses two subscribers. Each subscriber distribution is not dependent to other subscriber distributions. For example, the following configures a non-standby reporting subscriber named REPORTING and a delayed standby subscriber named STANDBY:
DISTRIBUTION=P:PRIMARY
DISTRIBUTION=I:REPORTING
DISTRIBUTION=IB480:STANDBY
The next example configures one standby subscriber and one delayed standby subscriber:
DISTRIBUTION=P:PRIMARY
DISTRIBUTION=IB:STANDBY1
DISTRIBUTION=IB480:STANDBY2
The next example configures two delayed standby subscribers:
DISTRIBUTION=P:PRIMARY
DISTRIBUTION=IB120:STANDBY1
DISTRIBUTION=IB480:STANDBY2
Replication
In a replication environment, a replication is the data replication from a publishing system to a subscribing system. You may have multiple replication groups in one replication.
On a specific system, you usually use a remote system name to represent the replication from a local system to the remote system, or from the remote system to the local system.
9
Chapter 1: Introduction and terminology
Standby replication
A standby replication is a replication used to support a standby failover system.
Non-standby replication
A non-standby replication is a replication used to support report applications only.
Types of replication
The following types of replication are available:
▪
Real-time replication, on page 10
▪
Immediate replication, on page 10
▪
Deferred replication, on page 10
▪
Delayed replication, on page 10
Real-time replication
In real-time replication, transactions on the publishing server do not commit until all transaction logs arrive at the subscriber. With this type of replication, if the publishing server fails over to the real-time subscribing system, all committed transactions on the publishing system are guaranteed to apply to the standby system.
Immediate replication
In immediate replication, the publishing system sends a transaction log to the subscribing system immediately and does not wait to commit the transaction. If the publishing system fails over to the immediate subscribing system, some committed transactions on the publisher might not arrive on the failover system. Administrator intervention might be necessary to recover the system.
Immediate replication has better performance than real-time replication.
Deferred replication
Deferred replication saves transaction logs in a file rather than sending them to the subscriber at a specific time. The subscribing system connects to the publishing server, retrieves all of the logs, and synchronizes its database with the publishing database. Deferred replication can only be used in nonstandby replication.
Delayed replication
Delayed replication allows updates to be delayed by a specified time on the subscribing system in
U2 Data Replication. The publishing system can failover to the subscriber system up to a specified time. This will allow you to cancel or void some unwanted updates during the failover to protect the database from accidental misuse or malicious damage.
Delay time period
In delayed replication, you can define the delay time period for the subscriber and the publisher. The time period can be defined differently for each system. The time period defined on the subscriber system takes effect at runtime. On the publisher, it takes effect after failover.
10
Disabling replication
Disabling replication
Replication disablement is an enhancement to U2 Data Replication that allows a database administrator to temporarily disable the replication system and stop generating unnecessary replication logs for better performance, and to avoid running out of disk space, which could trigger system crash.
U2 Data Replication can be disabled for any of the following reasons:
▪ The administrator determines that it is no longer necessary for the replication system to be running, for example, if problems with the subscribing system occur or changes are necessary for the requirements of replication.
▪ The replication system experiences an unrecoverable failure, for example, the communication link fails between the publisher and subscriber and the log area fills up before the communication link can be restored. A similar situation can occur if a power failure arises at the subscribing system.
Replication logs disk percentage
The replication logs disk percentage is a system-wide limit of disk usage for replication logs. The value is the maximum percentage the replication log files can consume of the total space available on the file system in which the logs are configured. The default uvconfig parameter is 95%. U2
Data Replication is disabled immediately if this limit is reached, and a full resynchronization of the subscriber is required after this event. If the replication log disk is shared with data files or other applications, you should properly define this percentage to prevent application or database failure due to a growing replication log file size.
The percentage can be configured by REP_DISABLE_DISK_PCT in the uvconfig file. For example,
REP_DISABLE_DISK_PCT=95
Note: If replication pacing is turned off, the defined replication logs disk percentage is still in effect. U2 Data Replication will be disabled if the replication logs size reaches the user-defined limit.
Replication pacing
Replication pacing allows U2 Data Replication to gracefully slow down the pace of publisher database updates when replication becomes overflowed. This reduces the likelihood of the replication logs overflowing and ultimately disabling U2 Data Replication.
Pacing gracefully slows down the database updates to prevent too many replication overflows to the log files. As the publisher process slowly paces the updates, the subscriber is able to catch up according to priorities set by the administrator. Administrators can define a session priority level, as described in
Session priority level, on page 12 , that guides the pacing mechanism in recognizing
when to slow down and when to resume normal speeds. Instead of overflowing the log file, the number of data updates sent to the log file is reduced, minimizing the possibility of disablement.
Replication pacing criteria and weight
User applications are delayed when the pacing criteria are reached. The pacing criteria include:
▪ Replication overflows that cause the system to slow down.
▪ Events that may lead to U2 Data Replication failure.
11
Chapter 1: Introduction and terminology
Each of the pacing criteria has a built-in pacing weight. When a session reaches the pacing criteria set, the pacing weight is added to the session. After the update finishes or the transaction is committed, the session sums up the pacing weights and calculates the delay time, and forces the process to wait for that time.
The following table shows the pacing criteria and their weights in milliseconds.
Pacing criteria
LIB about full
LIEF overflow
LEF overflow
TCA overflow
Approaching disablement
Pacing weight
10
100
4 + 1/gb
100
150
Description
Log Info Buffer (LIB) is 95% full (if 95 is kept as the default for the REP_DISABLE_DISK_PCT parameter).
Log is added into LIB overflow (Log Info Extension
File - LIEF) other than LIB.
Log is added into a Log Extension File (LEF) other than the replication buffer.
The Transaction Control Record (TCR) is created in the Transaction Control Area (TCA) overflow file.
Size of replication logs exceeding 80% of max replication log size. Only for groups that have LIEF/
LEF/LRF overflow.
Session priority level
The session priority is the user-defined session execution priority that allows the U2 database scheduler to tune its degradation if necessary. The values range from 0 to 9; 0 is the highest and 9 is the lowest. The default value is 3.
U2 Data Replication pacing adjusts a session's delay based on its priority level. Sessions with the highest priority (level 0) will have no delay on its database updates whether the pacing criteria are reached or not. Phantom processes carry the priority level from their parent processes, unless explicitly set in the phantom execution.
You can use the
SET.PRIORITY.LEVEL priority level command to set the session priority level.
Replication pacing level calculation
The pacing level is a tunable parameter for a replication group that defines the overall delay level of the group. The higher the pacing parameter is, the longer a delay will occur if the other pacing criteria are in effect. The value can be an integer from 0 to 255. A pacing level of 0 turns off replication pacing for the group. The default value is 5.
Each group's pacing level is defined in the REP_PACING phrase in the repconfig file.
When the uvsh process finishes a single update or transaction commit, all degradation weights are added together to calculate the degradation time.
The following formula shows the calculation:
Group pacing weight
=Sum(Pacing weights)*Group pacing level
Delay time
=(Group pacing weight)*Session priority level*10 microseconds
If there are multiple groups, the group pacing weight would be the sum total of each group being updated.
The process sleeps for the amount of the specified replication delay time before continuing to the next instruction.
12
Replication log
Replication log
A replication log is a log representing a transaction or update on a publishing object. UniVerse transfers this log to the subscribing system to propagate data.
In a replication group, each replication log has a unique Replication Log Sequence Number (RepLSN).
Data update log
A data update log is a log representing a data update. It contains a log header and log body.
Log header
The log header contains the following information.
▪ RepLSN
▪ Length of log
▪ Transaction ID
▪ Operation flag
▪ Pub-commit flag
▪ Sub-commit flag
Log body
The log body contains the following information.
▪ File ID
▪ Record ID
▪ Record as well as indexed virtual attribute values
▪ Timestamp generated from the system clock
Transaction log
A transaction log is a special log representing a transaction other than data updates. Each transaction generates a pair of transaction logs in the replication group with a timestamp: a transaction begin log and a transaction end log.
Replication failover log
A replication failover log is a replication log generated by the subscriber process when it is failing over to a standby system. UniVerse then sends these logs to the original primary system as part of the resynchronization process.
The failover end log is a special failover log that marks the end of replication failover logs in the replication log reserve file.
Replication messages
The following types of messages are used with U2 Data Replication:
▪
Pub-commit notification, on page 14
13
Chapter 1: Introduction and terminology
▪
Sub-got notification, on page 14
▪
Sub-commit notification, on page 14
Pub-commit notification
A pub-commit notification is a notification message sent from the publisher to the subscriber to notify the subscriber that a specific transaction has been committed on the publishing system.
Sub-got notification
A sub-got notification is a notification message sent from the subscriber to the publisher verifying that it received the replication logs of a specific transaction.
Sub-commit notification
A sub-commit notification is a notification message sent from the subscriber to the publisher verifying that a specific transaction was committed on the subscribing system.
Replication buffer
When UniVerse starts, the replication system allocates replication buffers for all replication groups. A replication buffer is a buffer in shared memory that transfers replications logs between the “reader” and “writer” processes. For a publishing group, the writers are the uvsh processes, and the reader is the publisher process. For subscribing groups, the writer is a subscriber process and readers are replication writer processes.
Replication buffer extension file
The replication buffer extension file is an extension of the replication buffer, used to store very large logs and other log files when the replication buffer is full.
The replication buffer extension file is a directory with part files.
Replication log reserve file
The replication log reserve file is a log file residing on the publishing system to save replication logs when replication is suspended because of a network failure, a subscribing system crash, or when an administrator issues the suspend command.
UniVerse sends reserved logs to the subscribing system at a later time to synchronize the data between the publishing and subscribing systems. For deferred replication, UniVerse uses the replication log reserve file to save replication logs on the publishing system. These logs are sent to the subscribing system periodically, or manually, for synchronization.
When replication is suspended on a subscribing system, the subscriber process saves the logs without pub-commit notification from the publisher and writes them to the replication log reserve file.
UniVerse then reloads these logs in the replication buffer when the subscribing group fails over.
The replication log reserve file is a directory with a control file and part files.
14
Replication sub packet store
Replication sub packet store
The replication sub packet store stores data packets sent from the publisher before the uvsub process loads and processes the data. The replication sub packet store consists of the sub packet file and the sub packet buffer.
UniVerse creates or truncates the sub packet file each time the uvsub process starts a sync operation.
This file has the same format as the replication log reserve file, with a
.spf file extension.
The sub packet buffer consists of two parts to store the log info and log body, respectively. The log info portion of the buffer has a fixed size of 2300 bytes, while the body buffer size is 128K.
While replication is running, the sublistener thread saves data packets to the sub packet buffer first. If this buffer is full, it saves the data packets in the sub packet file.
If you suspend replication, the uvsub process dumps all unsaved replication logs from the sub packet buffer to the sub packet file in case of a failover. If a failover command is issued, UniVerse loads all data logs from the sub packet file to the replication buffer and processes them during the failover process. If no failover command is issued, UniVerse discards the unloaded data logs in the next sync operation.
Cross-group transaction
A cross-group transaction (CGT) is a transactional update where the files being updated in a transaction span multiple replication groups.
Prior to UniVerse 11.3.1, U2 Data Replication only handled CGTs in a synchronous manner. The synchronized methodology involves updating the subscriber only when the logs from all replication groups involved in the transaction are on the subscriber and successfully loaded into the replication buffer. The subscriber processes do not send a sub-done acknowledgement back to the publisher until all logs associated with the transaction have been committed.
The synchronized methodology allows for the consistency of every transaction and its atomic properties to be kept during a hard failover. However, the replication performance of CGTs can be severely degraded using the synchronized methodology. This can happen when the load across different replication groups is not balanced and the site has heavy data volume. The impact might be so severe that the subscriber will continue to fall further behind and never catch up with the publisher.
At UniVerse 11.3.1, asynchronous CGT processing has been added to improve replication performance.
In an asynchronous methodology, each replication group handles CGTs separately as a singlegroup transaction. Writer processes (RWs – uvrw for UniVerse, and udrw for UniData) only wait on logs from their own group to arrive and load before they apply the logs to the subscriber database.
The subscriber process sends the sub-done acknowledgement if all the logs in its own group are committed, without waiting for other involved replication groups. This methodology improves the overall throughput on the subscriber as it eliminates the potential for some replication groups to pause processing while waiting for the other groups in a CGT to complete.
Asynchronous CGT functionality is enabled using the REP_ASYNCHRONOUS_TP uvconfig file parameter. When using the asynchronous CGT functionality (REP_ASYNCHRONOUS_TP = 1), consideration should be given to increasing the default value of the TCA_SIZE uvconfig file parameter. The Transaction Control Area (TCA) is used more heavily when the asynchronous CGT functionality is enabled. With the default setting in TCA_SIZE, the buffer can overflow and significantly impact U2 Data Replication performance. While the performance impact will be seen primarily on the subscriber, increasing the default value in TCA_SIZE to 16000 or 32000 is recommended on both the publisher and subscriber. This will maintain a consistent configuration in the event of a failover.
Having information recorded on all transactional updates is an integral part of the recovery operation in the event of a hard failover when using asynchronous CGT functionality. The TRANS_COMMIT_LOG
15
Chapter 1: Introduction and terminology file in the $UVHOME account records transactional updates. When logging is enabled, information on each transaction is recorded in the TRANS_COMMIT_LOG file when a transaction is committed. The transaction commit logging functionality is enabled using the TP_COMMIT_LOGGING uvconfig file
parameter, described in uvconfig parameters, on page 20 . The information recorded when each
transaction is committed is displayed in the following example:
>LIST DICT TRANS_COMMIT_LOG WITH TYPE = “D”
DICT TRANS_COMMIT_LOG 05:27:53am 19 May 2016 Page 1
Field......... Type & Field........ Conversion.. Column......... Output Depth
Name.......... Field. Definition... Code........ Heading........ Format Assoc
Number
@ID D 0 TP COMMIT LOG 10R S
USERID D 1 User ID 10L S
ACCT D 2 Account Name 10L S
FNAME D 3 File Name 10L M TP_UPD
ISDICT D 4 Is Dict? 2L M TP_UPD
OP D 5 Operation 2L M TP_UPD
RECID D 6 Record ID 10L M TP_UPD
By default, the TRANS_COMMIT_LOG file ships as a dynamic file, but the configuration can be changed as needed. For example, it could be set up as a distributed file or a UVNet file that exists on the subscriber. Each user account has a Q pointer to the TRANS_COMMIT_LOG file in $UVHOME. If desired, the physical location of TRANS_COMMIT_LOG can be moved from $UVHOME by adjusting the Q pointer entry in each user account.
Note: The transaction commit logging functionality can still be used even without U2 Data
Replication so that transactional updates can be logged independent of U2 Data Replication.
Although as noted, it is a key part of the failover strategy when using U2 Data Replication and asynchronous CGTs.
The asynchronous methodology allows for the possibility that some updates in the transaction can be committed before updates in other replication groups have been completed. In a hard failover scenario, this could result in a partial transactional update on the subscriber. For example, with a
CGT involving three replication groups, updates in two groups might have been processed while the updates in the third group were still pending at the time of the hard failover. In this scenario, the subscriber would have committed updates to some files in the transaction but not all.
To handle this situation, U2 Data Replication has been enhanced to search for any incomplete transactions on the subscriber during a failover operation. These incomplete transactions are recorded and written to the UniVerse REP_FAILOVER_LOG file in $UVHOME. The information recorded in the file is displayed in the following example:
>LIST DICT REP_FAILOVER_LOG WITH TYPE = "D"
DICT REP_FAILOVER_LOG 05:49:36am 19 May 2016 Page 1
Type &
Field......... Field. Field........ Conversion.. Column......... Output Depth &
Name.......... Number Definition... Code........ Heading........ Format Assoc..
@ID D 0 Failover Log 6L S
TIMESTAMP D 0 Failover Timest 8L S
amp
STATUS D 1 Failover Status 6R S
PUBSYS D 2 Publisher System 10L M INCOMP_TP
TID D 3 Transaction Id 10L M INCOMP_TP
16
Transaction control record
PUB_TSTAMP D 4 Pub Sys Stamp 8L M INCOMP_TP
A user-defined failover action script can be developed to review and correct these transactions. This script should be defined using the FAILOVER_ACTION phrase available in the repsys file, described
automatically by U2 Data Replication at the conclusion of the failover processes. The transaction ID and transaction timestamp recorded in the REP_FAILOVER_LOG file can be used to build the record ID to the TRANS_COMMIT_LOG file. And based on the application logic, the user-defined script can use the information in the TRANS_COMMIT_LOG file to repair the incomplete transaction. A copy of the
TRANS_COMMIT_LOG file must be on the subscriber in the event of a hard failover. One method is to use real-time replication to replicate the TRANS_COMMIT_LOG file in its own replication group.
Transaction control record
A transaction control record is a record in a shared memory buffer used to control a cross-group transaction.
For each cross-group transaction that occurs on the publishing system, UniVerse creates a transaction control record on the subscribing system to synchronize the multiple processes dealing with the transaction to enforce the consistency of the transaction. The transaction control record contains the following information:
▪ Transaction ID
▪ Total number of replication groups involved in the transaction
▪ Number of groups that have received all log files
▪ Number of groups that have committed the transaction
▪ Number of groups that have aborted the transaction
▪ A list of replication writers waiting on the transaction
Transaction control area
The transaction control area is a shared memory buffer used for transaction control records. Each subscribing system contains one transaction control area.
Publisher process
A publisher process (uvpub ) is a process running on the publishing system that reads logs of a specific replication group from the replication buffer and sends them to the subscribing system.
Publisher-syncing tool
The publisher-syncing tool (uvpubsyncer) is an executable the publisher process creates to send synchronizing data logs from the replication log reserve file to the subscribing system to synchronize subscriptions to their publishers.
17
Chapter 1: Introduction and terminology
Publisher listener process
The publisher listener process (uvpublistener) is a process the publisher process creates to listen to a remote subscriber process for a feedback control package.
Subscriber process
A subscriber ( uvsub) is a process running on the subscribing system that receives logs of a replication group from the publishing system and writes them to replication buffer.
The subscriber process consists of two major threads. The sublistener thread receives data packets from the publishing system through a socket connection, then stores the data packets in the sub packet store and sends an acknowledgment back to the publishing system. The sub main thread loads the replication logs from the sub packet store to the replication buffer and coordinates with replication writer processes to apply the logs on the subscribing database.
If the subscriber has a delayed time period defined as part of a delayed replication, then the subscriber and replication writer processes are changed. The replication writer process gets the current time from the system clock and compares it to the log's timestamp. If the time difference is less than the subscriber delay time period, the replication writer process places itself into the reader waiting list instead of applying the log update. The subscriber process continues to load logs into the replication buffer and compares the time difference of the last log in the replication buffer and the current time. If the difference is bigger than the subscriber delay time period, the subscriber wakes up the replication writer processes from the reader waiting list.
Replication writer process
The replication writer process (uvrw) runs on the subscribing system. This process reads data logs from the replication buffer and applies the updates to the subscribing objects. More than one replication writer can exist for one subscribing group.
UniVerse also uses replication writer processes to load replication objects at system start up.
Replication manager daemon
The replication manager (uvrepmanager) is a UniVerse daemon that must be running on the replication system. The publishing system and the subscribing system each have one replication manager. The replication manager performs the following tasks:
▪ Reads and loads the repconfig file information when UniVerse starts
▪ Creates replication processes for each replication group
▪ Monitors and controls the replication processes
▪ Handles commands from Replication Admin and XAdmin
▪ Dynamically reconfigures the replication environment
▪ Handles failover replication, recovery, and synchronization of replication data
18
Replication system definition
Replication system definition
The replication system definition file (repsys), located in the uvhome directory, defines all replication systems in a replication environment. This file contains definitions for the local system and all remote replication systems that replicate data from or to the local system. Each system definition contains the user-defined system name, network address, UniVerse version, and other information related to the system and replication from or to the system.
Replication configuration file
The replication configuration file ( repconfig), located in the uvhome directory, is maintained by an administrator on each system, and defines all replication groups and usage on the system and their distributions. Each replication group has a unique global name, a list of objects in the group, a local account location, a publishing system from which it replicates, and all subscribing systems to which it replicates.
The replication configuration file contains a section for each replication group, and contains the following information:
▪ Group name
▪ Replication level
▪ All replication objects belonging to the group
▪ Local account location
▪ Publishing system from which it replicates and all subscribing systems to which it replicates
▪ System tunable parameters for the replication group
For more information, see
Replication configuration file, on page 29 .
Data link compression
Beginning at UniVerse 11.2.3, the replication process allows data to be compressed during the network transfer phase, in a process called data link compression. When data link compression is turned on, the publisher compresses the data packets before sending them out. The subscriber then decompresses the packets after they are received. This reduces the amount of data being transferred, mitigating the overhead brought out by slow network connections.
19
Chapter 2: Installing and configuring U2 Data
Replication for UniVerse
This chapter describes how to install and configure U2 Data Replication for UniVerse.
Files created by the installation process
When you install U2 Data Replication for UniVerse, the installation process installs the following components:
▪ The default configuration parameters in the uvconfig file.
▪ The default data replication log directory (replog) in the UVHOME directory.
▪ A default replication system definition file (repsys) in the UVHOME directory.
▪ An empty replication configuration file (repconfig) in the UVHOME directory.
▪ A replication service (uvsub) and replication manager connection service (uvrmconn) in the system RPC service table.
▪ A default account-level replication file (repacct.def).
If you configure U2 Data Replication for UniVerse, UniVerse starts the following daemons:
Daemon
uvsmm uvrepmanager uvcleanupd
Function
Manages shared memory segments for U2 Data Replication for UniVerse.
The UniVerse data replication manager.
The UniVerse cleanup daemon. UniVerse starts this daemon when you start the UniVerse system. New functions clean up dead users for U2
Data Replication.
Configuring U2 Data Replication
UniVerse supports dynamic configuration of U2 Data Replication. A system administrator can edit the replication system definition file ( repsys) and the replication configuration file (repconfig), to define and configure the replication groups. UniVerse loads the new configuration parameters when you execute the
RECONFIG command.
uvconfig parameters
The following uvconfig file parameters pertain to U2 Data Replication:
Parameter
MAX_LRF_FILESIZE
Description
The maximum log reserve file size, in bytes. The default value is
1,073,741,824 (1 GB). The maximum value is 2,147,483,136.
20
uvconfig parameters
Parameter Description
MAX_REP_SHMSZ
MAX_REP_SHMSZ_GB
MAX_RW_INGRP
The maximum shared memory buffer segment size for a replication group. This value includes consideration for REP_BUFSZ,
N_LOGINFO, distributions, and group control information. The default value is 1,073,741,824 (1 GB) and it must be less than 2 GB. If
MAX_REP_SHMSZ_GB is configured, then the maximum shared memory buffer size for a replication group is the sum of MAX_REP_SHMSZ_GB *
1GB + MAX_REP_SHMSZ.
The maximum shared memory segment size, in GB, for a replication group. If this value is configured, then the maximum shared memory buffer size for a replication group is the sum of MAX_REP_SHMSZ_GB *
1GB + MAX_REP_SHMSZ.
The maximum number of replication writer processes that can be configured in a replication group. The default value is 8. At 11.2.0, this parameter is obsolete.
N_REP_OPEN_FILE
REP_ASYNCHRONOUS_TP Specifies how U2 Data Replication handles transactional updates when files span multiple replication groups. When set to 1, the crossgroup transactions are handled in asynchronous mode. When set to the default value of 0, transactional updates are handled synchronously and the transaction is not committed on the subscriber until all replication groups have been updated.
REP_CP_TIMEOUT
The maximum number of open replication log files for a uvsh process.
The default value is 8.
Specifies the cm daemon timeout interval for replication at checkpoint.
The default value is 200 seconds. If this value is set to 0 the cm daemon will not time out.
REP_DISABLE_DISK_PCT This parameter defines the system-wide limit of disk usage for replication logs. The value is the maximum percentage the replication log files can consume of the total space available on the file system in which the logs are configured. The default uvconfig parameter is 95%.
U2 Data Replication is disabled immediately if this limit is reached, and a full resynchronization of the subscriber is required after this event. If the replication log disk is shared with data files or other applications, you should properly define this percentage to prevent application or database failure due to a growing replication log file size.
For example,
REP_DISABLE_DISK_PCT=95.
REP_FLAG
In the event that you start to approach the percentage defined to disable U2 Data Replication, a warning message is sent to the rm.log file. The warning is sent when the total replication log file sizes reaches 80% of the maximum replication log size defined by
REP_DISABLE_DISK_PCT.
The REP_FLAG parameter turns U2 Data Replication on or off. If you choose to install UniVerse with the replication system, you must manually set the REP_FLAG uvconfig parameter to 1 to enable U2
Data Replication. The following options are available:
▪ 0 - The U2 Data Replication system is off.
▪ Any positive integer - The U2 Data Replication system is on.
21
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Parameter Description
REP_IGNORE_QPOINTER Specifies whether or not to load Q-pointers. If this value is set to 0, U2
Data Replication will load and process all file pointers in an account. If this value is set to 1, the following occurs:
REP_LOG_PATH
TCA_SIZE
▪ UniVerse ignores all Q-pointers encountered during the loading of the replication object table
▪ If a Q-pointer is defined in the repconfig file as part of a “FILE” phrase, UniVerse ignores the Q-pointer
▪ For any record-level update that is done through a Q-pointer, including a
COPY or CLEARFILE command or a UniVerse BASIC program that opens the Q-pointer or writes through the Q-pointer, if the file that the Q-pointer actually resolves to is itself replicated, the update is replicated and sent through the primary file reference to which it resolves. If the Q-pointer resolves to a file that is not replication, it is ignored.
The full path to the location of the replication log files. The default value is
uvhome/replog.
The maximum number of entries in the Transaction Control Area
(TCA). TCA is only used when there is more than one replication group configured, and there are transactions across replication groups. The default value is 2048.
TP_COMMIT_LOGGING
If you are not using transaction processing, this parameter is irrelevant.
If you are using transaction processing, set the value of TCA_SIZE to at least the number of users on the system.
Specifies whether to use transaction commit logging. The default value is 0. Valid values are: 0, 1, 2, or 3.
▪ 0 - Default; Transactions are not logged.
▪ 1 - The transaction attempts to write a log record during commit.
The transaction itself will continue to commit in spite of any errors encountered in writing to the TRANS_COMMIT_LOG file.
▪ 2 - The transaction attempts to write a log record during commit.
The entire transaction is aborted if the attempt to write to the
TRANS_COMMIT_LOG file fails.
▪ 3 - The function behaves like option 1, except that if the
TRANS_COMMIT_LOG file is a UVNet file, the updates to it are in nowait mode.
Configuration parameters for shared memory
The following uvconfig parameters are available for shared memory management starting at
UniVerse 11.1.
22
Parameter
NUSERS
SHM_ATT_ADD
SHM_FREEPCT
SHM_GNPAGES
SHM_GNTBLS
SHM_GPAGESZ
SHM_LBA
SHM_LCINENTS
SHM_LMINENTS
SHM_LPAGESZ
SHM_LPINENTS
Configuration parameters for shared memory
Description
The number of user sessions (such as uvsh and PHANTOM) that can run at the same time. The recommended value is greater than or equal to the number of licensed users. This will require tuning based on the number of UniVerse processes that are required to run on the system at the same time. If this parameter is too low, you see the "No More
LCTs" error. If you set NUSERS to a value below the licensed user count,
UniVerse will use the licensed user count in place of NUSERS.
For example, an enterprise license of 150 users should have NUSERS set to 1875 (150 * 10) + 25%. (Note: The example assumes a maximum of 10 connections for each user. Adjust this value to your average number of connections per user.)
▪ Change SHM_GNTBLS to 32 and change SHM_GNPAGES to 64 to ensure 32 * 64 = 2048, which is greater than NUSERS.
▪ Check that the UNIX value of semmni is at least 1232. (NUSERS /
(NSEM_PSET+1)) + 1024.
▪ Check that the UNIX value of semmns is at least 3933. (NUSERS + 10 +
2048)
▪ Check that the UNIX value of shmmni is at least 1880. (Greater than
SHM_GNTBLS or NUSERS +5)
▪ Check that the UNIX value of semmnu is at least 1775 (NUSERS).
Starting address for shared memory attachment. Set at installation; do not change this unless instructed by U2 Technical Support.
Percentage of freed global pages in an active global shared memory segment that UniVerse keeps in the global shared memory pool.
smm checks the current percentage; if the percentage is less than
SHM_FREEPCT, smm creates a new shared segment.
Number of global pages in a shared memory segment. Tune
(SHM_GNTBLS * SHM_GNPAGES) high enough to avoid "No More GCTs" error. This parameter should be a multiple of 32.
Number of GCTs (global control tables) in CTL. Each shared memory segment is associated with a GCT. The GCT registers the use of global pages in its associated shared memory segment. Tune (SHM_GNTBLS *
SHM_GNPAGES) high enough to avoid the "No More GCTs" error.
Size of each global page, in 512-byte units. This parameter should be a multiple of 32.
Alignment size, in bytes, for shared memory attachment. Set at installation; do not change.
The number of entries in the CI table of each LCT, which is the number of local pages that can be attached by a process.
Number of entries in the MI table of a LCT, which means the number of global pages or self-created dynamic segments that can be attached by a process. Cannot exceed 255.
Size, in 512-byte blocks, of each local page in a global page. A global page is divided into local pages, so SHM_GPAGESZ must be a multiple of
SHM_LPAGESZ.
Number of entries in the PI table of a LCT, which is the number of processes allowed in a process group. It is set to 10 within the system, regardless of the uvconfig setting.
23
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Parameter
SHM_MAX_SIZE
SHM_MIN_NATT
SHM_NFREES
Description
Current kernel setting for maximum size (in bytes) of a shared memory segment. This parameter is set at installation. This value might need tuning if U2 Data Replication is in use and the sizes of the replication buffers are increased. A physical shared memory segment cannot exceed SHM_MAX_SIZE in size.
The minimum number of shared memory segments that should be kept attached to a process.
The number of inactive shared memory segments that UniVerse keeps in the system. The number of free shared memory segments to keep.
Replication system definition (repsys)
The replication system definition defines local and all remote host system locations in a replication environment. This file, called repsys, resides in the uvhome directory.
Each line of the repsys file is either a definition phrase or a comment. A definition phrase defines a component of replication systems in the replication environment, such as replication system names or host names. A definition phrase starts with the phrase name that indicates the type of phrase.
The following table describes the types of phrases that U2 Data Replication can include.
24
Phrase
ACCTNAME
Replication system definition (repsys)
Description
Use the ACCTNAME phrase to define an account name in the system. U2
Data Replication uses this account name, together with the system name, to identify a secondary replication. U2 Data Replication also uses the account name, together with the group name, to identify a secondary group instance at runtime. The account name is unique in a replication system.
ACCTNAME=<account_name:<account_path>>
<account_name> can be a string combination of characters, numbers, and special characters, and has a maximum length of 127 bytes.
If the ACCTNAME defines an account name, you can use that name in repconfig to replace the account path. If repconfig uses an account path and the account is not defined by the ACCTNAME phrase in the repsys file, U2 Data Replication generates a default account name when you start
UniVerse using the following rules:
▪ When UniVerse starts, U2 Data Replication searches the system account table for local accounts. The system account table is located in
UDTHOME/sys/UD.ACCOUNT.
▪ If the last directory name in the account path is unique on the system, U2
Data Replication uses that name. If it is not unique, U2 Data Replication precedes the account name with the parent directory name and an underscore (“_”) until it finds a unique name.
For example, if the account path is
/disk1/ud82/demo, U2 Data
Replication tries to use “demo” as the account name. If “demo” already exists, it tries “ud82_demo.” If that already exists, it tries
“disk1_ud82_demo.”
If U2 Data Replication cannot form a unique name when it reaches the maximum number of characters, it tries to replace the last character with a digit from 0 through 9. If the name is still not unique, it tries to replace the second to last character with a digit, and so forth.
U2 Data Replication sends the account name of the publishing account in the handshake of the SYNC operation. For secondary replication, U2
Data Replication also sends the secondary subscribing account name. The account names must match the account names defined on the subscribing system.
25
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Phrase
AUTHORIZATION
AUTORESUME
DHCP
Description
For remote systems with a static IP address, the publishing system can always trust the subscribing system because the IP address is defined in the repsys file. However, if the remote system is a DHCP system, the publishing system cannot verify the IP address.
In order to verify the subscribing system, set the AUTHORIZATION phrase value to 1 on the subscribing system location. U2 Data Replication performs an authorization check when a SYNC request is received from that subscribing system.
If you define a subscribing system location with an AUTHORIZATION phrase, you must define a connection user name and password on the remote subscribing system in order for the SYNC request to succeed. You can define or change the connection user and password through XAdmin or the repadmin tool with the following command:
uv_repadmin setconnect <replication> where replication is the remote system location defined in the repsys file.
The repadmin tool prompts for the connection user name and password.
Determines whether replication from the remote system that you specify will be synchronized and resumes automatically when UniVerse starts, or after a reconfiguration.
The AUTORESUME phrase has the following syntax:
AUTORESUME=<flag> where flag is 1 for true, or 0 for false.
Specifies that a remote or local system has a dynamic IP address. If you define a remote system as a DHCP system, U2 Data Replication automatically updates the IP address of the remote system when it receives a SYNC request from that system. If you define a local system as a DHCP system, U2 Data Replication automatically sends the current IP address in the SYNC request to the remote server.
The DHCP phrase has the following format:
DHCP=1
If the remote system is a DHCP system, you should always set AUTORESUME to false to avoid a SYNC request failure.
EXCEPTION_ACTION The replication exception action is a shell script on UNIX platforms, or a batch program on Windows platforms. Define the full path to the exception action using the EXCEPTION_ACTION clause in the repsys file.
For example, if you define a replication exception action as
UVRepExceptionAction.sh in the
/usr/uv directory, set the
EXCEPTION_ACTION clause as:
EXCEPTION_ACTION=/usr/uv/UVRepExceptionAction.sh
For more information about replication action triggers, see
Replication action trigger, on page 59 .
26
Phrase
SYNCINTVAL
System
TIMEOUT
Replication system definition (repsys)
Description
Defines the time interval, in minutes, in which the replication system automatically synchronizes replication to the remote system.
The SYNCINTVAL phrase has the following syntax:
SYNCINTVAL=<sync_interval>
U2 Data Replication automatically synchronizes subscribing systems with their publisher every period defined by sync_interval. A sync_interval of 0 indicates a manual synchronization system, where the system does not automatically synchronize the systems.
The SYNCINTVAL phrase applies only to those subscribing groups that have deferred replication on the remote system. It does not apply to publishing groups.
Starts a system definition section. The system definition section defines a replication system in the replication environment. One system section ends when another system phrase is defined, or at the end of the repsys file.
You must specify a user-defined name for the local system in the repsys file. Normally, UniVerse adds the local definition to the repsys file if you install U2 Data Replication during the UniVerse installation, as shown in the following example:
# Definition of system shire
SYSTEM=shire
HOSTNAME=shire
VERSION=111
You must define a system phrase for each system location in the replication environment. When defining a remote system location, you also define the replication from the local system.
The system phrase has the following syntax: where system_name is the name you define for the replication system.
This name should be unique on a system. system_name can contain a combination of alphabetic characters, number, and any of the following characters: ~ ! @ $ % ^ & * - + . / \.
SYSTEM=<system_name>
Defines the number of seconds to wait if no packets are received from the remote system before suspending replication.
The publishing system sends a packet to the subscribing system approximately every 4 seconds when replication is idle. The subscribing system then sends a packet back to the publishing system. If the subscribing system location has the TIMEOUT phrase defined, the publistener process counts the time that has elapsed between packets being received. If the amount exceeds the value of the TIMEOUT phrase, replication is suspended.
In the value of TIMEOUT is 0, no timeout occurs.
We recommend that you not set the value of the TIMEOUT phrase to less than 2 minutes.
27
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Phrase
Version
Description
Defines the version of UniVerse on the system location. The version number must be 111 or higher.
The version phrase has the following syntax:
VERSION=<version_no>
Example
The following examples show a replication system involving three systems, Server 1, Server 2, and
Server 3. Each platform is running one UniVerse system.
▪
repsys file for local system, on page 28
▪
repsys file for server 2, on page 28
▪
repsys file for server 3, on page 29
repsys file for local system
#Define local system
SYSTEM=System_A
HOSTNAME=Server1
VERSION=111
#Define Remote System B
SYSTEM=System_B
HOSTNAME=Server2
VERSION=111
AUTORESUME=1
TIMEOUT=300
#Define Remote System C
SYSTEM=System_C
HOSTNAME=Server3
VERSION=111
repsys file for server 2
#Define local system
SYSTEM=System_B
HOSTNAME=Server2
VERSION=111
#Define Remote System A
SYSTEM=System_A
HOSTNAME=Server1
VERSION=111
AUTORESUME=1
TIMEOUT=300
#Define Remote System_C
SYSTEM=System_C
HOSTNAME=Server3
VERSION=111
28
repsys file for server 3
repsys file for server 3
#Define local system
SYSTEM=System_C
HOSTNAME=Server3
VERSION=111
#Define Remote System A
SYSTEM=System_A
HOSTNAME=Server1
VERSION=111
SYNCINTVAL=3
#Define Remote System_B
SYSTEM=System_B
HOSTNAME=Server2
VERSION=111
SYNCINTVAL=3
Replication configuration file
The replication configuration file ( repconfig), located in the uvhome directory, defines all replication groups and usage and their configuration parameters.
Each line of the repconfig file is either a definition phrase or a comment. A phrase defines a component of replication, such as a replication group or a replication object.
A phrase entry begins with the phrase name that indicates the type of phrase. The following table describes the types of phrases that UniVerse supports.
Phrase
GROUP
Description
Starts a group definition section. The group definition section defines contents, distributions, and configurable parameters of a replication group. One group section ends when another group phrase is defined, or at the end of the repconfig file.
The group phrase has the following syntax:
GROUP=group_name where group_name is the user-defined name for the group.
Note: You cannot have two groups defined as the same group name. The replication manager daemon checks the system's repconfig file to verify there is only one group name defined. If two or more groups are defined with the same name during startup, the replication manager and UniVerse fail to start. If attempted during a reconfiguration, uv_repadmin reconfig
-verbose displays an error and U2 Data Replication uses the previous configuration. In both cases, an error is logged to the rm.errlog file.
29
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Phrase
LEVEL
ACCOUNT
Description
The LEVEL phrase defines the replication level of a replication group. By default, a replication group is a file-level group.
LEVEL=[ACCOUNT | FILE]
Account-level replication replicates updates to all files in an account, except those defined in the Excluded File phrase. You can define multiple file-level groups in an account, and one account-level group. If a file is defined in a filelevel group, UniVerse replicates updates through the replication group where the file is defined. If you do not explicitly define the file in a group, UniVerse replicates the updates through the account-level group.
Each replication group section must contain an ACCOUNT phrase, which defines the local account where the replication group resides.
The account phrase has the following syntax:
ACCOUNT=account_identifier
account_identifier
has the following format:
account_identifier
:=[account_name|account_path]
Note: UniVerse verifies all file references in the VOC file for any ACCOUNT you specify in the repconfig file when you start U2 Data Replication.
Combinations of account paths and account names cannot be used. If the account name is defined first in the repconfig file, an error similar to the following displays:
Duplicate account names/paths are defined in repconfig line 4 and 52.
Use either account names or account paths exclusively.
If the account path is defined first, then an error similar to the following displays:
Account is not accessible(2).
RM: Load Replication object fails!
30
Phrase
FILE
Replication configuration file
Description
Each group section can contain multiple file sections. A file section defines a replication object in a replication group, and a FILE phrase defines the file name.
The file phrase has the following syntax:
File=[SUB_WRITEABLE] [DICT | DATA] filename [,subfile]
If you specify SUB_WRITEABLE, you can write to the file you specify on the subscribing system. On the publishing system, this does not take effect until system failover.
If you specify DICT, only the dictionary portion of the file is replicated. If you specify DATA, only the DATA portion of the file is replicated. Otherwise, UniVerse replicates both the dictionary and data portion of the file.
If the filename you specify is a multilevel file and you do not specify a subfile name, UniVerse replicates the multilevel file and all its part files. It does not include newly created part files after UniVerse starts.
An account-level group can also have file sections. You may want to define a file explicitly in an account-level group if the file has a symbolic link or VOC pointer and you want to clearly define the primary replication file, or you want to define the file with special options.
By default, UniVerse automatically adds the VOC file to the account-level group.
Warning: If you define a file in more than one replication group, UniVerse will use one and only one file definition. The file UniVerse chooses is arbitrary.
31
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Phrase Description
EXCLUDED_FILE The EXCLUDED_FILE phrase defines an excluded file for a replication account.
EXCLUDED_FILE=[DICT | DATA] filename[,subfile]
U2 Data Replication allows you to use wildcard patterns in the EXCLUDED_FILE phrase. This is helpful if your application creates temporary files that you may not know the exact name of in advance.
In the repconfig or repacct.def files, define the pattern for the files you want to exclude using the EXCLUDED_FILE phrase.
EXCLUDED_FILE={DICT | DATA}
[wildcard]filename[,subfile][wildcard] in which wildcard is "..."
If wildcard exists in the EXCLUDED_FILE phrase, it describes an excluded pattern rather than an excluded file. For example, the phrase
EXCLUDED_FILE=...WORK.FILE... specifies any file containing
WORK.FILE to be excluded.
EXCLUDED_FILE=WORK... specifies an excluded pattern for WORK* at the file directory level, data files, and dictionary files.
EXCLUDED_FILE=WORK.FILE,... specifies an excluded pattern that matches all subfiles of the level file
WORK.FILE, and all level files beginning with
WORK.FILE.
EXCLUDED_FILE=...WORK.FILE,... specifies an excluded pattern for all files ending with
WORK.FILE, and all subfiles of all level files ending with
WORK.FILE.
In account-level replication, the RESERVED_FILE_SPACE parameter defines the number of dynamic objects for both included and excluded objects. Each dynamic excluded object created for a file uses one slot in the dynamic object table.
The default repacct.def file contains the following excluded file phrase:
EXCLUDED_FILE=VI.TMP...
32
Replication configuration file
Phrase
DISTRIBUTION
REP_PACING
Configuration
Replication writer configuration
Description
Each group section can contain multiple distribution phrases. A DISTRIBUTION phrase defines a distribution of a replication group. A distribution of a replication group is either the publishing system from which it replicates, or a subscribing system to which it replicates.
The distributions of a replication define all replications in which the group is involved. Each group section must contain one distribution phrase defining the publishing system, and at least one distribution phrase defining a subscribing system.
The distribution phrase has the following syntax:
DISTRIBUTION=
replication_type
:system_name[account_identifier]
replication_type
defines the distribution and replication type. See the following tables for a description of these subscribing types.
system_name
is one of the systems previously defined in the repsys file.
One replication group must have one, and only one, local system distribution.
Optionally, you can use the LOCAL keyword to represent the local system name.
account_identifier
defines a secondary distribution. account_identifier must satisfy the following rules:
▪ replication_type can only be a nonstandby replication system
▪ system_name can be either the publishing system name or the subscribing system name
▪ account_identifer must be a different account than the primary account of the group defined by the ACCOUNT phrase
Defines the replication pacing level in a group.
The REP_PACING phrase has the following syntax:
REP_PACING=value where value is the level from 0 to 255. 0 turns off U2 Data Replication. The default value is 5.
Configuration phrases, on page 34 .
Replication writer configuration phrases, on page 34 .
As described in the previous table, DISTRIBUTION should contain a replication_type, which defines the distribution and replication type. The following replication types are available:
I
D
Replication type
R
P
Description
Real-time replication subscribing system.
Immediate subscribing system.
Deferred replication.
Denotes the publishing system.
Hot standby systems
Bdelayed_time_period
Description
Used to denote that the subscribing system is a hot standby system that can be failed over to if required. The optional delayed_time_period defines the subscriber delay time period. This option is not allowed with deferred replication (D).
33
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Optional switches
E
C
Description
Turns on EDA mode, which allows for replication objects to be EDA mapped on multiple systems, but ensures that only one system will be applying the updates to the EDA source at any one time. The system that receives and applies the updates is determined by the status of the publisher or subscriber and any failed over status.
Turns on
Data link compression, on page 19
. When C is specified in the subscribing type, the data transfer from the publisher to the subscriber is compressed.
Configuration phrases
Configuration phrases define configurable parameters for the replication group. The following table describes the configurable parameters.
Parameter
N_LOGINFO
REP_BUFSZ
LARGE_RECSZ
RESERVED_FILE_
SPACE
Description
The maximum number of replication logs that can be loaded in the shared memory buffer. If the number of logs in the replication buffer exceeds this value,
UniVerse stores the logs in the replication buffer extended file. The default value is 4096.
The shared memory buffer size used to hold the log body for the replication group. The default value is 1048576.
When a record is larger than the value of LARGE_RECSZ, UniVerse stores it in the
LEF instead of the Replication buffer. The default value is 64K.
Defines the amount of file slots to reserve for an account-level group. The default value is 500.
If the RESERVED_FILE_SPACE is full, the create.file command will fail with an error similar to the following example:
Replication object table is full: Enable Replication object TEST3 failed.
Creating file TEST3 failed.
============>>>> NOTE: CREATE.FILE failed! <<<<<<==============
Not - file created but cannot be replicated. Table full = fatal error.
You can reload the replication file table and provide fresh reserve slots without stopping UniVerse by running the uv_repadmin reconfig command.
Replication writer configuration phrases
Replication writer configuration phrases define configurable parameters for replication writers.
These parameters are used only by a subscribing group. We recommend that you define this for the publishing group if you want to failover the publishing group to a standby subscribing system. The group is treated as a subscribing group after the failover.
The following table describes the replication writer configurable parameters.
Parameter
N_REPWRITER
RW_UID=
user_ID
Description
The number of replication writer processes for the replication group.
The user ID of the replication writer process. By default, UniVerse starts the replication writers as root. If you define RW_UID, the replication writer process changes the user ID to the one you specify. UniVerse only supports this parameter on UNIX systems.
34
Examples
Parameter
RW_GID=
group_ID
RW_REEVALUATE
_VF
Description
The group ID of the replication writer process. If you define RW_GID, the replication writer process changes the group ID to the one you specify.
UniVerse only supports this parameter on UNIX systems.
UniVerse evaluates indexed virtual fields on the publishing system before writing the results to the database, then transfers these values to the subscribers along with the record. You can choose to use these values directly from the publisher, or have the replication writer processes reevaluate these values.
RW_SKIP
_TRIGGER
By default, the replication writer process reevaluates the virtual field on the subscribing system. If you want to use the values without reevaluating them, set this parameter to 0.
If this value is set to 1, the default, the replication writer process ignores a trigger, even if a trigger exists on the subscribing file. If you do not want to ignore the trigger, set this value to 0.
RW_IGNORE
_ERROR
If a replication writer process encounters inconsistency in a replication log, it writes an error message to the rm.errlog file, but continues processing. If you set this value to 0, UniVerse will suspend replication if it finds inconsistency in a replication log.
RW_VERIFY_PARTITION If this value is set to 1, the replication writer processes verify the partition algorithm of distributed files part files. If the publishing system and the subscribing system have exactly the same definition for distributed files, you can set this value to 0 to skip partition verification. The default value is
1.
Examples
The following example illustrates a repconfig file for account-level replication. In these examples, the CUSTOMER and
\U2\uv\demo on System A to \U2\uv\test on System B in real-time, standby replication mode, and to
/disk1/demo on System C in deferred replication. Also assume that a
STUDENT2 VOC pointer exists in
/usr/uv/demo2 pointing to the STUDENT file in /usr/uv/ demo.
The following example illustrates the repconfig file on System A:
GROUP=SAMPLE_ACCT
LEVEL=ACCOUNT
ACCOUNT=\U2\uv\test
FILE=SUB_WRITEABLE VOC
FILE=CUSTOMER
FILE=STUDENT
EXCLUDED_FILE=_XML_
EXCLUDED_FILE=_EDA.MAP_
EXCLUDED_FILE=ENGLISH.MSG
DISTRIBUTION=P:SystemA
DISTRIBUTION=IB:SystemB
DISTRIBUTION=D:SystemC
#Define tunable parameters
RESERVED_FILE_SPACE=500
N_LOGINFO=5120
REP_BUFSZ=163840
N_REPWRITER=2
RW_IGNORE_ERROR=1
RW_REEVALUATE_VF=0
35
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
RW_SKIP_TRIGGER=1
The next example illustrates the repconfig file on System B:
GROUP=SAMPLE_ACCT
LEVEL=ACCOUNT
ACCOUNT=\U2\uv\demo
FILE=SUB_WRITEABLE VOC
FILE=CUSTOMER
FILE=STUDENT
EXCLUDED_FILE=_XML_
EXCLUDED_FILE=_EDA.MAP_
EXCLUDED_FILE=ENGLISH.MSG
DISTRIBUTION=IB:SystemB
DISTRIBUTION=P:SystemA
DISTRIBUTION=D:SystemC
#Define tunable parameters
RESERVED_FILE_SPACE=500
N_LOGINFO=5120
REP_BUFSZ=163840
N_REPWRITER=2
RW_IGNORE_ERROR=1
RW_REEVALUATE_VF=0
RW_SKIP_TRIGGER=1
The next example illustrates the repconfig file on System C:
#Define the group name
GROUP=SampleGroup
#Define Local
Account Path ACCOUNT=/disk1/demo
#Define replication objects
FILE=SUB_WRITEABLE VOC
FILE=CUSTOMER
FILE=STUDENT
EXCLUDED_FILE=_XML_
EXCLUDED_FILE=_EDA.MAP_
EXCLUDED_FILE=ENGLISH.MSG
#Define distributions from System A to LOCAL
DISTRIBUTION=D:SystemC
DISTRIBUTION=P:SystemA
DISTRIBUTION=IB:SystemB
#Define configurable parameters
#Log info buffer size
N_LOGINFO=512
#Log buffer size
REP_BUFSZ=16384
#Define number of replication writer processes
N_REPWRITER=2
36
Default account level replication file
Default account level replication file
The repacct.def file, located in the uvhome directory, includes a default list of files to be included or excluded for each account-level replication group.
The following is an example of the repacct.def file:
# Definition of default excluded objects for account replication
EXCLUDED_FILE=DICT.DICT
EXCLUDED_FILE=DICT.VOC
EXCLUDED_FILE=SQL.HELP
EXCLUDED_FILE=BCI.HELP
EXCLUDED_FILE=BASIC.HELP
EXCLUDED_FILE=HELP.FILE
EXCLUDED_FILE=ERRMSG
EXCLUDED_FILE=SYS.HELP
EXCLUDED_FILE=SYS.MESSAGE
EXCLUDED_FILE=SYS.TERMINALS
EXCLUDED_FILE=REVISE.DISCUSSIONS
EXCLUDED_FILE=REVISE.PROCESSES
EXCLUDED_FILE=STAT.FILE
EXCLUDED_FILE=UNIVERSE.STAT.FILE
EXCLUDED_FILE=TESTQ
EXCLUDED_FILE=&SAVEDLIST&
CLUDED_FILE=&PARTFILES&
EXCLUDED_FILE=&COMO&
EXCLUDED_FILE=&PH&
EXCLUDED_FILE=UFD&
EXCLUDED_FILE=&DEVICES&
EXCLUDED_FILE=UV;ACCESS
EXCLUDED_FILE=UV.ACCOUNT
EXCLUDED_FILE=UV.FLAVOR
EXCLUDED_FILE=UV_LOGS
EXCLUDED_FILE=UV.TRANS
EXCLUDED_FILE=UV_UDRPUB
EXCLUDED_FILE=UV_UDRSUB
EXCLUDED_FILE=UDRSYS
EXCLUDED_FILE=UV_SCHEMA
EXCLUDED_FILE=UV_ASSOC
EXCLUDED_FILE=UV_COLUMNS
EXCLUDED_FILE=UV_TABLES
EXCLUDED_FILE=UV_VIEWS
EXCLUDED_FILE=UV_USERS
FILE=SUB_WRITEABLE DATA VOC
FILE=SUB_WRITEABLE AE_DOC
FILE=SUB_WRITEABLE &MAP&
FILE=SUB_WRITEABLE &KEYSTORE&
FILE=SUB_WRITEABLE &SAVEDLIST&
FILE=SUB_WRITEABLE PTERM.FILE
FILE=SUB_WRITEABLE UNIVERSE.MENU.
FILE FILE=SUB_WRITEABLE UV.SAVEDLISTS
37
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Processes for U2 Data Replication
Daemons are available for use for U2 Data Replication and cleaning up dead user processes.
A daemon is a background process that performs a specific task or set of tasks. Daemons wait in the background until they receive a request from their specific function. A number of standard UNIX daemons run on every UNIX platform to control system processes, schedule commands, handle print requests, and perform other similar functions. Refer to your host operating system documentation for detailed information about the UNIX daemons that run on your system.
On Windows platforms, services are used instead of daemons.
Shared memory manager
The shared memory manager daemon, uvsmm, records all operating system resources, such as shm segments and semaphores, identifying which UniVerse user holds each.
System clock
Beginning at UniVerse 11.3, a new system clock is added into the system shared memory segment to generate a timestamp. uvsmm and smm is enhanced to have a separate thread repeatedly update the clock every second. Other processes can quickly get the current time from the system clock instead of repeatedly calling system calls.
The data update log contains the timestamp generated from the system clock. For transactions, all transaction logs contain the same timestamp as the data update log, including cross-group transactions. The timestamp is passed together with the replication log to the subscriber. In delayed replication, the subscriber delays the replication log update to the subscriber database according to the timestamp.
The timestamp is carried with the replication log its whole cycle, regardless of failover. After failover, logs generated in the original publisher can be sent back during the sync. It follows the same delay time period rule at runtime. During the failover, a FAILOVER_END log is generated at the subscriber.
This log is sent back during sync after the failover. This log is the only log that does not follow the delay time period rule, and is handled by replication writer processes immediately, no matter whether a delay time period is defined.
Replication manager daemon
The replication manager (uvrepmanager) is a UniVerse daemon that must be running on the replication system. The publishing system and the subscribing system each have one replication manager. The replication manager performs the following tasks:
▪ Reads and loads the repconfig file information when UniVerse starts
▪ Creates replication processes for each replication group
▪ Monitors and controls the replication processes
▪ Handles commands from Replication Admin and XAdmin
38
The uvcleanupd daemon
▪ Dynamically reconfigures the replication environment
▪ Handles failover replication, recovery, and synchronization of replication data
The uvcleanupd daemon
The clean up daemon, uvcleanupd, detects terminated user processes at check time intervals. If uvcleanupd detects a terminated process, internal flags are set. The uvsmm daemon periodically checks to see if uvcleanupd has set internal flags. If it detects flags, uvsmm performs the necessary cleanup and resets its own flag to zero. The uvcleanupd daemon performs clean up that is not handled by uvsmm. When the uvsmm daemon has reset its flag to zero, the uvcleanupd daemon resets its flag to zero, makes the user process ID available, and frees the local control table.
Both the uvdlockd and uvcleanupd daemons are started when UniVerse starts. Beginning at 11.1, the uvdlockd daemon only handles deadlocks.
The uvcleanupd.config file
You can specify the parameters that determine how frequently the uvcleanupd daemon runs in the uvcleanupd.config file, located in the $UVHOME directory.
The following table describes the parameters stored in the uvcleanupd.config file.
Parameter
start timer res log
Description
Used to determine when to start the uvcleanupd daemon.
▪ 0 - does not start the uvcleanupd daemon when the server starts.
▪ 1 - start the uvcleanupd daemon when the server starts.
The number of seconds the uvcleanupd daemon waits before check for terminated processes.
The resolution strategy parameter is historical to the UniVerse dead lock daemon ( uvdlockd) and not applicable to the uvcleanupd daemon.
The full path to the uvcleanupd log file. If no file is specified, the log file name used is uvcleanupd.log.
You must stop and restart UniVerse to have changes to this file take effect.
uvcleanupd command
The uvcleanup command forces a clean up of resources owned by a terminated process. You must be a UniVerse administrator or the user that has the same user number as the terminated process to execute the uvcleanupd command.
Syntax
uvcleanupd {[-t time] [-l location]} | {-c} | {-stop}
Parameters
The following table describes each parameter of the syntax.
Parameter
-t time
Description
The interval time (in seconds) to have the uvcleanupd daemon check for dead processes. The default is 15 seconds.
39
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Parameter
-l location
-c
-stop
Description
The location of the uvcleanupd log file. The default location is uvhome/ uvcleanupd.log.
Instructs the uvcleanupd daemon to use the parameters that are defined in the uvcleanupd.config file on startup. When -c is specified, no other options can be used.
Stops the uvcleanupd daemon while UniVerse is running.
Note: If the uvcleanupd daemon is cleaning up a terminated uvrw process, the information logged in the uvcleanupd.log file will contain additional information regarding the replication log being processed. This can be helpful in diagnosing unexpected uvrw terminations.
Starting UniVerse daemons
Use one of the following commands to start the UniVerse daemons:
▪ uv-admin -start [-init]
▪ uv.rc start [init]
If you specify the init option, U2 Data Replication clears the pending replication logs saved to synchronize the subscriber database. You can use this option for initial startup, or after refreshing a subscriber database.
Note: Care should be taken when using the init option, as improper use could cause the subscriber to be out of sync with the publisher.
Stopping UniVerse daemons
Use one of the following commands to stop the UniVerse daemons:
▪ uv-admin -stop [-force]
▪ uv.rc stop [force]
These commands check whether any users are still logged on to the system. If users are logged on,
UniVerse does not stop the system. If you specify the force option, UniVerse stops the system even if there are users logged on to the system.
Displaying UniVerse daemons
On UNIX systems, use the showuv command to display daemon processes currently running on the system. The following example illustrates output from the showuv command:
% /shire3/uv111/bin/showuv
USER PID TIME COMMAND root 307326 0:00 /shire3/uv111/../unishared/unirpc/unirpcd root 532674 0:01 /shire3/uv111/bin/uvcleanupd -t 15 root 618668 0:00 /shire3/uv111/bin/uvdlockd -config root 549070 0:02 /shire3/uv111/bin/uvsmm -t 15Displaying smm
Use the uvsms command to display smm segment contents.
40
Options
Syntax
uvsms [options]
Options
The following table describes the options available for the uvsms command:
Option
h
-
G shm_id
g shm_no
-
L pid
l lct_no
-
S shm_id
Description
Displays the smm segment header.
Displays the specific shared memory segment you specify with shm_id.
Displays the specific shared memory segment you specify with shm_no.
Displays the specific LCT entry you specify with pid.
Displays the specific LCT entry you specify with lct_no.
Displays the LCT entry of the session where the shared memory segment is created.
Global control table
The global control table (GCT) manages shared memory segments system-wide. This table is located in the shared memory management segment. Each GCT records the use of global pages in a shared memory segment. UniVerse determines the number of GCTs in the CTL by the configuration parameter
SHM_GNTBLS. SHM_GNTBLS must not exceed the kernel parameter shmmni.
Local control tables
Each local control table (LCT) records the shared memory activity of a UniVerse process group.
UniVerse determines the number of LCTs in the CTL by the
NUSERS configuration parameter. Each
LCT comprises four subtables:
Subtable name
PI
CT
MI
CI
Description
Process information table. Each
PI table registers all processes within a process group.
Counter table. Each
CT records information about the behavior of the process group.
Memory information table. Each
MI table records all global pages or selfcreated shared memory segments used by the process group.
Control information table. Each
CI table records all blocks allocated from shared memory for temporary buffers.
A process group related to a process group leader, or a user executing a UniVerse system-level command from a UNIX prompt.
Terminology
The following table describes the UniVerse executable names for U2 Data Replication for UniVerse.
Replication component
Shared memory manager daemon
Executable name
uvsmm
41
Chapter 2: Installing and configuring U2 Data Replication for UniVerse
Replication component Executable name
Stop shared memory management tool stopuvsmm
Replication manager daemon uvrepmanager
Show sms information uvsms
Dead user cleanup daemon uvcleanupd
Publisher process uvpub
Subscriber process
Replication writer
Publisher listener process
Publisher synching tool uvsub uvrw uvpublistener uvpubsyncer
Replication manager RPC tool uvrmconn
Replication diagnosis tool uvreptool
Stop replication manager tool stopuvrm
Replication admin tool
Show UNIX daemons uv_repadmin showuv
Show format processing
Test process ID
Show host information psfmt test_pid hostinfo
The next table describes the U2 Data Replication for UniVerse services names.
Replication service
U2 replication service
Replication manager connection service
UniVerse service name
uvrep uvrmconn
The next table describes the U2 Data Replication for UniVerse daemon log files. These log files are located in the
$UVHOME directory.
UniVerse replication log file UniVerse system log file
smm log file smm error log file uvsmm.log
uvsmm.errlog
Cleanup daemon log file uvcleanupd.log
Cleanup daemon error log file uvcleanupd.errlog
Replication manager log file uvrm.log
Replication manager error log file uvrm.errlog
Publisher error log file
Subscriber error log file
Replication writer error log file uvpub<n>.errlog
uvsub<n>.errlog
uvrw.errlog
UV Dead lock daemon log file uvdlockd.log
42
Chapter 3: Administering U2 Data Replication
This chapter describes administration tools for U2 Data Replication.
Managing U2 Data Replication through XAdmin
To access the replication tools, in XAdmin, select the server you want to use. From the
Admin Tasks
pane, expand Replication (U2 Replication in UniVerse), then double-click Configuration.
The Replication pane opens and displays the database type that you are using. In the following example, UniData is the displayed database.
Note: The Recovery Logs tab shown in the previous example is only available with UniData.
Configuring U2 Data Replication
To configure U2 Data Replication, perform the following tasks:
1.
Once you have opened the Replication pane, define the replication systems. This task needs to be performed on both the publisher and subscriber servers.
2.
After you have defined the replication systems, add a publishing group.
3.
43
Chapter 3: Administering U2 Data Replication
After you have added a publishing group, add a subscribing group.
4.
Optional: Changing a replication group definition
You can change a replication group definition without having to stop and restart UniVerse.
5.
Verifying the account defaults
You can view the account defaults to see which files are automatically included (replicated) and excluded.
6.
After you have defined the replication systems and added both a publishing and subscribing group, you can start replication.
Defining replication systems
Once you have opened the Replication pane, define the replication systems. This task needs to be performed on both the publisher and subscriber servers.
1. In XAdmin, from the U2 Resource pane, select the subscriber server. From the Admin Tasks pane, expand Replication then double-click Configuration.
2. To define replication systems, click the System Definition tab.
3. To add a new system, click Add.
The Replication System Definition dialog box appears.
4. In the System ID field, enter the system name.
5. In the Host Name field, enter the host network name or network address of the system.
Select the DHCP check box if the remote system has a dynamic IP address.
6. In the Version field, enter the database version on the system. For UniVerse, the version must be
111 or higher. For UniData, the version must be 60 or higher.
7. Auto resume determines if replication from the publishing system you specify will be synchronized and resume automatically when the U2 server starts, or after a reconfiguration.
Select Yes if you want the server to automatically resume processing, or No if you want to manually synchronize data and resume processing.
8. In the Sync Interval field, select the time interval, in minutes, in which the replication system automatically synchronizes replication.
U2 Data Replication automatically issues a SYNC request to the publishing system every period defined by sync_interval. A sync_interval of 0 indicates a manual synchronization system, where
UniVerse or UniData does not automatically synchronize the systems.
9.
Optional: Select Connection Authorization. If you select this check box on the subscribing system location definition on the publishing system, you must define the connection user name and password to the publishing system location after you complete this dialog box.
10. In the Timeout field, define the timeout interval.
The timeout interval defines the number of seconds to wait if no packets are received before suspending replication.
The publishing system sends a packet to the subscribing system approximately every four seconds when replication is idle. If the publishing system had the timeout interval defined, the uvsub process counts the time that has elapsed between packets being received. If the amount exceeds the timeout interval, replication is suspended.
Note: Do not set the timeout interval to less than 2 minutes.
11. Enter the full path to the trigger in the
Exception Action field, or click Browse to locate the path. The Exception Action is a shell script on UNIX platforms, or a batch program on Windows platforms.
For more information about the exception action, see Replication action trigger, on page 59
.
44
Adding a publishing group
12. In the
Failover Action field, enter the full path to the failover action or click Browse to locate the path.
For more information about the faliover action script, see Cross-group transaction, on page 15 .
13. To define an account for replication, click
Add.
14. In the dialog box that appears, enter a name for the account in the Account Name field.
15. Enter the full path to the account in the
Account Path field, or click the arrow and select the full path to the account from the list.
The account information is written to the repsys file. You can refer to the account name in other areas of replication without having to specify the full path.
16. Click
Finish.
17. If you selected Connection Authorization previously, select the system and click Set Connection to define the connection user name and password to the publishing system.
18. In the dialog box that appears, enter the login name and the corresponding password. Reenter the password. Click
Finish.
Configuring U2 Data Replication
Adding a publishing group
After you have defined the replication systems, add a publishing group.
1. In XAdmin, from the U2 Resource pane, select the publisher server. From the Admin Tasks pane, expand
Replication then double-click Configuration.
The Replication pane appears.
2. Click the
Replication Group tab.
3. To add a publishing group, from the Publishing Groups area, click Add.
4. In the dialog box that appears, enter the ID of the publishing group in the
Group ID field.
5. Specify the publishing account by selecting the account where the files you want to publish reside from the Account list.
6. To define replication level, select the level of replication you want from the
Level list. You can select either
ACCOUNT or FILE replication.
If you select ACCOUNT, replication will occur at the account level for the account you selected.
This means every file in that account will be replicated.
If you select
FILE, only the files selected in the Files area will be replicated for the account you selected.
7. To add files to the publishing group, in the Files area, click Add.
A dialog box appears with all the files for your account listed. If you selected
ACCOUNT in step
5, you can still select specific files for reasons such as making them sub-writable. If you selected
FILE in step 5, select the specific files that you want to publish.
When you are done adding files, click Finish.
8. By default, both the Data and the Dict cells of the file are selected. If you do not want to publish the data portion of the file, clear the
Data check box (cell). If you do not want to publish the dictionary portion of the file, clear the
Dict check box (cell).
9. If you want to make any of the files that you selected sub-writeable, select the cell for that file.
A check mark appears in the SUB_WRITABLE column. Making a file sub-writable allows you to edit or change them on the subscriber without error.
10. If you are using account-level replication, select files to exclude from U2 Data Replication. To specify any files that are excluded, in the Excluded Files area, click Add.
Select the specific files that you want to exclude, and click
Finish.
45
Chapter 3: Administering U2 Data Replication
11. Set any of the configuration parameters necessary for your environment in the
Configuration
area.
For detailed information about these configuration parameters, see
Configuration phrases, on page 34 .
12. Click
Finish.
Previous topic:
Configuring U2 Data Replication
Adding a subscribing group
After you have added a publishing group, add a subscribing group.
1. In XAdmin, from the U2 Resource pane, select the subscriber server. From the Admin Tasks pane, expand
Replication then double-click Configuration.
The Replication pane appears.
2. Click the
Replication Group tab.
3. Decide whether you to manually add a subscribing group or you want to import the configuration from the one you set in the publishing server, as described in
Adding a publishing group, on page
45 . To add one manually, continue to the next step. To import the configuration, click
Import.
a. In the dialog box that appears, select the server where you set up the publishing group.
b. Select the version number.
c.
Select whether you want to merge or replace the subscribing configuration file with the remote one.
d. Click Finish.
The configuration is imported, and the values are automatically populated in the dialog box that appears.
e. Verify that your configuration is correct, and click Finish.
You have successfully added a subscribing group, and can move on to
Verifying the account defaults, on page 47 .
4. To add a subscribing group, from the Subscribing Groups area, click Add.
5. In the dialog box that appears, select the publishing system from which this subscribing system is receiving data from the
From System list.
6. Select the group ID from the publishing system in the Group ID list.
When you select the group ID, XAdmin populates the file list and configuration parameters from the same group ID on the publishing system.
7. Select the account to which you want to replicate data in the Into Account field. XAdmin automatically populates the Account Path field.
8. Click the file you want to receive. You can select multiple files by clicking the file while holding down the CTRL key.
9. By default, both the Data and the Dict cells of the file are selected. If you do not want to receive the data portion of the file, clear the Data check box (cell). If you do not want to receive the dictionary portion of the file, clear the Dict check box (cell).
10. If you want to be able to update the file on the subscribing system, select the SUB_WRITEABLE check box (cell).
11. If you are using account-level replication, select files to exclude from U2 Data Replication. To specify any files that are excluded, in the Excluded Files area, click Add.
Select the specific files that you want to exclude, and click
Finish.
12. In the Distributions area, click the value in the Type field, then select the ellipsis button (...) that appears.
46
Optional: Changing a replication group definition
13. In the dialog box that appears, select the type of replication mode you want and the account for the subscriber.
When choosing Realtime or Immediate subscribing, the subscribing system can optionally be defined as a standby system. This can be done by selecting the
Hot Standby check box. A standby system can also be optionally configured for delayed standby replication.
When selecting the
Hot Standby check box, a Delayed Time Period field appears. Enter the amount of time you want to delay the updates on the subscriber in minutes. When using delayed standby replication, the updates are immediately sent to the subscriber but are not applied until the delayed time period has elapsed.
Click
Finish.
14. Set any of the configuration parameters necessary for your environment in the
Configuration
area.
For detailed information about these configuration parameters, see
Configuration phrases, on page 34 .
15. Click Finish.
Optional: Changing a replication group definition
Previous topic:
Configuring U2 Data Replication
Optional: Changing a replication group definition
You can change a replication group definition without having to stop and restart UniVerse.
1. In XAdmin, from the U2 Resource pane, select the subscriber server. From the Admin Tasks pane, expand Replication then double-click Configuration.
2. From the
Replication Group tab, select the group that you want to update, then click Detail.
3. Make the appropriate changes, as described in
Adding a subscribing group, on page 46 and
Adding a publishing group, on page 45 , then click
Finish.
After making your changes, you may need to resubscribe the group to update the subscriber system’s configuration.
Verifying the account defaults
Previous topic:
Configuring U2 Data Replication
Verifying the account defaults
You can view the account defaults to see which files are automatically included (replicated) and excluded.
1. In XAdmin, from the U2 Resource pane, select a server. From the Admin Tasks pane, expand
Replication then double-click Configuration.
The Replication pane appears.
2. Click the
Account Default tab.
The Files area displays all of the default files that are included in the replication process. The
Excluded Files area displays all of the automatically excluded files.
3.
Optional: If you want to include or exclude a file, click Add next to Files or Excluded Files.
In the dialog box that appears, enter the file name, and select any applicable specifications –
Data, Dict, and/or SUB_WRITEABLE.
When you are done, click
Finish.
47
Chapter 3: Administering U2 Data Replication
Previous topic:
Optional: Changing a replication group definition
Configuring U2 Data Replication
Starting replication
After you have defined the replication systems and added both a publishing and subscribing group, you can start replication.
1. In XAdmin, from the U2 Resource pane, select the publishing or subscribing server. From the
Admin Tasks pane, expand
Replication then double-click Configuration.
The Replication pane appears.
2. Click the
Replication Tool tab.
3. From the Functions section, select the type of administrator option that you want to execute.
▪ Report – Reports the current status of a replication. This command is useful after a failure or failover occurs. For detailed information about this command, see
.
▪ Sync – Synchronizes subscribing systems to their publishing systems. The publishing system establishes a connection to the subscribing system and invokes the subscribing process.
UniVerse or UniData reads and transfers replication logs from the publishing system to the subscribing system. The subscribing system then applies the updates to the database. For detailed information about this commands, see
.
▪ Reconfig – Reconfigures the replication configuration while UniData or UniVerse is running.
For detailed information about this command, see reconfig command, on page 76 .
▪ Suspend – Suspends a live replication. In a suspended mode, UniVerse or UniData interrupts the connection between the publisher and the subscriber. The publishing system saves the replication log files to the replication logs reserve file rather than transferring them to the subscribing systems. The subscribing system and all replication writer processes stop after they finish updating existing logs in the replication buffer. For detailed information about this
command, see suspend command, on page 73
.
▪ Failover – Changes the replication direction on a local system, either from the local system to the publishing system or subscribing system, or changes the subscribing source distribution.
For detailed information about this command, see failover command, on page 75 .
▪ Reset – The reset command clears saved replication logs in the replication log reserve file. Use the reset command after you copy or store database files, since the remaining replication logs
are no longer useful. For detailed information about this command, see reset command, on page 77
.
▪ Enable – Enables replication.
▪ Disable – Disables replication. For more information, see
Disabling replication, on page 11
.
4. The choices in the
Options section become available based on which function you select. Select the appropriate options for this replication.
5. Select whether you want a target definition of All or Selected.
A target is a replication, a replication group, or a distribution of a replication group. A replication is all data replicated from a remote system to the local system, or from a local system to a remote system. A target definition of ALL represents all replications on the system. One command can have multiple targets.
If you want to execute the command against all targets, leave All selected in the Targets area.
If you want to select the replication to execute the command against, select the
Selected option in the
Targets area of the replication tool dialog box, then click Add. In the dialog box that appears, enter the target information, then click
Finish.
6. Start the replication process by selecting Execute.
48
Diagnosis utility
Any output from the command appears in the
Status box.
Previous topic:
Verifying the account defaults
Configuring U2 Data Replication
Diagnosis utility
The diagnosis utility is used by U2 support for diagnosing problems encountered with U2 Data
Replication. With the utility, you can view information such as the current configuration, groups, semaphores, and other general information that can help you troubleshoot any issues you have with replication.
To access the diagnosis utility, in XAdmin, select the server you want to diagnose. From the
Admin
Tasks pane, expand Replication, then double-click Configuration. Click the Diagnosis Utility tab.
You can use the command line to display the same information as the diagnosis utility. For more information, see
Listing replication files, on page 66 .
Administering U2 Data Replication through the command line
You can define publishing and subscribing groups and change their definitions directly from the command line
To administer U2 Data Replication from the command line, perform the following tasks:
•
Defining subscribing groups from the command line
Define a subscribing replication group from the command line.
•
Defining publishing groups from the command line
Define a publishing replication group from the command line.
•
Changing a replication group definition from the command line
Reconfigure U2 Data Replication from the command line.
Defining subscribing groups from the command line
Define a subscribing replication group from the command line.
1. Log on to the subscribing system.
2. Edit the repsys file, located in the uvhome directory. Define all replication systems in the replication environment to which U2 Data Replication may connect.
3. Edit the repconfig file located in the the uvhome directory.
Define all the replication groups you want to replicate from the publisher. Make sure you use the same group name used on the publisher.
▪ Copy the file list of the group from the publisher.
▪ Define the publishing system according to the definition on the publisher.
▪ Define the subscribing system, and define the replication type.
▪ If you are going to use this system as a standby subscriber, define all other distributions of the group and their replication types, according to the definition on the publisher.
49
Chapter 3: Administering U2 Data Replication
▪ Set the replication group configurable parameters.
▪ Define the subscribing account path in replication.
4. Create the subscribing account, then copy all files from the publishing system to the subscribing system.
5. Restart UniVerse, or execute the uv_repadmin reconfig command to load the replication group definition and allocate system resources.
Administering U2 Data Replication through the command line
Defining publishing groups from the command line
Define a publishing replication group from the command line.
1. Log on to the publishing system.
2. Edit the repsys file, located in the uvhome directory. Define all replication systems in the replication environment to which U2 Data Replication may connect.
3. Edit the repconfig file, located in the uvhome directory.
For each replication group, define the following information:
▪ Assign a unique replication group name.
▪ Define the replication level.
▪ Define the location of the publishing account.
▪ Define excluded files for account-level replication.
▪ Define all files belonging to the file-level replication group.
▪ Define the distribution for the group, including the publishing system and all subscribing systems to which it replicates.
▪ Define the replication type for each of the distribution systems.
▪ Set the replication group configurable parameters.
4. Restart UniVerse, or execute the uv_repadmin reconfig command.
Administering U2 Data Replication through the command line
Changing a replication group definition from the command line
Reconfigure U2 Data Replication from the command line.
1. Log on to the replication system you want to reconfigure.
2. Make your changes in the repsys and repconfig files.
3. Synchronize the reconfigured group from its publisher or to its subscriber.
4. Execute the
RECONFIG command to request that the replication manager reconfigure the replication group.
The replication manager executes the uv -admin -L command to block writes to the database.
The replication manager requests that all replication groups suspend replication.
The replication manager reads the new repconfig and repsys files, and compares them to the original file.
The replication manager checks the consistency of the definition, and checks each of the groups that are changing to see if there are any replication logs not synchronized to its subscribers.
50
Monitoring U2 Data Replication
The replication manager reallocates shared memory segments, reloads the replication configurations, and the Inode and device number of each replication object.
The replication manager executes the uv -admin -U command to resume processing.
If you selected the AUTORESUME option, the replication manager synchronizes and resumes all realtime and immediate replication groups to its publishers and subscribers. If you did not select the
AUTORESUME option, you should synchronize manually.
Administering U2 Data Replication through the command line
Monitoring U2 Data Replication
There are two main ways of monitoring the status of U2 Data Replication:
▪ Using XAdmin, as described
Monitoring replication through XAdmin, on page 51 .
▪ Using the REPLOGGER, as described in
Monitoring replication with REPLOGGER, on page 58
.
Monitoring replication through XAdmin
The replication monitoring tool monitors connection status, data transferring, and whether the publisher and subscriber systems are synchronized.
1. To access the replication monitor, in XAdmin, select the publishing server. From the Admin Tasks pane, expand
Replication, then double-click Performance and double-click Status.
Two tabs appear: the Replication Performance Monitor tab and the Replication Status
Monitor tab. These tabs work together to monitor replication.
You can monitor two types of replication:
▪ Publishing replication – the data replication from the local system to a remote subscribing system, including all replication groups involved. A publishing system can have more than one publishing replication defined.
▪ Subscribing replication – the data replication from a remote publishing system to the local system, including all replication groups involved. A subscribing system can have more than one subscribing replication defined.
2.
Optional: You can perform the previous step again but for the subscribing server. This step is not required, but can be useful because you can see how the publisher and the subscriber communicate with each other.
3. Click the
Replication Performance Monitor tab.
a. Select the name of the replication you want to monitor from the Replications list.
Each replication is assigned a unique name on one system, consisting of the replication type and the remote system name. A replication type can be one of the following:
▪ Immediate
▪ Standby immediate
▪ Realtime
▪ Standby realtime
▪ Deferred
Note: If a replication has failed over, it still belongs to the same replication as it did before the failover, but the name changes.
51
Chapter 3: Administering U2 Data Replication b. Select the number of seconds to refresh the monitor in the
Interval in seconds field. The default interval is 3 seconds.
c.
Next to the Server Control field, click
Start Test Period.
d. Next to the Interval in seconds field, click Start.
The replication group status table displays the current status of each replication group belonging to the replication you specify. The following example shows the replication group status table.
e. Select a row, then below the table, select either
Buffer Usage, Data Volume, or Latency
Split to view the extended results displayed below the table.
The following example shows the replication group status table with Buffer Usage selected.
The following example shows the replication group status table with
Data Volume selected.
The following example shows the replication group status table with Latency Split selected.
52
Monitoring replication through XAdmin f.
By default, the table displayed with General selected. You can also view the table by test period by selecting TP Split from above the table.
The following example shows the results displayed using the TP Split option.
4. Click the Replication Status Monitor tab.
a. Select the name of the replication you want to monitor from the
Replications list.
b. Select the number of seconds to refresh the monitor in the Interval in seconds field. The default interval is 3 seconds.
c.
Next to the Interval in seconds field, click Start.
Two traffic lights appear along with details about the replication, as displayed in the following example.
For more information about what this table displays, see
The Replication Status Monitor tab, on page 54
53
Chapter 3: Administering U2 Data Replication
5.
Optional: If you opened the Replication Performance Monitor tab and the Replication Status
Monitor tab for both the publisher and the subscriber, repeat the previous two steps to start both tests.
The Replication Status Monitor tab
The following table describe the functionality from the
Replication Status Monitor tab.
Field/Area
Replication Status
Sync Status
Replication Details
Description
The replication status indicates whether the publisher and subscriber are connected. The status can be one of the following:
▪ Green – The publisher and subscriber are connected for all groups involved in the replication.
▪ Yellow – At least one of the replication groups has been suspended by an administrator.
▪ Red – At least one of the replication groups has been terminated abnormally.
The sync status indicates whether the subscribing database is synchronized with the publishing database. The status can be one of the following:
▪ Green – The publishing and subscribing databases are synchronized.
▪ Yellow – There are pending updates that have not been applied to the subscribing database.
Provides specific details about replication as described below.
54
The Replication Status Monitor tab
Field/Area Description
Packet
Received
The number of packets received from the other party of the replication.
Types of packets include data packets, confirmation packets, heartbeat packets, and other control packets. Monitoring this information indicates whether the physical connection between the publishing database and the subscribing database is satisfactory. This number is cumulative from the last time UniVerse was started or U2 Data Replication was reconfigured.
Packet Sent The number of packets that have been sent to the other party of the replication. Types of packets include data packets, confirmation packets, heartbeat packets and other control packets. Monitoring this information indicates whether the physical connection between the publishing database and the subscribing database is satisfactory. This number is cumulative from the last time UniVerse was started or U2 Data Replication was reconfigured.
Subscriber
Received
The number of data records that have been received by the subscriber. This number is cumulative from the last time UniVerse was started or U2 Data
Replication was reconfigured.
Subscriber
Committed
Note: When monitoring a publishing replication this number may be out of date if the replication status is not green.
The number of data records that have been committed on the subscribing database. This number is cumulative from the last time UniVerse was started or U2 Data Replication was reconfigured.
Publisher
Committed
TP Total
CGTPs
Resolved
Disablement
Disk Pct
Max Replog
Size
Current
Replog Size
Replication group status table
Note: When monitoring a publishing replication this number may be out of date if the replication status is not green.
The number of data records that have been committed on the publishing database. This number is cumulative from the last time UniVerse was started or U2 Data Replication was reconfigured.
The sum of all transactions committed in the replication groups on the local system. This number is cumulative from the last time UniVerse was started or U2 Data Replication was reconfigured.
The sum of all transactions committed across more than one replication group on the local system. This number is cumulative from the last time
UniVerse was started or U2 Data Replication was reconfigured.
The replication log disk percentage defined by the uvconfig file parameter REP_DISABLE_DISK_PCT.
The limit the replication log file size can reach before U2 Data Replication is disabled.
The total replication log file size for all replication groups.
The replication group status table displays the current status of each replication group belonging to the replication you specify. See the following table for a description of each column of this table.
The following table describes the columns in the replication group status table.
Column
Group name
Description
The name of the replication group.
55
Chapter 3: Administering U2 Data Replication
Column
Connection
Status
In-Sync
Description
The connection status between the publishing system and the subscribing system in the group. The status can be one of the following:
▪ Green – The publisher and subscriber are connected in this group.
▪ Yellow – The replication group has been suspended by an administrator.
▪ Red – The replication group has terminated abnormally.
Indicates whether the subscribing files are synchronized with the publishing files in the group. The in-sync status can be one of the following:
▪ Green – The publishing and subscribing databases are synchronized.
▪ Yellow – There are pending updates in this replication group that have not been applied to the subscribing database.
Rep. Status The current replication group status.
▪ REP_RUNNING – The replication is running.
▪ REP_SYNCING – The replication is performing synchronization.
▪ REP_SUSPENDED – The replication is suspended.
▪ REP_DO_SUSPEND – The replication is in the process of suspending.
▪ REP_EXIT – The replication is suspended due to an abnormal termination.
The status can be one of the following on the subscribing system:
▪ SUB_STOP – The replication is stopped.
▪ SUB_EXIT – The subscribing system has exited abnormally.
▪ SUB_SHUTDOWN – The replication on the subscribing system has been shut down.
▪ SUB_RUNNING – The replication on the subscribing system is running.
▪ SUB_DO_RECONFIG – A reconfiguration process is occurring on the subscribing system.
▪ SUB_DO_SUSPEND – The replication is suspended on the subscribing system.
▪ SUB_SYNCING – The replication is performing synchronization on the subscribing system.
▪ SUB_RESYNCING – The replication is performing resynchronization on the subscribing system.
#Recv’d
▪ SUB_DO_FAILOVER – The subscribing system is performing a failover.
Changed By The event or reason that caused the replication status to change. If the status changed due to an exception, this column displays the error category and error code. A detailed error string is available in the tool tips. See the following table for a description of each of the events.
The number of packets received in the group. Monitoring this number indicates if the physical connection between the publishing system and subscribing system is satisfactory.
#Sent The number of packets sent in the group. Monitoring this number indicates if the physical connection between the publishing system and subscribing system is satisfactory. This number is cumulative from the last time UniVerse was started or U2
Data Replication was reconfigured.
56
The Replication Status Monitor tab
Column Description
Data
Replicated
SubGot
SubAvail
The total amount of data, in bytes, replicated in the group. On a publishing system this field represents the total amount of data sent out. On a subscribing system, this field represents the total amount of data received from the publishing system. This number is cumulative from the last time UniVerse was started or U2 Data Replication was reconfigured.
The log sequential number of the latest replication log received by the subscribing system. This number is cumulative from the last time UniVerse was started or U2 Data
Replication was reconfigured.
The log has been loaded into the replication buffer and is available for the replication writer processes.
SubDone The log sequential number of the latest replication log committed to the subscribing database. This number is cumulative from the last time UniVerse was started or U2
Data Replication was reconfigured.
PubDone The log sequential number of the latest replication log committed to the publishing database. This number is cumulative from the last time UniVerse was started or U2
Data Replication was reconfigured.
#TP The number of transactions resolved in this group, including cross-group transactions.
This number is cumulative from the last time UniVerse was started or U2 Data
Replication was reconfigured.
Data
Transfer
The total amount of transferred data that has been replicated.
Data Size The total size of data replicated.
Pacing
Level
Total
Degradation
Total Rep
Log Size
The replication pacing level in a group, as defined in the REP_PACING parameter in the repconfig file.
The total group pacing weight since the UniVerse system has started or U2 Data
Replication was reconfigured.
The current replication log file size including LEF and LRF.
The following table describes the valid events of reasons that appear in the Changed By column that can cause a change in the replication status.
Event/Reason
AUTO_SYNC
CGTP_SUSPEND
CM_REQUEST
DBA_ORDER
ENABLE
FAILOVER
PUB_REQUEST
PUB_STARTUP
RECONFIG
REMOTE_REQ
REP_DISABLED
SCHEDULED
Description
Replication is automatically resuming.
Cross-group transaction processing is suspended.
Checkpoint manager is requested (RFS only).
The system administrator issued a request resulting in a change of status.
Replication is enabled.
A failover has occurred.
A request was sent from the publishing system, or an event occurred on the publishing system resulting in a change of status.
The publishing system started.
Replication is reconfiguring.
A subscribing system can request to execute a
SYNC command on the publishing system.
Replication is disabled.
The repmanager process can only schedule a
SYNC command for deferred replication.
57
Chapter 3: Administering U2 Data Replication
Event/Reason
SUB_REQUEST
SYNCDONE
SYS_STARTUP
Description
A request was sent from the subscribing system, or an event occurred on the subscribing system resulting in a change of status.
A synchronization process succeeded.
The UniVerse system started.
Monitoring replication with REPLOGGER
REPLOGGER is a BASIC program that allows you to monitor replication. REPLOGGER collects information from the replication system using the replication administration uvreptool and writes the information to a sequential log file. The information logged by REPLOGGER describes how the replication system performs over a period of time. Using REPLOGGER helps you understand and analyze how your replication system responds to changing workloads. REPLOGGER can produce a large amount of data, so to aid in analyzing and visualizing the data, a Java tool called the U2
Replication Analyzer is available on github to graph the result sets.
To run the BASIC program, perform the following steps.
Note: You must be a super user to run REPLOGGER. REPLOGGER should be run on the subscriber.
1. At the ECL or TCL prompt, enter
REPLOGGER.
The REPLOGGER BASIC program starts and prompts you to enter the following information:
▪ the number of replication groups; if this is a single machine replication, this number should be doubled because it counts both publisher and subscriber
▪ whether to clear previous logs
▪ the capturing interval time, in seconds
▪ the maximum log file size, in megabytes
You can alternatively enter the answers to the prompts directly in the command line when starting REPLOGGER, as shown in the following example:
REPLOGGER 1 y 2 100
2. After you enter the prompts, press Enter.
The REPLOGGER BASIC program starts. The results are written to the rep_monitor.log file in the current account.
The following is an example of REPLOGGER executed in a Linux environment.
Current working directory is /disk1/u2test/test81_97837/testRFS.
:REPLOGGER
Replication Logging Tool. Ver 2.1
Program Starts: 12:02:03 04 Nov 2015
Please enter the number of replication groups:
?1
Clear the previous logs:(y/n)
?Y
Old logs have been cleared.
Enter the capturing interval in seconds:
?5
Enter the maximum log file size in Mega Bytes(MBs):
?100
58
Replication action trigger
Replication Logging Tool. Ver 2.1
Program Starts: 12:02:03 04 Nov 2015
Waiting for data...
Press Ctrl+C to exit.
[root@den-ci125 testRFS]# cat rep_monitor.log
GROUP.NO DATE.TIME PUB.DONE SUB.GOT SUB.AVAIL SUB.DONE LIEFSTART
LEFNO.START LEFNO.LAST LEFPOS.START LEFPOS.END USER.TIME(%) SYS.TIME(%) TCA.MODULO
TOTAL.PG TCA.FILE.ACCESS TCR.CREATE TCR.DROP
0 10:36:22 14 SEP 2015 44935 44935 44936 44523 0 1 1 0 0 2 21 2457 4096 0 0 0
0 10:36:25 14 SEP 2015 49306 49306 49307 46947 0 1 1 0 0 1 25 2457 4096 0 0 0
0 10:36:28 14 SEP 2015 52541 52541 52542 48404 0 1 1 0 0 1 24 2457 4096 0 0 0
0 10:36:32 14 SEP 2015 54991 54991 54992 49544 0 1 1 0 0 1 28 2457 4096 0 0 0
0 10:36:35 14 SEP 2015 57275 57275 57276 50600 0 1 1 0 0 2 29 2457 4096 0 0 0
0 10:36:38 14 SEP 2015 59157 59157 59158 51464 0 1 1 0 0 2 31 2457 4096 0 0 0
0 10:36:41 14 SEP 2015 60001 60001 60002 52303 0 1 1 0 0 1 33 2457 4096 0 0 0
0 10:36:44 14 SEP 2015 60001 60001 60002 53059 0 1 1 0 0 1 36 2457 4096 0 0 0
0 10:36:47 14 SEP 2015 60001 60001 60002 53854 0 1 1 0 0 1 46 2457 4096 0 0 0
0 10:36:50 14 SEP 2015 60001 60001 60002 54737 0 1 1 0 0 1 46 2457 4096 0 0 0
0 10:36:54 14 SEP 2015 60001 60001 60002 55531 0 1 1 0 0 2 46 2457 4096 0 0 0
0 10:36:57 14 SEP 2015 60001 60001 60002 56312 0 1 1 0 0 2 46 2457 4096 0 0 0
0 10:37:00 14 SEP 2015 60001 60001 60002 57029 0 1 1 0 0 1 46 2457 4096 0 0 0
0 10:37:03 14 SEP 2015 60001 60001 60002 57748 0 1 1 0 0 1 47 2457 4096 0 0 0
0 10:37:06 14 SEP 2015 60001 60001 60002 58414 0 1 1 0 0 1 46 2457 4096 0 0 0
0 10:37:09 14 SEP 2015 60001 60001 60002 59091 0 1 1 0 0 1 48 2457 4096 0 0 0
0 10:37:12 14 SEP 2015 60001 60001 60002 59705 0 1 1 0 0 1 18 2457 4096 0 0 0
0 10:37:15 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:19 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:22 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:25 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:28 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:31 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:34 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:37 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 1 2457 4096 0 0 0
0 10:37:40 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
0 10:37:43 14 SEP 2015 60001 60001 60002 60001 0 1 1 0 0 0 0 2457 4096 0 0 0
[root@den-ci125 testRFS]#
Replication action trigger
A replication action trigger allows you to define an action to take should replication abnormally terminate, making the replication status indicator red. The repmanager process initializes the action defined in the trigger whenever it receives a replication exception notice.
The replication action trigger is a shell script on UNIX platforms, or a batch program on Windows platforms. Define the full path to the trigger using the EXCEPTION_ACTION clause in the repsys file.
For example, if you define a replication action trigger as
UVRepExceptionAction.sh in the / usr/u2 directory, set the EXCEPTION_ACTION clause as:
EXCEPTION_ACTION=/usr/u2/UVRepExceptionAction.sh
U2 Data Replication passes parameters to the replication action trigger through environment variables. You can use the following environment variables in the replication action trigger program:
▪ UNIREP_REMOTESYS – the remote system name of the replication.
▪ UNIREP_REPTYPE – the type of replication.
▪ UNIREP_GRPNAME – the replication group name where the exception occurred.
59
Chapter 3: Administering U2 Data Replication
▪ UNIREP_ERRCODE – the exception error code.
▪ UNIREP_ERRSTRING – the exception error string.
If a replication contains multiple replication groups, U2 Data Replication treats the interruption of each group as a separate event, and executes the trigger for that group. If a single group belongs to multiple replications, each interruption of the replication triggers the replication action trigger to run.
UNIREP_REMOTESYS and UNIREP_REPTYPE define the replication where the exception occurred.
We recommend using the replication action trigger to automatically ping or email the system administrator to advise that an exception occurred. We do not recommend using it to automatically failover to a standby system.
Note that the replication action trigger only executes if an unexpected event that suspends U2 Data
Replication occurs. If a system administrator executes a command that suspends U2 Data Replication, the replication action trigger is not invoked.
When the replication action trigger is executed, the repmanager process writes a message similar to the following example in the rm.log:
Execute Replication Exception Action program <program_path>
Replication action trigger example
The following example illustrates a replication action trigger shell script in UniVerse. The example is similar to the replication action trigger for UniData.
#!/bin/sh
#
# Replication Status Code that returned by uv_repadmin report command
#
# (c) Rocket Software 2014 - 2016 All Rights Reserved
# Disclaimer of Warranties. Rocket Software disclaims to the fullest extent authorized
# by law any and all other warranties, whether express or implied, including, without
# limitation, any implied warranties
# of merchantability or fitness for a particular purpose. Without limitation of the
# foregoing, Rocket Software expressly does not warrant that:
# (a) the software will meet your requirements [or expectations];
# (b) the software or the software content] will be free of bugs, errors, viruses or
# other defects;
# (c) any results, output, or data provided through or generated by the software will
# be accurate, up-to-date, complete or reliable;
# (d) the software will be compatible with third party software;
# (e) any errors in the software will be corrected.
#
# 1.3.1 JDS 25/02/14 First Proposed Customer Release
# 1.3.2 JDS 20/05/15 Corrected check to be /.uvhome not .uvhome
# 1.3.5 JDS 03/06/15 Change to all_synced check for disablement
# 1.4.7 JDS 16/01/16 Spelling Change and Corrected Check for Sync Failure Subject
# in Email
# 1.4.8 JDS 27/01/16 Change to ignore publishing group errors on Recovery
# This is for sites with mixed publishing and subscribing groups
# On the same machine
#
# Publishing group Status Codes export PUB_STOP=1 #/* group is normally stopped */ export PUB_EXIT=2 #/* group has quit abnormally.*/ export PUB_SHUTDOWN=3 #/* group is doing shutdown */ export PUB_RUNNING=4 #/* group is in running mode */ export PUB_DO_RECONFIG=5 #/* group is doing reconfigure */ export PUB_DO_FAILOVER=7 #/* group is doing failover */
60
Replication action trigger example
# Publishing Replication Status Codes export REP_RUNNING=11 #/* replication is in running mode */ export REP_SUSPENDED=12 #/* replication is in suspension mode */ export REP_SYNCING=13 #/* replication is in syncing mode */ export REP_DO_SUSPEND=14 #/* replication is doing suspend */ export REP_DO_SYNC=15 #/* replication is doing sync */ export REP_EXIT=16 #/* replication exit */ export REP_DISABLED=17 #/* replication disabled */
# Subscribing Replication/group status codes.
export SUB_STOP=21 #/* group is normally stopped */ export SUB_EXIT=22 #/* group has quit abnormally.*/ export SUB_SHUTDOWN=23 #/* group is doing shutdown */ export SUB_RUNNING=24 #/* replication is in running mode */ export SUB_DO_RECONFIG=25 #/* group is doing reconfigure */ export SUB_DO_SUSPEND=27 #/* replication is suspending */ export SUB_SYNCING=28 #/* replication is doing sync */ export SUB_DO_FAILOVER=29 #/* group is doing failover */ export SUB_RESYNCING=30 #/* group is doing re-syncing */
# Script Version export REP_EXCEP_SCRIPT_VERSION=1.4.8
export debugrequest=0 export versionrequest=0 while getopts ":xv" opt; do case $opt in x ) debugrequest=1 ;; v ) versionrequest=1 ;; esac done if [ $debugrequest = 1 ] then
set -x fi if [ $versionrequest = 1 ] then
echo "Script Version is :"$REP_EXCEP_SCRIPT_VERSION
exit 0 fi
# Check UVHOME uvhome="$UVHOME" if [ "$uvhome" = "" ] then
export UVHOME=`cat /.uvhome` fi uvbin="$UVBIN" if [ "$uvbin" = "" ] then
export UVBIN=$UVHOME/bin fi
# Number of minutes to check before running script again export PUBCHECKMIN=2 export SUBCHECKMIN=2 export DISCHECKMIN=2
# Sleep is in seconds not minutes export RESYNCSLEEP=120
# export MAILRECS="[email protected],[email protected]"
# Show exception time export dstring=`date` export reportfilename=$UVHOME'/RepExcept.errlog' export scriptrunningname=$UVHOME'/RepExcept.running' if [ -f $scriptrunningname ] then
61
Chapter 3: Administering U2 Data Replication
echo $scriptrunningname" found script already running - exiting"
exit 5 fi echo "Run Started at :"$dstring > $scriptrunningname echo "UniVerse Replication Exception called at:"$dstring > $reportfilename echo "Script Version is:"$REP_EXCEP_SCRIPT_VERSION >> $reportfilename export machinename=`uname -a | awk '{print $2}'` echo "Run on machine "$machinename >> $reportfilename echo "Is this the publisher or subscriber" >> $reportfilename export cmd="$UVBIN/uv_repadmin report $UNIREP_REMOTESYS"
$cmd returncode=$?
echo "returncode=$returncode" >> $reportfilename export publisher=0 export subscriber=0 export disabled=0 if [ $returncode -lt 17 ] then
publisher=1 fi if [ $returncode -gt 17 ] then
subscriber=1 fi if [ $returncode = "17" ] then
disabled=1 fi if [ $publisher = 1 ] then
echo "System is a publisher" >> $reportfilename fi if [ $subscriber = 1 ] then
echo "System is a subscriber" >> $reportfilename fi if [ $disabled = 1 ] then
echo "Replication is Disabled !" >> $reportfilename fi
# Check Last Run Time and avoid running multiple times export checkfilename=$UVHOME'/RepExcept.runtime' export ddatetime=`date +"%Y %j %H %M"` ddatetime=`echo $ddatetime | sed 's/ //g'` export run_check=0 if [ ! -f $checkfilename ] then
# Put the current date time into the log file
echo $ddatetime > $checkfilename
run_check=1 else
ldatetime=`cat $checkfilename`
if [ $publisher = 1 ]
then
tdatetime=`expr $ldatetime + $PUBCHECKMIN`
fi
if [ $subscriber = 1 ]
then
tdatetime=`expr $ldatetime + $SUBCHECKMIN`
fi
if [ $disabled = 1 ]
then
62
Replication action trigger example
tdatetime=`expr $ldatetime + $DISCHECKMIN`
fi
echo "Last run at "$ldatetime >> $reportfilename
echo "Current "$ddatetime >> $reportfilename
echo "Next "$tdatetime >> $reportfilenane
if [ $ddatetime -gt $tdatetime ]
then
run_check=1
echo $ddatetime > $checkfilename
fi fi echo "Run Check "$run_check >> $reportfilename if [ $run_check = 0 ] then
rm $scriptrunningname
exit fi
# Show environment variables passed from replication system echo "UNIREP_REMOTESYS="$UNIREP_REMOTESYS >> $reportfilename echo "UNIREP_REPTYPE="$UNIREP_REPTYPE >> $reportfilename echo "UNIREP_GRPNAME="$UNIREP_GRPNAME >> $reportfilename echo "UNIREP_ERRCODE="$UNIREP_ERRCODE >> $reportfilename echo "UNIREP_ERRSTRING="$UNIREP_ERRSTRING >> $reportfilename echo "UVBIN=$UVBIN" >> $reportfilename echo "Return Error Codes" >> $reportfilename echo "NO ERROR=0" >> $reportfilename echo "PUB_STOP="$PUB_STOP >> $reportfilename echo "PUB_EXIT="$PUB_EXIT >> $reportfilename echo "PUB_SHUTDOWN="$PUB_SHUTDOWN >> $reportfilename echo "PUB_RUNNING="$PUB_RUNNING >> $reportfilename echo "PUB_DO_RECONFIG="$PUB_DO_RECONFIG >> $reportfilename echo "PUB_DO_FAILOVER="$PUB_DO_FAILOVER >> $reportfilename echo "REP_RUNNING="$REP_RUNNING >> $reportfilename echo "REP_SUSPENDED="$REP_SUSPENDED >> $reportfilename echo "REP_SYNCING="$REP_SYNCING >> $reportfilename echo "REP_DO_SUSPEND="$REP_DO_SUSPEND >> $reportfilename echo "REP_DO_SYNC="$REP_DO_SYNC >> $reportfilename echo "REP_EXIT="$REP_EXIT >> $reportfilename echo "REP_DISABLED="$REP_DISABLED >> $reportfilename echo "SUB_STOP="$SUB_STOP >> $reportfilename echo "SUB_EXIT="$SUB_EXIT >> $reportfilename echo "SUB_SHUTDOWN="$SUB_SHUTDOWN >> $reportfilename echo "SUB_RUNNING="$SUB_RUNNING >> $reportfilename echo "SUB_DO_RECONFIG="$SUB_DO_RECONFIG >> $reportfilename echo "SUB_DO_SUSPEND="$SUB_DO_SUSPEND >> $reportfilename echo "SUB_SYNCING="$SUB_SYNCING >> $reportfilename echo "SUB_DO_FAILOVER="$SUB_DO_FAILOVER >> $reportfilename echo "SUB_RESYNCING="$SUB_RESYNCING >> $reportfilename
# Run uv_repadmin report command export cmd="$UVBIN/uv_repadmin report -detail $UNIREP_REMOTESYS" echo "Now running:"$cmd >> $reportfilename
$cmd >> $reportfilename echo "showuv" >> $reportfilename
$UVBIN/showuv >> $reportfilename echo "Please See "$reportfilename" for more information" >> $reportfilename
# SendMail of Failure echo "Attempting First SendMail" >> $reportfilename if [ $disabled = 1 ] then
echo "Subject: REPLICATION DISABLED" | cat - $reportfilename | /usr/lib/sendmail
-F $machinename -t $MAILRECS
echo "Replication Disabled Email Sent" >> $reportfilename
63
Chapter 3: Administering U2 Data Replication else
echo "Subject: REPLICATION SUSPENDED" | cat - $reportfilename | /usr/lib/sendmail
-F $machinename -t $MAILRECS
echo "Replication Suspended Email Sent" >> $reportfilename fi if [ $publisher = 1 ] then
echo "System Reported it was a publisher no need to try sync" >> $reportfilename
rm $scriptrunningname
exit 0 fi if [ $disabled = 1 ] then
echo "System Reported Replication was disabled no need to try sync" >>
$reportfilename
rm $scriptrunningname
exit 0 fi
# Check all groups are suspended before proceeding
# Not Needed for Publisher or if Replication is disabled export all_suspended=0 export try=0 while [ $all_suspended = 0 -a $try -lt 10 ] do
sleep 5
all_suspended=1
menu_str="2\n0\n0\n0\n\n\n"
for grpname in `printf $menu_str | $UVBIN/uvreptool | grep "^Group" |
awk '{print $3}'`; do
if [ $all_suspended ]
then
# Run uv_repadmin report command
export cmd="$UVBIN/uv_repadmin REPORT GROUP $grpname DISTRIB $UNIREP_REMOTESYS"
echo "Try Counter is "$try >> $reportfilename
echo "Now running:"$cmd >> $reportfilename
$cmd
returncode=$?
echo "returncode=$returncode" >> $reportfilename
if [ $returncode -gt 30 ]
then
# Report command failed
echo "Report command failed, exit." >> $reportfilename
exit 2
rm $scriptrunningname
elif [ $returncode = $REP_SUSPENDED -o $returncode = $SUB_STOP -o
$returncode = $SUB_EXIT ]
then
echo "Group $grpname is suspended." >> $ filename
else
all_suspended=0
fi
fi
done
try=`expr $try + 1` done if [ $all_suspended = 0 ] then
echo "Number of Try's Exceeded to Confirm All Groups Suspended" >> $reportfilename
echo "Subject: UNABLE TO CONFIRM SUSPENSION OF ALL GROUPS (NO SYNC
WILL BE ATTEMPTED)" | cat - $reportfilename | /usr/lib/sendmail
-F $machinename -t $MAILRECS
echo "Unable to confirm suspension email sent" >> $reportfilename
64
Replication action trigger example
rm $scriptrunningname
exit 3 fi echo "Subject: CONFIRMED SUSPENSION OF ALL GROUPS - Resync Attempt in 2 Minutes"
| cat - $reportfilename | /usr/lib/sendmail -F $machinename -t $MAILRECS echo "Confirmation suspension email sent" >> $reportfilename
# Try automatic resync and resume - only run on subscriber echo "Sleeping for $RESYNCSLEEP" >> $reportfilename sleep $RESYNCSLEEP echo "Woke up from Sleep" >> $reportfilename export all_synced=1 export group_syncing=1 menu_str="2\n0\n0\n0\n\n\n" for grp_name in `printf $menu_str | $UVBIN/uvreptool | grep "^Group"
| awk '{print $3}'`; do
cmd="$UVBIN/uv_repadmin sync -wait -verbose GROUP $grp_name
DISTRIB $UNIREP_REMOTESYS"
echo "Now running:"$cmd >> $reportfilename
$cmd >> $reportfilename
returncode=$?
echo "Return code=$returncode" >> $reportfilename
if [ $returncode = 0 ]
then
echo "Group Sync Worked" >> $reportfilename
else
export cmd="$UVBIN/uv_repadmin report GROUP $grp_name"
echo "Now running:"$cmd >> $reportfilename
$cmd
returncode=$?
echo "returncode=$returncode" >> $reportfilename
if [ $returncode = $REP_SYNCING -o $returncode = $REP_DO_SYNC -o $returncode =
$REP_RUNNING -o $returncode = $SUB_RUNNING -o $returncode = $SUB_SYNCING -o
$returncode = $SUB_RESYNCING ]
then
group_syncing=1
else
group_syncing=0
fi
if [ $returncode -lt 17 ]
then
group_syncing=1
echo "group appears to be a publishing group so and sync failures are
ignored"
fi
echo "group_syncing=$group_syncing" >> $reportfilename
if [ $group_syncing = 0 ]
then
echo "Group Sync Failed" >> $reportfilename
all_synced=0
fi
fi
sleep 1 done echo "all_synced flag = "$all_synced >> $reportfilename if [ $all_synced = 1 ] then
echo "Subject: Sync Commmands Worked - Please Check Systems" | cat
- $reportfilename | /usr/lib/sendmail -F $machinename -t $MAILRECS else
echo "Subject: SYNC COMMANDS FAILED - PLEASE CHECK SYSTEMS" | cat
- $reportfilename | /usr/lib/sendmail -F $machinename -t $MAILRECS
65
Chapter 3: Administering U2 Data Replication
rm $scriptrunningname
exit 4 fi rm $scriptrunningname exit 0
Listing replication files
Use the
LIST.REPLICATION.FILE command to list active replication files in your application. This command lists all replication file entries for an account or file you specify.
LIST.REPLICATION.FILE [ALL |DICT |DATA] filename[,subfile] NO.PAGE
If you specify ALL, UniVerse displays all active replication files in the current account. If the local account is an account-level replication account, this command displays the account as well.
If you specify a file name, UniVerse displays all replication files contained in the replication file table related to that file. If you do not specify ALL or filename, UniVerse obtains the file names from an active select list, or prompts for input.
LIST.REPLICATION.FILE displays the following information about replicated files:
▪ FTYPE – The type of file. Valid file types are:
▫ LF – LF directory
▫ DICT – Dictionary file
▫ DATA – Hashed file
▫ QDICT – Q-pointer dictionary file
▫ QDATA – Q-pointer data file
▫ QLF – Q-pointer LF directory
▫ ACCT – The account-level replication account
▪ FILE NAME – The VOC file name in the replication file table. If the replication file is not located in the local account, the
LIST.REPLICATION.FILE command also lists the path to the file.
▪ REPLICATION – The replication definition for the file.
▫ PUBLISHED – The file is published
▫ SUBSCRIBED – The file is subscribed
▫ EXCLUDED – The file is excluded from replication
▫ INACTIVE – The file is included in replication, but is currently disabled
▪ PRIMARY – Whether the file is considered the primary replication file.
▪ GROUP – The name of the replication group
Note: When using account-level file replication, a UniVerse distributed file (Type 27 file) and all its part files are loaded separately in a replication object table, where U2 Data Replication treats them all as separate files. The update on a distributed file is replicated through the part files. When an uvsh session updates a distributed file, or updates the distributed part file directly, the update is replicated with the part file’s name. This requires that the subscriber has the same definition of the distributed file as is on publisher system. Otherwise, data inconsistency may occur.
66
Replication files with multiple VOC pointers
Replication files with multiple VOC pointers
If a file has multiple definitions in the VOC file, in the same or different account, UniVerse loads each
VOC item name in different replication file entries. When a uvsh process updates a record in the file, the process searches for the primary replication file entry in the replication file table by the i-no/d-no, beginning from the static replication file entries. If there is no match, UniVerse searches the dynamic replication file entries. UniVerse uses the first match for replication, generating a replication log in the associated replication group, and sending the VOC file name to the subscriber for publication. This
VOC name is referred to as the primary replication file.
When you issue a
DELETE.FILE command that physically deletes the file, UniVerse disables all replication file entries with the same i-no/d-no. If you delete a VOC pointer that points to the file, or a symbolic link or physical link, UniVerse only disables the corresponding replication file entry. UniVerse does not disable other replication file entries pointing to the file. If you disable the primary replication file, UniVerse uses the next matched file as the primary replication file.
When you enable a replication file, UniVerse only enables the corresponding VOC file name and account ID, it does not automatically search and enable other VOC file names that point to the same file.
When you replicate a file-level command, UniVerse uses the corresponding replication file entry for the target file regardless if it is the primary replication file or a secondary replication file. UniVerse always replicates record-level commands through the primary replication file.
If you have multiple VOC file entries for a replication file, we recommend that you define only one VOC name in the included file list so UniVerse knows which file name and which replication group to use with replication.
Error messaging
When U2 Data Replication is disabled, detailed error messages are written to the rm.log file. The following example illustrates messages written to the log when a publishing process is terminated:
Wed Oct 5 10:53:17 RM: sigchld received: pid=393236, dsig=9
Replication daemon on group 0(393236) is killed(9)!
Wed Oct 5 10:54:06 RM: Force stop group acct_grp(0)
Wed Oct 5 10:54:06 RM: kill publistener 454762
RM trying to kill 454762 by sig 9
RM: kill 454762
Wed Oct 5 10:54:06 RM: kill Publisher 393236
RM trying to kill 393236 by sig 9
RM: kill 393236
Wed Oct 5 10:52:48 2011: Fatal error from process 393236: Group=0,
Rep Error=2560:Publisher killed; OS Error=0:Error 0
Replication start disabling replication!
RM: Force RFS group commit.
Replication is Disabled!
RM: Pause database activity.
CheckPoint time before ForceCP: Wed Oct 5 10:55:53 2011
.CheckPoint time after ForceCP: Wed Oct 5 10:58:55 2011
.CP has been forced successfully.
DBpause successful.
RM: Force RFS group commit.
Stopped Publishing Group acct_grp successfully.
RM: Disable Replication.
RM: Resume database activity.
DBresume successful.
67
Chapter 3: Administering U2 Data Replication
Execute Replication Exception Action program
/disk1/repacct/repeventtrig.sh
Publisher killed, RM disabled replication successfully.
Refreshing the subscriber database
Complete the following steps to copy the database files from the publishing system to the subscribing system.
1. Run the uv_repadmin suspend command on either the publishing system or the subscribing system. For information on running this command, see
2. On the publishing system, run the following command: uv_repadmin reset -noresume
This clears any pending logs on the publishing system.
3. On the publishing system, run the uv —admin —L command to pause the database. If you are sure there are no applications running on the publishing system, you may skip this step. For information about the uv —admin —L command, see the UniVerse Commands Reference.
4. Copy the files you are replicating from the publishing system to the subscribing system.
5. If you paused the publishing system, run the uv —admin —U command. For information about the uv —admin —U command., see the UniVerse Commands Reference.
6. If the subscribing system is down, start UniVerse with the uv —admin —start —init command. Otherwise, run the uv_repadmin reconfig command. For information about this command, see
.
7. Run the uv_repadmin sync on the either the publishing system or the subscribing system if
AUTORESUME is not enabled on the subscribing system. For information about this command,
see sync command, on page 74 . If AUTORESUME is enabled, U2 Data Replication will initialize
an automatic synchronization operation.
Disabling U2 Data Replication
In U2 Data Replication suspension mode, the publisher continues generating replication logs and reserves them for the next synchronization process. This feature can quickly synchronize the standby database without a lot of user intervention. However, if replication is suspended too long, either because of a subscriber system failure, or for subscriber system maintenance, the publishing system may accumulate enough replication logs to fail the replication log file system. In an extreme case, a full file system can crash the entire publisher system. For this reason, disablement of replication prior to filling the disk entirely may provide for a more graceful recovery.
Replication DISABLE mode
In replication
DISABLE mode, all replication functions stop, but the repmanager continues to run.
The following actions occur when U2 Data Replication is disabled:
▪ All replications are suspended.
▪ All publishing processes stop.
▪ The uv process stops generating replication logs.
▪ The repmanager daemon only accepts the ENABLE, RECONFIG, and STOP commands.
▪ The SYNC, SUSPEND, and RESET commands do not proceed until replication is enabled.
▪ The DISABLE mode persists after stopping and restarting UniVerse.
▪ Reconfiguring U2 Data Replication does not affect the DISABLE mode.
68
Replication ENABLE mode
If one of the following events occurs, U2 Data Replication automatically switches to the
DISABLE mode:
▪ The database administrator issues a DISABLE command.
▪ A fatal replication system error occurs. The error handling procedure sends a request to disable replication.
▪ UniVerse is started with uv -admin -start -disable.
When the replication manager receives a
DISABLE request, it performs the following tasks:
▪ Suspends all active replications.
▪ Sets the replication disable flag and saves it in the uvrepsys.log.
▪ Issues the uv -admin -L command.
▪ Exits the publishing processes.
▪ If the ClearLog option was specified, clears the replication log files for all replication groups.
▪ Issues the uv -admin -U command.
▪ If the disable request was issued in error handling, executes the exception action script, if defined, on the local system.
When the replication manager starts with the disable option, it loads the replication configuration, sets the replication disable flag and saves it in the uvrepsys.log, and continues running in
DISABLE mode.
Replication ENABLE mode
The replication
ENABLE mode is the normal running mode for U2 Data Replication. If U2 Data
Replication is disabled, it is enabled if the system administrator issues the
ENABLE command, or
UniVerse is started with the -init option.
When the replication manager receives an
ENABLE request, it performs the following tasks:
▪ Issues the uv -admin -L command.
▪ Clears the replication system disable flag and saves it in the uvrepsys.log file.
▪ Resets the log sequence number for all groups.
▪ Clears the replication log files.
▪ Starts the publishing processes for all publishing groups.
▪ Issues the uv -admin -U command.
▪ Issues the SYNC command to all replications if AUTORESUME is enabled.
Runtime error handling
With replication disablement, the runtime error handling of U2 Data Replication changes. If U2 Data
Replication incurs a fatal error, U2 Data Replication is disabled and continues running UniVerse in
DISABLE mode rather than crashing the publishing system.
The following system errors will result in the publishing system being disabled:
▪ When a uvudt or tm process encounters a log extension file (LEF) error when handling replication logs.
▪ When the publishing system cannot access the log reserve file (LRF).
69
Chapter 3: Administering U2 Data Replication
▪ When the publishing process is terminated.
▪ When the publishing process exits abnormally.
Applications continue to run in DISABLE mode.
We recommend that you write and deploy a U2 Data Replication exception action script. If U2 Data
Replication is disabled due to an unexpected event, the replication manager executes the script.
On a subscribing system, when a subscribing process or replication writer process encounters an LEF or LRF failure, U2 Data Replication is suspended.
Enabling or disabling U2 Data Replication
You can enable or disable U2 Data Replication using the following methods:
•
Enabling or disabling U2 Data Replication using uv_repadmin
Use the uv_repadmin command to enable or disable U2 Data Replication from the operating system level.
•
Enabling or disabling U2 Data Replication using uv -admin
You can use the uv -admin -start or uv -admin -stop commands to enable or disable all of UniVerse, including U2 Data Replication.
•
Enabling or disabling U2 Data Replication through XAdmin
Enable U2 Data Replication through XAdmin using the Replication pane.
Enabling or disabling U2 Data Replication using uv_repadmin
Use the uv_repadmin command to enable or disable U2 Data Replication from the operating system level.
▪ To disable U2 Data Replication, use the disable option: uv_repadmin disable [-clearlog] [-verbose]
The -clearlog option clears the replication log files. The -verbose option displays messages to the screen.
▪ To enable U2 Data Replication, use the enable option: uv_repadmin enable [-verbose]
The -verbose option displays messages to the screen.
You must be logged in as root to enable or disable U2 Data Replication.
Enabling or disabling U2 Data Replication
Enabling or disabling U2 Data Replication using uv -admin
You can use the uv -admin -start or uv -admin -stop commands to enable or disable all of
UniVerse, including U2 Data Replication.
For more information, see
Starting UniVerse daemons, on page 40 and Stopping UniVerse daemons, on page 40
.
Enabling or disabling U2 Data Replication
70
Enabling or disabling U2 Data Replication through XAdmin
Enabling or disabling U2 Data Replication through XAdmin
Enable U2 Data Replication through XAdmin using the Replication pane.
For more detailed steps about enabling or disabling U2 Data Replication through XAdmin, see
Managing U2 Data Replication through XAdmin, on page 43
.
1. To enable or disable U2 Data Replication through XAdmin, from the Admin Tasks view, click
Replication, then click the Replication Tool tab.
2. To enable U2 Data Replication, click the target for which you want to enable replication, then click
Enable.
3. To disable U2 Data Replication, click the target for which you want to disable replication, then click Disable.
You must be logged in as root to enable or disable U2 Data Replication.
Enabling or disabling U2 Data Replication
Exception action script
You can write and deploy and exception action script that U2 Data Replication executes when replication is suspended or disabled unexpectedly. You can register the script using the
EXCEPTION_ACTION phrase in the local system repsys file. If U2 Data Replication is suspended or disabled unexpectedly, U2 Data Replication executes the script and sets up environment variables to indicate the error.
The following table describes the environment variables returned by the replication manager:
Environment variable
UNIREP_GRPNAME
UNIREP_REMOTESYS
UNIREP_REPTYPE
UNIREP_ERRCODE
UNIREP_ERRSTRING
UNIREP_REPSTATUS
UNIREP_PID
UNIREP_OSERRNO
Description
The replication group that triggered replication disablement.
The local system name defined in the repsys file.
Empty.
The replication system error code that triggered replication disablement.
The error message pertaining to the error code.
The replication status. Valid values are
REP_SUSPENDED or
REP_DISABLED.
The process ID that triggered replication disablement. This value is empty if the status is
REP_SUSPENDED.
The operating-system error code that triggered the disablement.
This value is empty if the status is
REP_SUSPENDED.
Error messaging
When U2 Data Replication is disabled, detailed error messages are written to the rm.log file. The following example illustrates messages written to the log when a publishing process is terminated:
Wed Oct 5 10:53:17 RM: sigchld received: pid=393236, dsig=9
Replication daemon on group 0(393236) is killed(9)!
Wed Oct 5 10:54:06 RM: Force stop group acct_grp(0)
Wed Oct 5 10:54:06 RM: kill publistener 454762
RM trying to kill 454762 by sig 9
RM: kill 454762
71
Chapter 3: Administering U2 Data Replication
Wed Oct 5 10:54:06 RM: kill Publisher 393236
RM trying to kill 393236 by sig 9
RM: kill 393236
Wed Oct 5 10:52:48 2011: Fatal error from process 393236: Group=0,
Rep Error=2560:Publisher killed; OS Error=0:Error 0
Replication start disabling replication!
RM: Force RFS group commit.
Replication is Disabled!
RM: Pause database activity.
CheckPoint time before ForceCP: Wed Oct 5 10:55:53 2011
.CheckPoint time after ForceCP: Wed Oct 5 10:58:55 2011
.CP has been forced successfully.
DBpause successful.
RM: Force RFS group commit.
Stopped Publishing Group acct_grp successfully.
RM: Disable Replication.
RM: Resume database activity.
DBresume successful.
Execute Replication Exception Action program
/disk1/repacct/repeventtrig.sh
Publisher killed, RM disabled replication successfully.
uv_repadmin tool
The uv_repadmin tool is an interface between the database administrator and the replication manager daemon. This tool sends commands to the replication manager and receives feedback. Issue the uv_repadmin command from the operating system-level.
Syntax
uv_repadmin command [options] [targets]
The following table describes each parameter of the syntax.
Parameter
command options targets
Description
The command to send to the replication manager. Each command is documented later in this chapter.
The options you want to send with the command. One command can have multiple options, separated by a space. Details of each option are documented with the command later in this chapter.
See
uv_repadmin targets, on page 72
.
uv_repadmin targets
A target of the uv_repadmin tool is a replication, a replication group, or a distribution of a replication group. A replication is all data replicated from a remote system to the local system, or from a local system to a remote system. A target definition of ALL represents all replications on the system.
One uv_repadmin command can have multiple targets.
Syntax
Targets are separated by commas, and have the following syntax:
ALL | {replication | group} [,replication | group...]
72
suspend command
The following table describes each parameter of the targets syntax.
Parameter
replication group
Value
The replication to or from the system you specify.
PUBLISHING
system_name
SUBSCRIBING
system_name
The replication from the system you specify to the local system.
The replication from the local system to the system you specify.
system_name
Replication to and from the system you specify.
The group that is the target of the command.
GROUP group_name The name of the replication group.
DISTRIB
system_name
The distribution of the group you specify.
none All distributions of the group.
If the command you issue through the uv_repadmin tool is successful, uv_repadmin returns 0. If the command is not successful, uv_repadmin returns an error code.
You can specify the -verbose option with any uv_repadmin command you issue to provide more detailed information about the results or errors associated with the command.
suspend command
The suspend command suspends a live replication. In a suspended mode, UniVerse interrupts the connection between the publisher and the subscriber. The publishing system saves the replication log files to the replication logs rather than transferring them to the subscribing systems. The subscribing system and all replication writer processes stop after they finish updating existing logs in the replication buffer.
Syntax
suspend <targets>
If you specify targets as ALL, UniVerse suspends all replications on the system. If you specify a replication, UniVerse suspends the replication from or to the system you specify. If you specify target as a replication group, UniVerse suspends all distributions of the group you specify.
You typically use the suspend command before shutting down the publishing or subscribing system.
Note: After UniVerse starts, the replications to all systems are suspended.
You can choose to set the AUTORESUME phrase in the repsys file to automatically resume live replication. The suspend command has no effect with deferred replication.
Example
In the following example, the suspend command is issued on SystemA to suspend replication on
SystemB: uv_repadmin suspend SystemB
73
Chapter 3: Administering U2 Data Replication
sync command
The sync command synchronizes subscribing systems to their publishing systems. The publishing system establishes a connection to the subscribing system and invokes the subscribing process.
UniVerse reads and transfers replication logs from the publishing system to the subscribing system.
The subscribing system then applies the updates to the database.
Syntax
sync [-noresume | -wait | -force] target
If you specify targets as ALL, UniVerse synchronizes replications on all systems. If you specify targets as a replication system, UniVerse synchronizes replications from and/or to the replication system you specify. If you specify target as a group, UniVerse synchronizes all replications of the group you specify.
The speed of the synchronization process depends on how many pending logs UniVerse must synchronize, and the speed of the network connection. The sync command normally returns when all targets are in the synchronization mode.
By default, the sync command resumes a live replication. The following table describes the options available with the sync command.
Option
-noresume
-wait
-force
Description
UniVerse suspends a live replication when it finishes synchronizing the replication systems. When the first synchronization is complete, U2 Data
Replication does not look for more updates.
If you specify this option, the
SYNC command does not return until all synchronizations you specify succeed or fail.
The replication writer processes ignore the errors encountered during the synchronization process, if any. If you do not specify this option, the synchronization process fails if an error is encountered.
Note: After UniVerse starts, the replications to all systems are suspended. You can choose to set the AUTORESUME phrase in the repsys file to automatically resume live replication.
The sync command may fail if the network connection fails, or if the distribution of a replication conflicts between the publishing system and the subscribing system. UniVerse returns an error code to indicate the failure. You can use the report command to check the details of the error.
Note: If you issue the sync command when a live replication is running, the command has no effect.
When to issue the sync command
You should issue the sync command in the following circumstances:
▪ After UniVerse starts on the subscribing system if you do not set the AUTORESUME phrase in the repsys file.
▪ After you suspend live replication from or to a system and you want to resume replication.
74
failover command
▪ After failing over or reconfiguring a replication if you do not set the AUTORESUME phrase in the repsys file.
▪ After UniVerse starts on the publishing system while some of the subscribing systems are running and you do not set the AUTORESUME phrase in the repsys file.
Example
In the following example, UniVerse resumes replication from SystemA to SystemB: uv_repadmin sync -force SystemB
failover command
The failover command changes the replication direction on a local system, either from the local system to the publishing system or subscribing system, or changes the subscribing source distribution.
Syntax
failover [-verbose] [-pub {failover recover-to time} | -subto
system_name
| -back] {target …}
The following table describes the failover options.
Option
-verbose
-pub
failover recover-to time
-subto
-back
target
Description
Displays messages to the screen.
The failover command changes the replication to a publishing system on the local system. The local distribution of the replication must be a standby backup system.
Specified timestamp to which the failover process will recover.
Failover will apply its logs with the replication log generated before this timestamp, but abandon the logs generated after it. The format of this timestamp is:
mm:dd:HH:MM{:SS{:yyyy}}{GMT} mm
: Month
dd
: Day
HH
: Hour, using a 24-hour clock
MM
: Minute number
SS
: Second number. Default value is 00.
yyy4
: 4-digit year. Default is current year.
GMT
: GMT time zone if specified; otherwise, local time
If you specify the -subto option, UniVerse either changes a replication from a publishing system to a subscribing system, or changes the subscribing source to the system you specify with
system_name
.
UniVerse changes the replication back to the original configuration setting.
A replication, a replication group, or a distribution of a replication group.
75
Chapter 3: Administering U2 Data Replication
Example
Suppose that SystemA crashes, and you want to failover to SystemB. On System B, execute the following command: uv_repadmin failover -pub
On SystemC, change the subscribing source from SystemA to SystemB with the following command: uv_repadmin failover -subto SystemB
On SystemC, you should change the replication from a publishing system to a subscribing system on
SystemB using the following command: uv_repadmin failover -subto SystemB
If you want to revert to the original replication directions, execute the following command on SystemA and on SystemC: uv_repadmin failover -back SystemB
In this case, SystemB represents all replication groups replicating data from SystemB to a local system
(SystemA or SystemC).
On SystemB, you should execute the following command to change all groups currently publishing to
SystemA to their original distribution setting: uv_repadmin failover -back SystemA
Note: The failover command does not change the distribution definition in the repconfig file. Instead, it records the failover status in an internal group status file for all replication groups involved. Even after you stop and restart UniVerse, U2 Data Replication maintains this failover status. Issue another failover command, or issue the reconfig command to change the failover status.
After UniVerse starts, the replications to all systems are suspended. You can choose to set the
AUTORESUME phrase in the repsys file to automatically resume live replication.
reconfig command
The reconfig command reconfigures the replication configuration while UniVerse is running.
Syntax
reconfig
When you issue the reconfig command, the replication manager completes the following tasks:
▪ Issues the uv -admin -L command to block any writes to the database
▪ Stops all replications
▪ Reloads the repconfig file
▪ Reallocates system resources
▪ Restarts the publishing system for each publishing group
▪ Issues the uv -admin -U command to continue processing on the database
76
reset command
Note: After UniVerse resumes processing, the replications to all systems are suspended. You can choose to set the AUTORESUME phrase in the repsys file to automatically resume live replication.
Shared memory allocation
The uv_repadmin reconfig command can require twice the currently allocated size of shared memory for U2 Data Replication to be available on the system in order to complete the operation. The shared memory currently allocated by U2 Data Replication is maintained while new shared memory segments are allocated for the new configuration. If the new configuration requires more memory, then more than twice the currently allocated size might be needed.
The following formula can be used to provide an estimate on the size required for each replication group based on the N_LOGINFO and REP_BUFSZ parameters.
N_LOGINFO * 80 + REP_BUFSZ + 1280
The 1280 value is based on one subscriber and the default of four replication writer processes in a group. For different values, the formula is:
696 + (552 * number of subscribers) + (8 * number or replication writer processes).
This formula is valid for UniVerse 11.3.1 and may change at future releases.
If not enough shared memory on the system is available, the reconfig operation will fail and cause
U2 Data Replication to disable. If there are any questions on the amount of shared memory available, it is recommended to stop and restart UniVerse to implement U2 Data Replication configuration changes. The uvipcstat command can be used to determine the amount of shared memory being used by U2 Data Replication.
For example, the command uvipcsat -ma | grep uvrm will return information similar to the following example. The sum of the SEGSZ of the "shmbuf" and "ctl" segments will define the size of the shared memory currently being used. This can help determine whether a stop and restart is necessary.
# uvipcstat -ma | grep uvrm
IPC status from /dev/mem as of Tue Sep 13 15:37:51 MST 2016
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH
SEGSZ CPID LPID ATIME DTIME CTIM m 29364202 0xffffffff --rw-rw-rw- root system root system 44 55
5203904 8257702 13893796 13:23:01 15:35:21 12:15:38 -> uvrm R11.3 (shmbuf) m 481300499 0xffffffff --rw-rw-rw- root system root system 44 99
8752848 8257702 13893796 15:34:48 15:35:21 12:15:38 -> uvrm R11.3 (ctl)
The amount of memory available can be determined using operating system tools, for example, svmon -G on AIX and /proc/meminfo on Linux.
reset command
The reset command clears saved replication logs in the replication log reserve file.
Syntax
reset [-noresume] target
Use the reset command after you copy or store database files, since the remaining replication logs are no longer useful.
77
Chapter 3: Administering U2 Data Replication
Use the reset command with a deferred replication, or a live replication in suspension mode. If the
target
you specify is running, the reset command has no effect.
Unless you specify the noresume option, a live replication returns to running mode from suspension mode when the reset command finishes processing.
report command
The report command reports the current status of a replication you specify. This command is useful after a failure or failover occurs.
Syntax
report [-detail | -xml] target
Each line of the report represents the status of a replication. Each line has the following format:
[PUBLISHING | SUBSCRIBING] system_name=Status[:Reason]
The system_name is the name you specify in the repsys file.
Status is the current status of the replication. The following table describes valid statuses.
Status
RUNNING
SUSPEND
SUSPENDING
SYNCING
RECONFIGURING
SHUTDOWN
STOPPED
EXIT
Description
The replication is running.
The replication is in suspension mode.
The replication is in the process of suspending processing.
The replication is synchronizing data.
The replication is in the process of reconfiguring.
The replication is shutting down.
The replication has stopped normally.
The replication has exited abnormally.
If the replication status is SUSPEND, the report command also displays the reason that the replication is in suspension mode. The following table describes valid SUSPEND reasons.
Reason
STARTUP
DBA_ORDERED
REMOTE_REQUEST
SYS_RECONFIG
REMOTE_SYS_DOWN
RPC_FAILURE
RPC_TIMEOUT
SUBSCRIBER_FAILURE
TRANSACTION_ABORT
FATAL_ERROR
Description
The local system is just starting or restarting.
The administrator suspended replication.
A remote system requested that replication be suspended.
The system is in suspension mode after a reconfiguration.
The remote system has shut down.
The connection is lost and cannot be reestablished.
The sending or receiving process has timed out.
The subscriber failed to write a replication log. The detailed error message appears in the rm.errlog.
A transaction aborted on the subscribing system. The detailed error message appears in the rm.errlog.
A internal or fatal error occurred from which the system is unable to recover.
78
report command
If the replication status is EXIT, UniVerse also displays the reason for the publishing system exit. The following table describes the valid reasons.
Reason
HAS_FAILOVER
DISTRIBUTION_MISMATCH
FATAL_ERROR
Description
The subscribing system failed over to the publishing system.
A mismatch exists between the distribution on the publishing system and the subscribing system.
An internal or fatal error occurred from which the system is unable to recover.
If you specify the -detail option, UniVerse reports the status of all replication groups after the replication status lines. The syntax of the replication group status is:
group_name
=status:reason where group_name is the replication group name defined in the repconfig file. The status and
reason
are the same as those for the replication status.
The -xml option reports detailed replication status information in XML format, regardless of whether you specify -detail.
The following example illustrates a replication status report in XML format:
<? Xml version="1.0"?>
<REP_REPORT LOCAL_SYSTEM="Trigger_71" DATE="Thu Oct 5 16:02:46 2006">
<REPLICATION REMOTE_SYSTEM = "Juneau_71"REPTYPE = "STANDBY IMMEDIATE
PUBLISHING" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" >
<GROUP NAME = "reptest1" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" />
<GROUP NAME = "reptest2" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" />
<GROUP NAME = "reptest3" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" />
</REPLICATION>
<REPLICATION REMOTE_SYSTEM = "Pinto_71" REPTYPE = "FAILOVER IMMEDIATE
PUBLISHING" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" >
<GROUP NAME = "reptest1" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" />
<GROUP NAME = "reptest2" STATUS = "REP_RUNNING" REASON = "Sync Succeeded" />
</REPLICATION>
</REP_REPORT>
The following example shows the DTD for the XML report shown above:
<!-REP_REPORT.DTD -->
<! ELEMENT REP_REPORT (REPLICATION*)>
<! ATTLIST REP_REPORT
LOCAL_SYSTEM CDATE #REQUIRED
DATE CDATE #REQUIRED>
<! ELEMENT REPLICATION (GROUP*)>
<! ATTLIST REPLICATION
REMOTE_SYSTEM CDATE #REQUIRED
REPTYPE CDATA #REQUIRED
STATUS CDATA #IMPLIED
REASON CDATA # IMPLIED >
<! ELEMENT GROUP EMPTY>
<! ATTLIST GROUP
NAME CDATA #REQUIRED
STATUS CDATA #IMPLIED
REASON CDATA #IMPLIED>
79
Chapter 3: Administering U2 Data Replication
Replication status return codes
The following table describes the replication status return codes that are returned by uv_repadmin report command.
Status code Description
13
14
16
21
22
23
24
25
27
28
29
30
5
7
11
12
1
2
3
4
Publishing group is stopped normally
Publishing group has terminated abnormally
Publishing group is shutting down
Publishing group is running
Publishing group is performing a reconfiguration
Publishing group is performing a failover
Publishing replication is running
Publishing replication is in suspension mode
Publishing replication is in synchronization mode
Publishing replication is suspending
Publishing replication has exited
Subscribing replication group is stopped normally
Subscribing replication has terminated abnormally
Subscribing replication is shutting down
Subscribing replication is running
Subscribing replication is performing a reconfiguration
Subscribing replication is suspending
Subscribing replication is in synchronization mode
Subscribing replication is performing a failover
Subscribing replication is resynchronizing
80
Chapter 4: How U2 Data Replication works
UniVerse provides the following two types of live replication:
▪ Real-time replication is a type of U2 Data Replication where transactions on the publishing server do not commit until all logs of the transaction arrive at the subscriber. With this type of replication, should the publishing system failover to the real-time subscribing system, all committed transactions at the publishing system are guaranteed to apply to the standby system.
▪ Immediate replication is a type of U2 Data Replication where UniVerse sends a transaction log to the subscribing system immediately after it is ready to commit. The publishing system does not wait for the log to arrive on the subscriber before committing the transaction. Should the publishing server failover to the immediate subscribing system, there is a slight chance that some committed transactions on the publisher did not arrive on the failover system. Administrator intervention may be necessary to recover the system.
Note: Immediate replication has better performance than real-time replication.
For both types of live replication, the publishing system maintains network connections to its subscribers while it is running. UniVerse sends data updates on the publishing object to its subscribers through this connection immediately.
Data propagation procedure
The following steps describe the data propagation procedure for live replication.
1. Before UniVerse commits and updates, the uvsh process generates a replication log for the update and writes it to the replication buffer.
2. In real-time replication, the uvsh process waits for the response from the publisher process.
3. The publisher process reads the logs from the replication buffer and sends a package, through the network, to all subscribers.
4. When a subscriber receives a package, the subscriber process converts the data record, if necessary, and copies the logs to the replication buffer. It then sends a sub-got notification message to the publisher.
5. In real-time replication, the publisher process wakes up the waiting uvsh process after receiving the sub-got notification message.
6. The uvsh process commits the update to the database.
7. If pacing is enabled, the publisher calculates the pacing weights and, if necessary, sleeps to prevent disablement of replication.
8. The uvsh process writes a pub-commit notification to the replication buffer.
9. The publisher process sends the pub-commit notification to the subscribers in the next data package.
10. When the subscriber receives a pub-commit notification, it marks the pub-commit flag in the log in the replication buffer and wakes up the replication writer processes waiting for the log.
11. A replication writer process reads the log from the replication buffers once, and applies a logical lock for the record it is about to update. It then checks the pub-commit flag on the log and waits for the flag to be set by the subscriber. For the log of an update involved in a transaction, the replication writer process also has to wait for the arrival of the transaction-end log.
12. Next, the replication writer process updates the subscribing objects according to the contents of the replication log.
13. The replication writer process then updates the sub-commit flag in the log to indicate that the log has been committed on the subscribing system, and releases the logical lock for the record.
81
Chapter 4: How U2 Data Replication works
14. The subscriber sends back a sub-commit notification to the publishing system confirming that the update has been committed on the subscribing system.
15. When the publishing process receives the sub-commit notification message, it removes the logs from the replication buffer.
Suspending live replication
System administrators can suspend live replication when subscribing systems shut down, crash, network failures occur, or for their own reason.
Note: If you suspend live replication with pacing enabled, your system will be impacted.
You can suspend replication by issuing the suspend command. For more information, see the
.
Example
To suspend a replication, the publishing system saves all replication logs without sub-commit notification to the replication log reserve file. If the subscriber did not crash, it saves all logs without pub-commit notification to the replication log reserve file. UniVerse then disrupts the connection between the publisher and the subscriber, and the subscriber process stops running.
When you suspend a replication, the publishing system runs in suspension mode. The uvsh process can read from or write to the database as usual. Instead of sending replication logs to the subscriber, the publisher saves them in the replication log reserve file.
The following section describes how U2 Data Replication behaves in suspension mode:
1. Before committing an update, the uvsh process generates replication logs for the update, and writes them to the replication buffer.
2. For real-time replication, the uvsh process waits for the response from the publisher process.
3. The publisher process reads the logs from the replication buffer and saves them to the replication log reserve file.
4. For real-time replication, the publisher process wakes up the waiting uvsh process.
5. The uvsh process commits the update to the database.
6. The uvsh process writes the pub-commit notification to the replication buffer.
7. The publisher process removes the logs from the replication buffer.
Data synchronization of suspended live replication
You must synchronize suspended replication to resume replication to the running mode.
To synchronize the replication, use the sync command on the publishing or subscribing system. For more information, see the
.
How synchronization works
UniVerse completes the following steps when synchronizing suspended replication:
1. The publishing system establishes a connection to the subscribing system and invokes the subscriber process.
2. The subscriber process creates the replication writer processes to read the logs from the replication buffer. The subscriber then begins listening for a data package.
82
Deferred replication
3. The publishing system creates the publisher listener process to listen to the return package from the subscriber process.
4. The publishing system creates the publisher-syncing tool process.
5. The publisher-syncing tool process reads the logs from the replication log reserve file and sends them to the subscriber.
6. When a package of replication log files arrive at the subscriber, the subscriber process converts the data record, if necessary, and copies the logs to the replication buffer. It then sends a sub-got notification message to the publisher.
7. A replication writer process reads the log from the replication buffers once, and applies a logical lock for the record it is about to update. For the log of an update involved in a transaction, the replication writer process also has to wait for the arrival of the transaction-end log.
8. The replication writer process updates the database according to the contents of the replication log, and marks the sub-commit flag of the log to indicate the log has been committed on the subscribing system. It then releases the logical lock for the record.
9. The subscriber process sends back the sub-commit notification message to the publishing system.
10. For every notification package received, the publisher listener process marks the sub-got and sub-commit flags of the logs.
11. When the publisher-syncing tool finishes sending all of the logs in the replication log reserve file, it terminates.
12. After the publisher-syncing tool terminates, the publisher process checks to see if any new replication logs were generated during the synchronization process. If new replication logs exist, it begins at step 4 and repeats the synchronization process.
13. The publishing system now resumes replication in running mode.
Deferred replication
In deferred replication, the publishing system does not keep connections to the subscribers active. UniVerse saves the data in the replication log reserve file instead of sending the data to the subscribers. Data synchronization is the only means of data propagation.
Deferred replication has two types:
▪ Periodic replication has a predefined period of time when the replication system will automatically synchronize its data.
▪ Manual-sync replication does not have a predefined synchronization period. Data propagation is achieved by the sync command.
Deferred replication is similar to the suspension mode of immediate replication. Following are the steps for data synchronization with deferred replication:
1. The publishing system establishes a connection to the subscribing system and invokes the subscriber process.
2. The subscriber process creates the replication writer processes to read the logs from the replication buffer. The subscriber then begins listening for a data package.
3. The publishing system creates the publisher listener process to listen to the return package from the subscriber process.
4. The publishing system creates the publisher-syncing tool process.
5. The publisher-syncing tool process reads the logs from the replication log reserve file and sends them to the subscriber.
6. When a package of replication log files arrive at the subscriber, the subscriber process converts the data record, if necessary, and copies the logs to the replication buffer. It then sends a sub-got notification message to the publisher.
83
Chapter 4: How U2 Data Replication works
7. A replication writer process reads the log from the replication buffers once, and applies a logical lock for the record it is about to update. For the log of an update involved in a transaction, the replication writer process also has to wait for the arrival of the transaction-end log.
8. The replication writer process updates the database according to the contents of the replication log, and marks the sub-commit flag of the log to indicate the log has been committed on the subscribing system. It then releases the logical lock for the record.
9. The subscriber process sends back the sub-commit notification message to the publishing system.
10. For every notification package received, the publisher listener process marks the sub-got and sub-commit flags of the logs.
11. When the publisher-syncing tool finishes sending all of the logs in the replication log reserve file, it terminates. Any replication logs created after the sync process was initiated will be deferred until the next scheduled sync operation.
12. The publishing system disconnects from the subscriber and returns replication to suspension mode.
Transaction handling
The following section describes how U2 Data Replication handles transaction processing:
1. At the beginning of the commit phase of a transaction, the uvsh process generates all replication logs for the updates of a replication object in the transaction. This process also generates a transaction-begin and transaction-end log for each of the transactions involved in the replication group. A transaction-begin log contains the transaction ID, the number of replication groups involved in the transaction, and the number of updates within the replication group.
2. For each of the replication groups, the uvsh process writes the transaction-begin log, the replication logs of all updates in the replication group, and the transaction-end log to the replication buffer of the replication group. If you are using real-time replication, the uvsh process waits for the transaction-end log to ensure all logs of the transaction arrive at the subscribing system.
3. The publishing process sends the logs to the subscriber. In the case of deferred replication,
UniVerse writes the logs to the replication log reserve file. When the publisher receives the subgot notification message from the subscriber, it wakes up the uvsh process that is waiting.
4. The uvsh process commits the transaction to the database.
5. The publishing process sends the pub-commit notification to the subscriber process.
6. When the subscriber process receives a transaction-begin log, it copies the log to the replication buffer. If the transaction is part of a cross-group transaction, it checks the transaction control area for the transaction control record for this transaction. If the transaction control record does not exist, it creates a new transaction control record and adds it to the transaction control area.
7. When the subscriber process receives the data update logs of a transaction, it copies the logs to the replication buffer.
8. When the subscriber process receives a transaction-end log, it sets the sub-got flag in the transaction-begin log. If the transaction is part of a cross-group transaction, it increases the number of sub-got groups in the transaction control record. If the number of sub-got groups is equal to the number of groups involved in the transaction, it then sets the sub-got flag in the transaction control record and wakes all replication writer processes waiting for the transaction control record, then sends a sub-got notification message to the publishing system.
9. The replication writer process reads one data update log from the replication buffer, applies a logical lock on the record it is about to update, then waits for the arrival of all of the replication logs involved in the transaction. It also waits for the pub-commit notification message from the publishing system.
10. The replication writer process updates the database according to the contents of the log files.
84
Indexed virtual attributes
11. The replication writer process sets the sub-commit flag in the log, and increases the number of sub-commit logs in the transaction-begin log. If the number of sub-commit logs equals the number of logs in the group for the transaction, it increases the number of sub-commit groups involved in the transaction. If the number of sub-commit groups equals the number of groups in the transaction, it sets the sub-commit flag in the transaction control record to indicate the transaction has been committed on the subscribing system.
12. The subscriber process sends back a sub-commit notification message to the publishing system, and removes the transaction control record from the transaction control area.
13. The publishing system removes all logs related to the transaction from the replication buffer.
Indexed virtual attributes
U2 Data Replication propagates the indexed virtual attribute values, as well as the record. The following two methods are available to propagate virtual attribute values:
▪ Use the values evaluated on the publishing system. If the index is enabled, the uvsh process evaluates all indexed virtual attribute values before updating the record in the database. These values are also passed as a record to the subscribing systems. The replication writer process then writes the values directly to the index file. This method requires that the subscribing system have the same dictionary and index definition as the publishing system. It also requires that the indexes of the publishing system and the subscribing system be consistent. If one is enabled, the other must also be enabled.
▪ Reevaluate indexed virtual attributes on the subscribing system. This is the default setting. Before the replication writer process applies the replication log to the database, it evaluates all indexed virtual attribute values and saves them in the index file, if the index is enabled. If the index is disabled, it saves the record to the index log file, then the
UPDATE.INDEX command evaluates the values.
File triggers
If you set the value of RW_SKIP_TRIGGER to 1, if a subscribing object has triggers defined, the replication writer process will not execute the trigger when applying the replication log. Your database administrator can configure the replication group to execute the trigger by setting the value of
RW_SKIP_TRIGGER to 0 in the repconfig file. The default value is 0.
Partition algorithm check
By default, when a replication writer applies the replication log to a distributed part file, it rechecks the partition algorithm. Your database administrator can configure the replication group to skip this check by setting the value of RW_VERIFY_PARTITION to 0 in the repconfig file.
File-level operations
UniVerse supports the following file-level operations:
▪ DIR file operations:
▫ ED and UV.VI
▫ COPY
▫ CLEAR.FILE
85
Chapter 4: How U2 Data Replication works
▪ File-level commands
▫ CREATE.FILE
▫ DELETE.FILE
▫ CLEAR.FILE
▫ CNAME
▫ SETFILE
▪ Other commands:
▫ BASIC
▫ CATALOG
▫ DECATALOG
▫ DELETE.CATALOG
▫ DELETE.LIST
▫ COPY.LIST
▫ SAVE.STACK
▫ CREATE.ENCRYPTION.KEY
▫ CREATE.ENCRYPTION.WALLET
▫ GRANT.ENCRYPTION.KEY
▫ REVOKE.ENCRYPTION.KEY
▫ DELETE.ENCRYPTION.KEY
▫ DELETE.ENCRYPTION.WALLET
▫ WALLET.ADD.KEY
▫ WALLET.REMOVE.KEY
▫ SAVE.EDMAP
UniVerse does not support the following commands for replication at this release:
▪ BUILD.INDEX
▪ CONFIGURE.FILE
▪ CREATE.INDEX
▪ CREATE.TRIGGER
▪ DECRYPT.FILE
▪ DECRYPT.INDEX
▪ DEFINE.DF
▪ DELETE.INDEX
▪ DELETE.TRIGGER
▪ DF.MODIFY
▪ DISABLE.INDEX
▪ EDA.CONVERT
▪ ENABLE.INDEX
▪ ENCRYPT.FILE
▪ ENCRYPT.INDEX
▪ REBUILD.DF
86
File-level operations
▪ RECOVER.FILE
▪ RESIZE
▪ SET.INDEX
▪ UPDATE.INDEX
▪ UVFIXFILE
Note: If you run the
CREATE.INDEX, BUILD.INDEX, SET.INDEX, or DELETE.INDEX
commands against a published file, UniVerse writes a message to the rm.log file indicating the command that was run, the account where it was run, and the file it was run against.
▪ SQL commands
▫ ALTER TABLE
▫ CREATE INDEX
▫ CREATE SCHEMA
▫ CREATE TRIGGER
▫ CREATE VIEW
▫ DROP INDEX
▫ DROP SCHEMA
▫ DROP TRIGGER
▫ DROP VIEW
▫ CONVERT.SQL
▫ REVOKE
▫ SET.SQL
▪ Account environment commands
▫ SAVE.LIST
▫ PREPARE.XML
▫ INITIALIZE.CATALOG or init.catalog
▫ CLEAN.ACCOUNT
▫ CONVERT.VOC
▫ D3RESTORE
▫ DATE.FORMAT
▫ MAKE.MAP.FILE
▫ PASSWD
▫ SET.CONVERT.TERM.EURO
▫ SET.SYSTEM.EURO
▫ SET.REMOTE.ID
▫ SET.TELNET
▫ UPDATE.ACCOUNT
▫ XMLSETOPTIONS
87
Chapter 4: How U2 Data Replication works
Note: The commands UniVerse does not support for replication can be executed on the subscribing system; they are not blocked.
File-level commands
To replicate file-level commands, you must publish the target file. If the excluded file list contains that file, or if the file is disabled, UniVerse does not replicate the file-level command.
If a file-level command creates a new file, and UniVerse successfully enables the file for publication,
UniVerse replicates the command to the subscriber.
If a file-level command automatically updates a VOC or dictionary file. UniVerse replicates these updates, whether or not the VOC or dictionary file is published. These updates are also performed on the subscribing system when re-executing the command.
CREATE.FILE
When you execute the
CREATE.FILE command, UniVerse enables the file for replication. If UniVerse successfully enables the file as a publishing file, it sends the command itself to the subscribing system for replication. When the subscribing system receives the CREATE.FILE log, the replication writer process applies an exclusive lock to the VOC entry for the file and re-executes the command.
After the replication writer process creates the file on the subscribing system, it enables the file for subscription. Updates on the file will also be replicated.
DELETE.FILE
When you execute the
DELETE.FILE command, UniVerse checks if the file is published. If so,
UniVerse sends the command to the subscribing system for replication.
The
DELETE.FILE command automatically disables the publication and subscription of the file.
CNAME
The
CNAME command changes both the physical name and VOC entry name for both the data file and its dictionary. The old file name must be an enabled publishing file or the
CNAME command will not replicate on the subscribing system.
If you enable the new file as a replication file in a different replication group than the old file, UniVerse replicates the
CNAME command in the group of the original file and does not synchronize it with other operations on the new file.
SETFILE
The
SETFILE command creates a new VOC pointer, and also loads that pointer into the replication file table. If you delete the old VOC pointer using the
DELETE.FILE command, the file may still replicate with the new VOC pointer. UniVerse replicates
SETFILE as a file-level operation, so the new
88
Miscellaneous pointer on the subscribing system is also loaded into the replication file table. UniVerse only replicates the Q-pointer itself.
Miscellaneous
If replication is between a UNIX platform and a Windows platform, UniVerse does not convert slashes contained in the path.
The replication of file-level operations may result in creation of a new operating-system level file on the subscribing system. UniVerse determines the owner of the file based on the following rules:
▪ If the replication writer process is impersonated by the RW_UID clause in the repconfig file, the owner of the new file is RW_UID.
▪ If there is no RW_UID clause in the repconfig file, UniVerse carries the user login name from the publishing to the subscriber. UniVerse uses this login name as the owner of the new file if the login name exists on the subscribing system.
▪ If there is no RW_UID clause in the repconfig file or the user login name does not exist on the subscribing system, UniVerse uses root for the owner of the file.
89
Chapter 5: Failover and recovery
U2 Data Replication includes failover capabilities. Failover is a mechanism to convert a secondary standby subscribing system into a publishing system should the primary publishing system crash, supporting high availability of the database.
You can configure a subscribing system of a live replication as a standby system. Should the primary publishing system crash, your database administrator can choose to failover immediately to one of the standby systems. This system then becomes a publishing system after the failover. Other subscribing systems must then subscribe from this system.
When the primary system restarts, the system should become a subscriber from the new publishing system.
Failover of real-time replication guarantees that all committed updates on the primary system commit on the standby system as well. For immediate replication, there is a chance that some updates committed on the primary system, but their logs may not have arrived on the standby system. You may need to refresh the database to keep the two databases consistent.
Failing over a system
A database administrator can failover a system using the failover command. This command converts a subscribing system to a publishing system, or a publishing system to a subscribing system.
Note: You can execute the failover command from XAdmin, or from the command line. For information about executing the suspend command from XAdmin, see
failover command, on page 75 .
Syntax
failover{-pub | -subto <system_name>| -back} <targets>
The following table describes the failover options.
Option
-pub
-subto
Description
The failover command changes the replication to a publishing system on the local system. The local distribution of the replication must be a standby backup system.
If you specify the -subto option, UniVerse either changes a replication from a publishing system to a subscribing system, or changes the subscribing source to the system you specify with system_name.
UniVerse changes the replication back to the original configuration setting.
-back
If the failover process itself fails, it has to wait for the primary publishing system to recover before it can resume database functions. It may have to copy database files to the failed standby subscribing system to make its database consistent and synchronized.
Step-by-step instructions for hard failover in case of primary system crash
Complete the following steps to failover a system:
90
Step-by-step instructions for soft failover
1. When the primary publishing system crashes, UniVerse disrupts the connection between the publishing system and the subscribing system. The application running the publishing system stops, and the remote client application is disrupted.
2. Log on to the standby system as an administrator and issue the failover –pub command to fail over the current replication to become a publisher.
3. Client applications should log on to the standby system and start the server applications.
4. If there are other subscriber systems defined in the replication environment, log on to each of the systems as an administrator and issue the failover –subto standby_system command to change them to subscribe from the standby system.
5. If
AUTORESUME is not set, issue the failover sync command.
6. For real-time replication, recover the primary system with transaction logging or with file diagnostic and repair tools. Issue the failover –subto standby_system command to convert the system to a failed over subscriber.
7. For immediate replication, refresh the database following the steps in database refreshing.
Step-by-step instructions for soft failover
Complete the following steps for a soft failover:
1. Stop all applications running on the primary publishing system.
2. Monitor the standby system using the U2 Extensible Administration Tool to make sure it is in sync with the primary system.
3. Log on to the standby system as an administrator and issues the failover –pub command to convert it to a fail over publishing system.
4. Client applications should log on to the standby system and start the server applications.
5. Log on to the primary system as an administrator and issue the failover –subto
standby_system command to convert it to a failover subscriber system.
6. If there are other subscriber systems defined in the replication environment, log on to each system as an administrator and issue the failover –subto standby_system that changes them to subscribing systems from the standby system.
Step-by-step instructions for failback
Complete the following steps for a failback system:
1. Stop all applications running on the standby system.
2. Monitor the standby system using U2 Extensible Administration Tool to make sure it is in sync with the standby system.
3. Log on to the primary system as an administrator and issue the failover –back command to convert the system back to a publishing system.
4. Client applications should log on to the primary system and start the server applications.
5. Log on to the standby system as an administrator and issue the failover –back command to convert it back to a subscribing system.
6. If there are other subscribing systems defined in the replication environment, log on to each system as an administrator and issue the failover –back command that changes them to a subscribing system from the primary system.
91
Chapter 5: Failover and recovery
Data recovery
Run UniVerse warmstart or file diagnostic and repair tools to recover the physical structure of the database. Failover to a real-time standby system can guarantee all committed transactions contain their full updates, and thus the consistency of the database. If failing over to an immediate replication system, you must refresh the database to synchronize the crashed database.
When you restart UniVerse, a publishing group always restarts as a publishing group, even if a failover occurred on the standby system. In this case, the database administrator must manually failover the replication group to a subscribing group using the failover command after UniVerse restarts.
Recovery of a subscribing system
Recovery of a subscribing system is the same as normal recovery of a UniVerse system. The database administrator must manually start the system and run UniVerse’s warmstart or file diagnostic and repair tools to recover the physical structure of the database.
Resynchronization after recovery from subscribing system or network failure
If a subscribing system crashes or a network failure occurs, the publishing system saves replication logs that do not contain sub-commit notification logs to the replication log reserve file. After recovery from this type of failure, the resynchronization process need only apply those saved logs to the subscribing system to make the subscribing database consistent with the publishing database.
The resynchronization process is same described in
Installing and configuring U2 Data Replication for
Database refreshing
Complete the following steps to refresh the database.
1. Stop the subscribing system or failed over subscribing system.
2. Log on to the publishing system and issue the reset –noresume command to remove the pending log files.
3. Back up the published files using the uvbackup command.
4. Restore the files to the subscribing system.
5. Start the subscribing system. In case of crash recovery of the primary system, issue the failover –subto standby_system command to convert it to a subscribing system.
6. If
AUTORESUME is not set, issue the sync command.
92
Chapter 6: Restrictions
The chapter describes restrictions when using U2 Data Replication.
File types
A U2 Data Replication object can be any UniVerse database file, including a static hashed file, a dynamic hashed file, a multilevel file, a type 1 file, or a type 19 file. U2 Data Replication does not support a sequential file and other operating system-level files. You cannot publish a type 25 or EDA file, but you can subscribe them.
Changing inode or device numbers
U2 Data Replication uses the inode and device number to identify a replication object. The inode and device numbers of the replication objects are loaded when UniVerse starts, and when you execute the
RECONFIG command. If you need to change the inode or device number for a file while UniVerse is running, you must execute the
RECONFIG command to update the replication object.
Note: The UniVerse
RESIZE TCL command may change the inode or device number, but this command reloads the inode and device number when it finishes executing. Therefore, you do not have to execute the
RECONFIG command after resizing a file.
One replication object can only belong to one group
Replication objects are sets of objects in replication groups. One replication object can belong to only one replication group. If there are multiple VOC pointers referencing a single UniVerse file, they should be defined only once in one replication group.
If you define one replication object more than once in different groups, only one of them will be used.
System files not supported as replication objects
U2 Data Replication does not support account-level operations on the following files:
▪ &XML&
▪ &EDAMAP&
▪ &EDAXMAP&
▪ MENU.FILE
No cascading replication
You cannot use a subscribing object as a publishing object of another replication.
93
Chapter 6: Restrictions
Writeable subscriber files
You can update a file on the subscribing system if you explicitly define it as writeable in the repconfig file. Updates made to a writeable file on the subscribing system are not replicated back to the publishing system.
You can update both record-level and file-level operations on a writeable subscriber file. If a file-level operation updates the VOC or dictionary file, you must specify these files as writable in the repconfig file.
Other command replication
UniVerse replicates the
BASIC command, the CATALOG command, the DECATALAG commandand the
DELETE.CATALOG command through the account-level group. If you do not define an accountlevel group, UniVerse does not replicate these commands, even if the target file is defined as a replicated file. If you define an account-level group. UniVerse replicates these commands, even if the target file is not defined as a replicated file.
Virtual field definitions
U2 Data Replication supports replication of indexed virtual field values. If you do not want to reevaluate virtual field values on the subscribing system, the subscribing object must have the same virtual field definition as on the publishing object.
Sequence of updates
UniVerse ensures the sequence of updates for the same record on a publishing object as on the subscribing object. However, on a subscribing system, the sequence of updates for different records may not be the same as on the publishing system.
U2 Data Replication only keeps the operation sequence within the same replication group. If you replicate an account-level and a file-level operation that updates a file in different replication groups, we do not guarantee that updates will be processed in the same sequence. To keep subscribing and publishing files consistent, you should define all related files in the same replication group.
Transaction limitations
▪ One transaction can update data in files that belong to more than one replication group.
However, those replication groups involved in one transaction should have the same subscribing distributions so the transaction is fully replicated to all of the distributions. The replication groups involved should also have the same replication type, either all real-time, all immediate, or all deferred.
▪ System administrators can define or reconfigure U2 Data Replication while UniVerse is running.
The new configuration is only applies to transactions after the
RECONFIG command is executed.
UniVerse writes logs to the Replication Log Reserve File for those transactions that have been committed on the publisher, but not replicated on the subscriber. UniVerse generates this replication logs using the previous configuration. The data synchronization process transfers these logs to the subscriber using the new configuration information. This may cause a different processing result.
For example, if the new configuration definition removes a replication object from a replication group, the saved logs for the removed object, if any, are still sent to the subscriber as part of data
94
System crashes during failover synchronization. If you configure the subscriber to remove the replication object as well, the
Replication Writer process will either ignore the log if you set the RW_IGNORE_ERROR, or suspend the replication.
Make sure all data involved in a transaction is transferred before making changes to a replication group definition.
▪ Although transaction consistency will eventually occur on the subscribing system, an application running on the subscribing system may read partial changes of a transaction on the publisher.
System crashes during failover
The data on the subscribing system may not be synchronized with the publishing system. You may have to recopy the data from the publishing objects to ensure synchronization.
Dictionary and data portions of a file
If you replicate both the data and dictionary portions of a file, they must belong to the same replication group.
Multiple locks
U2 Data Replication may apply multiple locks on the subscribing system. If your application is running on the subscribing system and you need to apply the same lock, you should follow the same locking sequence to avoid a deadlock.
Other limitations
▪ Maximum replication systems defined on a system: 32,767
▪ Maximum replication groups defined on a system: 32,767
▪ Maximum distributions defined in a group: 32,767
▪ Maximum replication objects defined on a system: 2,147,483,647
▪ Maximum replication accounts defined on a system: 32,767
▪ Maximum replication group name length: 127
▪ Maximum replication system name length: 127
95
Appendix A: Shared memory configuration error messages
The error messages covered in this section are the messages that you might encounter in UniVerse if the configuration parameters in UniVerse and UNIX are not high enough for your user load or memory requirements.
"No more LCTs"
Each UniVerse process needs one LCT slot. The number of LCTs available is defined by the UniVerse configurable NUSERS.
If the available LCTs are exceeded, when a UniVerse process attempts to start, it will encounter a message similar to:
‘No more LCTs Process XXXX Exit at ...’
The message appears in the uvsmm.errlog file starting at version 11.1.9 in Windows and version
11.2.0 on UNIX.
To resolve the issue, consider increasing the UniVerse configuration parameter NUSERS and also verify that semmnu in the UNIX kernel is large enough to accommodate the change.
"No more GCTs"
If the available GCTs are exceeded, a UniVerse process will encounter a message similar to:-
‘No more GCTs Process XXXX Exit at …’
The message will also be logged to the uvsmm.errlog file.
This messages means that you have already used as many segments as your system currently supports. To resolve the issue, consider increasing shmmni in the UNIX kernel or increasing the
UniVerse configuration parameter SHM_GNTBLS.
"uvsmm can’t get the first GSM errno = 22"
uvsmm cannot acquire the first shared memory segment to build the necessary control tables because shmmax is not large enough. Increase the kernel parameter shmmax.
The message will also be logged to the uvsmm.errlog file.
"No more shared memory IDs"
You are out of shared memory IDs. Adjust the UNIX kernel parameter shmmni to increase the limit.
The message will also be logged to the uvsmm.errlog file.
96
Uncommon error messages
Uncommon error messages
The following error messages might occur in UniVerse, but they are extremely unlikely to occur.
"No more entries in CI table in LCT-xxx"
The CI table in the specified LCT is full. A process has used its limit of local sections. A local section is a local page or several contiguous local pages. Consider increasing the UniVerse configuration parameter SHM_LCINENTS.
The message will also be logged to the uvsmm.errlog file.
"No more entries in MI table in LCT-xxx"
The MI table in the specified LCT is full. A process has used its limit of global pages. Consider increasing the size of a global page (SHM_GPAGESZ) or the number of global pages per process
(SHM_LMINENTS).
The message will also be logged to the uvsmm.errlog file.
"No more entries in PI table in LCT-xxx"
The PI table in the specified LCT is full. Your application has too many forked processes. Your application might not be structured correctly. Consider increasing the UniVerse configuration parameter SHM_LPINENTS.
The message will also be logged to the uvsmm.errlog file.
97
ಡೌನ್ಲೋಡ್ ಮಾಡಿ
ಜಾಹಿರಾತು