This document is to failover an edge server to the standby edge that is using journalcopy for replication.
We assume the instance number for the server you are failing over to be 1 in this document.
Conventions:
Primary Edge: Normally active edge server. We will refer to this machine as the primary edge throughout this document, even after failover for consistency.
Standby Edge: This is the machine that is normally the standby for your edge server. Again, we will refer to this machine as the standby edge throughout the document for consistency.
edge_id = server id for your edge server
edge_standby_id = server id for your edge standby server
svc_edge_id = service user for the edge master
svc_edge_standby_id = service user for the edge standby
To perform the failover from the Primary Edge to the Standby Edge, complete the following steps:
On the Standby Edge:
1. Connect via SSH to the Standby Edge. Make sure you are the user running Perforce.
2. Check replication status with
p4 pull -lj
On the Primary Edge:
Connect via SSH to the Primary Edge. Make sure you are the user running Perforce.
Check replication status with
p4 pull -lj
Stop the Primary Edge Server Perforce Service:
sudo systemctl stop p4d_1
Disable automatic startup of the Primary Edge Server Perforce Service:
sudo systemctl disable p4d_1
On the Standby Edge:
Stop the Standby Edge Server Perforce Service:
sudo systemctl stop p4d_1
Clear the state file:
rm /p4/1/root/state*
Remove replica journals:
rm -f /p4/1/logs/journal*
Copy primary journals to standby server:
rsync -av edge_id:/p4/1/logs/journal /p4/1/logs
Copy primary edge state to standby server:
rsync -av edge_id:/p4/1/root/state /p4/1/root
Replay primary journal against standby db:
/p4/1/bin/p4d_1 -r /p4/1/root -jr -f /p4/1/logs/journal
Log admin user into the commit server:
/p4/common/bin/p4master_run 1 p4 -p perforce-commit.ct.company.com:1666 login -a < /p4/common/config/.p4passwd.p4_1_admin
Log service user into the commit server:
/p4/common/bin/p4master_run 1 p4 -p perforce-commit.ct.company.com:1666 login svc_edge_id
Edit server.id file:
vim /p4/1/root/server.id
change server id to "edge_id"
Edit server type file
vim /p4/1/root/sdp_server_type.txt
change p4d_edgerep to p4d_edge
Start Perforce service on standby edge
systemctl start p4d_1
Verify Standby Edge is now acting as Primary Edge
p4 info (check serverid)
p4 pull -lj (make sure edge is pulling from commit)
Failover complete
Have IT update DNS Record for Primary Edge to point to Standby Edge
Failback (Standby Edge → Primary Edge)
On the Primary Edge:
Connect via SSH to the Primary Edge.
Verify the Primary Edge Server Perforce Service is stopped:
sudo systemctl status p4d_1
On the Standby Edge:
Connect via SSH to the Standby Edge.
Stop the Standby Edge Server Perforce Service:
sudo systemctl stop p4d_1
On the Primary Edge:
Connect via SSH to the Primary Edge.
Again, Verify the Primary Edge Server Perforce Service is stopped:
sudo systemctl status p4d_1
Clear the state file:
rm /p4/1/root/state*
remove replica journals:
rm -f /p4/1/logs/journal*
copy standby checkpoints to primary server:
rsync -av edge_id:/p4/1/checkpoints/p4_1.jnl.* /p4/1/checkpoints/
copy standby journals to primary server:
rsync -av edge_id:/p4/1/logs/journal /p4/1/logs
Check the perforce journal counter
/p4/1/bin/p4d_1 -r /p4/1/root -jd - db.counter | grep journal
Replay any newer numbered journals against primary db:
/p4/1/bin/p4d_1 -r /p4/1/root -jr -f /p4/1/checkpoints/p4_1.jnl.xx
Replay the current journal file against primary db:
/p4/1/bin/p4d_1 -r /p4/1/root -jr -f /p4/1/logs/journal
log service user into the commit server:
/p4/common/bin/p4master_run 1 p4 -p perforce-commit.company.com:1666 login svc_edge_id
Enable Perforce service on primary edge:
sudo systemctl enable p4d_1
Start Perforce service on primary edge
sudo systemctl start p4d_1
Verify Primary Edge is now acting as Primary Edge once again
p4 info (check serverid)
p4 pull -lj (make sure edge is pulling from commit)
Failback complete
Have IT update DNS Record to point back to Primary Edge
At this point, the major part of the maintenance is complete, and users should be able to resume work on the Primary Perforce Edge Server.
The remaining task is to recover the standby edge server.
Standby Edge Recovery
On the Standby Edge:
Connect via SSH to the Standby Edge.
Verify the Standby Edge Server Perforce Service is stopped:
sudo systemctl status p4d_1
Clear the state file:
rm /p4/1/root/state*
Remove replica journals:
rm -f /p4/1/logs/journal*
Log admin user into the commit server:
/p4/common/bin/p4master_run 1 p4 -p edge_id.company.com:1666 login -a < /p4/common/config/.p4passwd.p4_1_admin
Log service user into the commit server:
/p4/common/bin/p4master_run 1 p4 -p edge_id.company.com:1666 login svc_edge_id_standby
Edit server.id file:
vim /p4/1/root/server.id
change server id to "edge_id-standby"
Edit server type file
vim /p4/1/root/sdp_server_type.txt
change p4d_edge to p4d_edgerep
Start Perforce service on standby edge
sudo systemctl start p4d_1
Verify Standby Edge is now acting as Standby Edge once again
p4 info (check serverid)
p4 pull -lj (make sure standby edge is pulling data)