 F=$FromServerID\\nRTT=$ReplicaTypeTag\\n"
usageError "An HA replica can only be created from the master or edge server. So if '-f <FromServerID>' is specified with '-t ha', the '-f' value must refer to an edge server, with a value prefixed with 'p4d_edge_'."
msg "Using isolated shell environment, overriding P4CONFIG/P4ENVIRO/P4ALIASES, etc."
echo "P4PORT=$P4PORT" > "$P4CONFIG"
bail "Failed to trust P4PORT $P4PORT."
bail "Failed to login."
# master/commit server, one with a Services value of 'commit-server' or simply'standard'.
# on the current server.
# From the list of server specs, find the master/commit server spec.
msg "Preflight check for master ServerID."
msg "Verified: Master ServerID ($FromServerID) exists."
msg "Verified: Serivce user for ServerID $FromServerID exists: svc_${FromServerID}"
msg "Serivce user for ServerID $FromServerID will be created: svc_${FromServerID}"
msg "Server spec $FromServerID and service user will be created: svc_${FromServerID}"
errmsg "No server spec with Services value of 'commit-server' or'standard' found., and P4MASTER_ID is not set.\\n"
msg "Protections does not grant access to group $ServiceUsersGroup as required, but '-p' was specified to mitigate this."
errmsg "Protections does not grant access to group $ServiceUsersGroup as required,\\nand '-p' not specified. Specify '-p' or adust the Protections table to add\\nthis line near the bottom:\\n\\n\\tsuper group $ServiceUsersGroup * //...\\n"
# Version check: Require P4D 2018.1+ for using'standby' replica.
bail "P4D must be 2018.1+ if using journalcopy replicas, P4D_VERSION is $P4D_VERSION.."
msg "${H}\\nDoing SSH Preflight Checks."
errmsg "Failed to ssh to master host $P4MASTER."
errmsg "Failed to ssh to host $ReplicaHost."
msg "\\nPreflight checks passed. Continuing."
bail "\\nPreflight checks did not pass. Aborting."
msg "Creating required master server spec [$FromServerID]."
Description:\\n\\tMaster server." > "$ServerSpecFile" || bail "Failed to initialize server spec file [$ServerSpecFile]."
bail "Failed to load server spec from file: $ServerSpecFile\\n$(cat "$ServerSpecFile")\\n"
msg "NO_OP: Would run: $P4BIN -s server -i.LT. $ServerSpecFile"
# Strip off ssl: and host: element from front of value to just leave numeric port.
vmsg "Executing: $P4BIN configure set $ServerSpec#startup.1='journalcopy -i 0'"
vmsg "Executing: $P4BIN configure set $ServerSpec#startup.2='pull -i 1 -L'"
vmsg "NO_OP: Would execute: $P4BIN configure set $ServerSpec#startup.1=\"journalcopy -i 0\""
vmsg "NO_OP: Would execute: $P4BIN configure set $ServerSpec#startup.2=\"pull -i 1 -L\""
vmsg "Executing: $P4BIN configure set $ServerSpec#startup.$i='pull -i 1 -u'"
bail "Failed to load user spec from file: $ServiceUserSpecFile\\n$(cat "$ServiceUserSpecFile")\\n"
msg "NO_OP: Would run: $P4BIN user -f -i.LT. $ServiceUserSpecFile"
touch "$ServicePasswdFile" || bail "Failed to initialize password file $ServicePasswdFile."
chmod 600 "$ServicePasswdFile"
echo "$RandomPassword" > "$ServicePasswdFile"
echo "$RandomPassword" >> "$ServicePasswdFile"
"$P4BIN" passwd "$ServiceUser" < "$ServicePasswdFile"
msg "NO_OP: Would run: $P4BIN passwd $ServiceUser.LT. $ServicePasswdFile"
msg "Creating service $MasterServiceUser for master server spec."
bail "Failed to initialize user spec file [$MasterServiceUserSpecFile]."
vmsg "Contents of $MasterServiceUserSpecFile:"
[[ $VERBOSITY -gt 2 ]] && cat "$MasterServiceUserSpecFile"
bail "Failed to load user spec from file: $MasterServiceUserSpecFile\\n$(cat "$MasterServiceUserSpecFile")\\n"
msg "NO_OP: Would run: p4 user -f -i.LT. $MasterServiceUserSpecFile"
bail "Failed to initialize password file $MasterServicePasswdFile."
chmod 600 "$MasterServicePasswdFile"
echo "$RandomPassword" > "$MasterServicePasswdFile"
echo "$RandomPassword" >> "$MasterServicePasswdFile"
msg "Setting password for master service user $MasterServiceUser."
p4 passwd "$MasterServiceUser" < "$MasterServicePasswdFile"
msg "NO_OP: Would run: p4 passwd $MasterServiceUser.LT. $MasterServicePasswdFile"
bail "Failed to update Protecttions table from file $TmpFile."
msg "Adding service users $ServiceUser and $MasterServiceUser to group $ServiceUsersGroup."
msg "Adding service user $ServiceUser to group $ServiceUsersGroup."
bail "Failed to load group spec from file: $GroupSpecFile\\n$(cat "$GroupSpecFile")\\n"
msg "NO_OP: Would run: p4 -s group -i.LT. $GroupSpecFile"
msg "${H}\\nAll processing completed successfully\\n\\nNext steps:"
msg "\\n=== PART 1 - Create Seed Checkpoint ===\\n"
msg "STEP $N. Login as |||EMAIL_ADDRESS||| msg "STEP $N. Set your shell environment with:\\n\\tcd /p4/common/bin\\n\\tsource p4_vars $SDPInstance\\n"
msg "STEP $N. Define replication filtering.  If you choose to filter by using ArchiveDataFilter and/or ClientDataFilter fields of the server spec, make those changes:\\n\\tp4 server $ServerSpec\\n\\nAlternately, if you choose to filter by database table, use 'p4 configure' commands to modify the $ServerSpec#startup.<n> settings related to the ServerID, adding the '-T' flag to the single 'pull' startup command that pulls metadata.\\n"
msg "STEP $N. Do a journal rotation to update offline_db:\\n\\trotate_journal.sh ${SDPInstance}\\n\\nThis should take only a few minutes even for large data sets."
msg "STEP $N. As this is an edge server, create the special edge seed checkpoint:\\n\\tnohup edge_dump.sh ${SDPInstance} ${ServerSpec} < /dev/null > /dev/null 2>&1 &\\n"
msg "STEP $N. Monitor the log until successful completion:\\n\\ttail -f \$(ls -t \$LOGS/edge_dump.*.log|head -1)\\n"
msg "STEP $N. As this is a filtered replica, create the special filtered seed checkpoint:\\n\\tnohup p4d_${SDPInstance} -r /p4/${SDPInstance}/offline_db -P $ServerSpec -J off -Z -jd $SampleCheckpoint < /dev/null > \$LOGS/seed.$ServerSpec.log 2>&1 &\\n"
msg "STEP $N. Monitor the log until successful completion:\\n\\ttail -f \$LOGS/seed.${ServerSpec}.log\\n"
msg "STEP $N. Create a new regular checkpoint to seed the replica.  Execute this command:\\n\\tnohup daily_checkpoint.sh $SDPInstance < /dev/null > /dev/null 2>&1 &\\n\\nNote: This step can be skipped if you choose to wait until the next regular daily checkpoint is created before proceeding on to PART 2."
msg "STEP $N. Monitor the checkpoint.log file until successful completion:\\n\\ttail -f \$LOGS/checkpoint.log\\n"
msg "\\n=== PART 2 - Load Checkpoint on Replica ===\\n"
msg "STEP $N. Login as |||EMAIL_ADDRESS||| msg "STEP $N. Set your environment with:\\n\\tcd /p4/common/bin\\n\\tsource p4_vars $SDPInstance\\n"
msg "STEP $N. Copy the edge seed checkpoint file created in the steps above from\\n${P4MASTER}:${CHECKPOINTS}.  Successfully completed checkpoint files have a\\n