====== Enabling Replication ======
The following information illustrates the steps required to enable a High Availability Replicant Server.
All steps must be **performed in the order presented** to create a successful connection between the Master and Replicant Server.
===== Prerequisites =====
Functional installation of TapeTrack Server running that will become the Master.
IP addresses of both the Master and Replicant servers. IP addresses included in the instructions are for demonstration only, these must be replaced with your correct values.
You have made a **complete [[server:backups|backup]] of the Master database** before attempting any of these instructions to maintain the database information should you not complete the process successfully.
===== Steps On Remote Server =====
[[server:installing|Install the TapeTrack Framework Server software on your Replicant machine]].
[[server:start_stop|Stop the service on the Replicant machine]].
|{{server_helper_stop.gif}}|
Navigate Windows File Explorer to the TapeTrack Framework Server installation directory (TapeTrack\TapeTrack Framework Server) to the var\db folder.
Delete all database files on the Replicant machine (all files in the ''TapeTrack\TapeTrack Framework Server\var\db'' directory) **EXCEPT** the [[server:DB_CONFIG|DB_CONFIG]] file).
|{{master_replicant_remove_dbconfig.gif}}|
Open the DB_CONFIG file in Notepad, or equivalent text editor.
Edit the TapeTrack\TapeTrack Framework Server\[[server:db_config|DB_CONFIG]] file to remove the comments (#'s) starting from the line **rep-set-priority 0** to make the machine a Replicant.
Edit the Replicant Server and Master Server host names in the [[server:DB_CONFIG|DB_CONFIG]] file.
* Replace **replicant-1.tapetrack.com** with the IP address of **your** Replicant Server (your_replicant_IP_address used as Replicant IP example) and port number if not using the default 5100 value.
* Replace **master.tapetrack.com** with the IP address of **your** Master Server (your_Master_IP_address used as Master IP example) and port number if not using the default 5100 value.
Ensure you use the IP4 address for the Master and Replicant Server as using the domain name can cause issues with the IP6 address replacing the IP4 address, stopping the Master and Replicant communication.
{{master_replicant_dbconfig_replicant.gif}}
Ensure that the replication TCP/IP ports specified in the [[server:db_config|DB_CONFIG]] file are open for inbound connections.
===== Steps On Master Server =====
[[server:start_stop|Stop the TapeTrack service on the Master TapeTrack server]].
Edit the TapeTrack\TapeTrack Framework Server\[[server:db_config|DB_CONFIG]] file and remove the comments (#'s) starting from the line **rep-set-priority 1** to make the machine a master server.
Edit the [[server:db_config|DB_CONFIG]] file to define the local and remote server.
Edit the Replicant Server and Master Server host names in the [[server:DB_CONFIG|DB_CONFIG]] file.
* Replace **replicant-1.tapetrack.com** with the domain name (or IP address) of **your** Replicant Server (your_replicant_IP_address used as Replicant IP example).
* Replace **master.tapetrack.com** with the domain name (or IP address) of **your** Master Server (your_master_IP_address used as Master IP example).
{{master_replicant_dbconfig_master.gif}}
Delete all, and only, the files starting with ''_db.'' and ''db.rep.''. This step is made easier if you sort the files in ascending order of file names to group them all together.
These files will be rebuilt when the server is restarted using the information of the new Master and Replicant details.
|{{master_replicant_remove_db_files.gif}}|
Ensure that the replication TCP/IP ports are open for inbound/outbound connections.
===== Start The Servers =====
[[server:start_stop|Start the Master TapeTrack Server]].
|{{server_helper_start.gif}}|
Once the Master server is running, [[server:start_stop|start the Replicant TapeTrack service]].
The Replicant server will prepare the database for connection to the Master server and move into ''Start Pending'' mode while waiting for the Master server to respond.
|{{start_pending.png}}|
The Master server will now connect to the Replicant server and load the database information across the connection. This may take time depending on the database size.
Once the database is fully replicated the Replicant server will now display running.
===== Confirming Functionality Of Primary And Replicant Servers =====
Open ''$DB_Msg.txt'' file (in the ''var/db'' directory) on both the primary and Replicant server to ensure that replication is functional.
Ensure that all firewall ports are open to allow the Replication traffic to pass between the Replicants.
Master $DB_Msg.txt file showing connection between Master and Replicant and the process of sending database information.
{{master_db_msg.png}}
Replicant $DB_Msg.txt file showing connection between Master and Replicant, validation of connection and receiving database information.
{{replicant_db_msg.png}}
Another way of testing the replication is correct and functioning is to [[desktop:adding_connection|create a connection]] to the Replicant database through TapeMaster using the Replicants IP address. Remember to use the Replicants connection port (usually 5000) and not the replication data port (5010).
{{login_replicant.png}}
As this database is a replication of the Master server, all user-ID's from the Master are functional in the replicant server for login purposes.
When you connect to the Replicant database you will receive a popup reminding you the server is Read Only. While you can view Customer, Media and Volume information, any attempted updates will be blocked by security protocols.
{{read_only_replicant.png}}
The replication communications are not encrypted so if replication is enabled you should ensure that all machines that are replicated are in a trusted network or connected via a secure VPN connection.
[[troubleshooting:replication|Server replication troubleshooting]]
==== See Also ====
[[server:replicant_to_master|Restoring Replicant server to Master server status]]
<- ^ server:advanced|Advanced Administration ^ server:port_change|Changing the default port ->