cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Which Rehosting Method?

SOLVED
Highlighted
Level 12

Which Rehosting Method?

It has been a while since I had to rehost my production machine to a test server, but I recently upgraded to 10.2 and would like my test server to reflect the 10.2 production server so that I have a fresh start. I would like to use the Rehost 2.0 tool to help me since I do not want to go through a manual rehost. I do have Solr turned on, some customization and connect to our corporate LDAP. I have an app server and a database server in production and am moving to the same on two virtual servers. Which method would be better and why?

  • Copy all the files to the new machines, import the database and use Rename
  • Use Rehost with a staging area
  • Use Clone with a staging area
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Which Rehosting Method?

Brian,

I'm also on 10.2 M020 in a virtual environment. I have a .bat file that manually stops the services on the test system, copies the files from production, then runs the rehosting utility. It pauses prior to the rehost step to give me time to export and re-import the database. I do all of this with the production system online and I do not use a second staging area.

The projects.properties file contains just this one line:

clone.prod=InfoEngine,Database,Apache,IEAdapter,WVSAgent

Here are the steps I use:

Production Database Server

  • Backup Windchill database to disk (SQL script)

Test Database Server

  • Copy database backup file from production server
  • Restore Database
  • Fix Windchill user account

USE windchill
GO

sp_change_users_login @Action='Report'
GO

EXEC sp_change_users_login 'Auto_Fix', 'windchill'
GO

  • Delete the entry from RMISTUBS table in the database. See CS150162.

delete from windchill.RMIStubs where RMIStubs.Name ='CacheMaster'

Test Application Server

Scripted Steps

  • Stop Windchill Services
  • Copy Application Data
  • Copy File Vault
  • Replace WVS Agent.ini File (single CAD worker for test environment)
  • Customize GUI for DEV (differnt color background, header message, etc.)
  • Clear Tomcat Cache
  • Delete Windchill Log Files
  • Delete Apache Log Files
  • Delete Directory Server Log Files
  • Start Windchill DS
  • Run Rehost Utility

Manually Steps

  • Stop WindchillDS
  • Clear Tomcat Cache
  • Update Trusted Hosts (for different CAD worker)
  • Start Windchill Services
  • Manually remove the remote file server
  • Clear out the visualization queues
  • Delete extra publisher queues

windchill wt.queue.QueueManager

25 REPLIES 25

Re: Which Rehosting Method?

Brian,

I'm also on 10.2 M020 in a virtual environment. I have a .bat file that manually stops the services on the test system, copies the files from production, then runs the rehosting utility. It pauses prior to the rehost step to give me time to export and re-import the database. I do all of this with the production system online and I do not use a second staging area.

The projects.properties file contains just this one line:

clone.prod=InfoEngine,Database,Apache,IEAdapter,WVSAgent

Here are the steps I use:

Production Database Server

  • Backup Windchill database to disk (SQL script)

Test Database Server

  • Copy database backup file from production server
  • Restore Database
  • Fix Windchill user account

USE windchill
GO

sp_change_users_login @Action='Report'
GO

EXEC sp_change_users_login 'Auto_Fix', 'windchill'
GO

  • Delete the entry from RMISTUBS table in the database. See CS150162.

delete from windchill.RMIStubs where RMIStubs.Name ='CacheMaster'

Test Application Server

Scripted Steps

  • Stop Windchill Services
  • Copy Application Data
  • Copy File Vault
  • Replace WVS Agent.ini File (single CAD worker for test environment)
  • Customize GUI for DEV (differnt color background, header message, etc.)
  • Clear Tomcat Cache
  • Delete Windchill Log Files
  • Delete Apache Log Files
  • Delete Directory Server Log Files
  • Start Windchill DS
  • Run Rehost Utility

Manually Steps

  • Stop WindchillDS
  • Clear Tomcat Cache
  • Update Trusted Hosts (for different CAD worker)
  • Start Windchill Services
  • Manually remove the remote file server
  • Clear out the visualization queues
  • Delete extra publisher queues

windchill wt.queue.QueueManager

Re: Which Rehosting Method?

Hello Tom,

Thank you for the information. Gives me a good starting point to work from. On the Replace WVS Agent.ini File, if I do not have CAD worker for my test environment, what do I do? For WindchillDS, do I copy that as well, or do I need to install that first and import the ldif file?

Thank you,

Brian

Re: Which Rehosting Method?

If you don't want the test environment configured for publishing, you can just completely delete the agent.ini file. (This defines the workers.)

As far as Windchill DS, I just copy the entire thing. I don't bother with exporting or importing the ldif. There is nothing about Windchill, WindchillDS, or Apache that requires any type of actual Windows installation. As long as the files are in the right place, they will run.

Re: Which Rehosting Method?

Gotcha. Thanks for the information. Does the copy slow down your productions server? I'm worried that it might slow mine down when I get to the file vault. I have 400GB in my vault.

Re: Which Rehosting Method?

Yes, a little. I think the database export is actually more impactful than the vault copy. Normally I kick this off after most people have gone home for the day. The whole process can be completed in less than an hour. (Our database is 60 GB and file vault is 650 GB.)

Re: Which Rehosting Method?

By the way, I use robocopy for the file copying. See below for sample. (I actually did install the Java SDK locally on the test system, so only the Java installer folder needed to be copied.)

REM ======= Copy Application Data ========
REM ======================================
robocopy \\production_server\e$\ptc\Windchill_10.2\HTTPServer E:\PTC\Windchill_10.2\HTTPServer /mir /ns /nc /nfl
robocopy \\production_server\e$\ptc\Windchill_10.2\PSI E:\PTC\Windchill_10.2\PSI /mir /ns /nc /nfl
robocopy \\production_server\e$\ptc\Windchill_10.2\Windchill E:\PTC\Windchill_10.2\Windchill /mir /ns /nc /nfl
robocopy \\production_server\e$\ptc\Windchill_10.2\WindchillDS E:\PTC\Windchill_10.2\WindchillDS /mir /ns /nc /nfl
robocopy \\production_server\e$\PTC\Windchill_10.2\Java\installer E:\PTC\Windchill_10.2\Java\installer /mir /ns /nc /nfl

REM ========== Copy File Vault ===========
REM ======================================
robocopy \\production_server\f$\WC_Vault F:\WC_Vault /mir /ns /nc /nfl

Re: Which Rehosting Method?

Thanks for this information I am trying to do the same thing.

FYI:

I noticed that you had stop and start windchill services as well as clearing the tomcat cache as manual steps. I just wrote some powershell scripts to do this here they are if you want them obviously you will need to change the service names and paths to be correct for your Windchill environment:

Script 1 Stop Windchilll Services: ===================================

#Stop Windchill Services

#3-30-2015

#Brian R. Reed

FUNCTION STOPWINDCHILL(){

Stop-Service "PTC-Windchill"

Stop-Service "PTC-WindchillDS"

Stop-Service "PTC-Apache"

}

Script 2 Start Windchill Services: ====================================

#Script to Start Windchill Services

#3-30-2015

#Brian R. Reed

FUNCTION STARTWINDCHILL(){

Start-Service "PTC-Apache"

Start-Service "PTC-WindchillDS"

Sleep 15

Start-Service "PTC-Windchill"

}

STARTWINDCHILL

Script 3 Stop Services Clear Cache Start Services: ===================================

#Script Written by Brian Reed
#Functionality: This script does the following:
#----1. Shuts down Windchill
#----2. Shuts down Windchill DS
#----3. Shuts down Apache
#----4. Checks to make sure Services were terminated - If not tries again.
#----5. Clears System Cache
#----6. Restarts Apache
#----7. Restarts Windchill DS
#----8. Restarts Windchill

$allServicesStoppedFlag = $false
$allServicesStartedFlag = $false

#allServicesStatus gives the current state of the Windchill Services
#$True means services are on
#$False means services are off
#"" means service status unknown
$allServicesStatus = $null


FUNCTION STOPWINDCHILL(){
Stop-Service "PTC-Windchill"
Stop-Service "Windchill Directory Server"
Stop-Service "PTC-Apache"
}
FUNCTION STARTWINDCHILL(){
Start-Service "PTC-Apache"
Start-Service "Windchill Directory Server"
sleep 15
Start-Service "PTC-Windchill"
}

#Attempt to Stop Windchill Services:
STOPWINDCHILL

#Get status of Windchill Services:
FUNCTION GETSERVICESTATUS(){
$WindchillServiceInfo = Get-Service "PTC-Windchill"
$ApacheServiceInfo = Get-Service "PTC-Apache"
$WindchillDSServiceInfo = Get-Service "Windchill Directory Server"
return $WindchillServiceInfo, $ApacheServiceInfo, $WindchillDSServiceInfo
}

FUNCTION TESTSERVICESTATUS(){
$aStatus = GETSERVICESTATUS
$wc1 = ""
$wc2 = ""
$wc3 = ""
$serviceOn = ""
foreach($item in $aStatus){
if ($item.Name -eq "PTC-Windchill"){
if($item.Status -eq "Running"){$wc1 = $true}
elseif($item.Status -eq "Stopped"){$wc1 = $false}
else{$wc1 = ""}
}
elseif($item.Name -eq "PTC-Apache"){
if($item.Status -eq "Running"){$wc2 = $true}
elseif($item.Status -eq "Stopped"){$wc2 = $false}
else{$wc2 = ""}
}
elseif($item.Name -eq "Windchill Directory Server"){
if($item.Status -eq "Running"){$wc3 = $true}
elseif($item.Status -eq "Stopped"){$wc3 = $false}
else{$wc3 = ""}
}
else{
$allServicesStartedFlag = $null
}
}
if($wc1 -eq $true -and $wc2 -eq $true -and $wc3 -eq $true){
$serviceOn -eq $true
}
elseif($wc1 -eq $false -and $wc2 -eq $false -and $wc3 -eq $false){
$serviceOn -eq $false
}
else{
$serviceOn -eq $null
}
return $serviceOn
}

#Test Services Status
$serviceStatus = TESTSERVICESTATUS


#If Services stopped continue
if($serviceStatus -eq $false){
}
#If Services did not stop try again:
else{
$i = 0
while($i -lt 3){
sleep 20
STOPWINDCHILL
$serviceStatus = TESTSERVICESTATUS
$i++
}
}

#Clear System Cache:
Remove-Item D:\ptc\Windchill_10.0\Windchill\tomcat\instances\* -recurse
Remove-Item D:\ptc\Windchill_10.0\Windchill\tasks\codebase\com\infoengine\compiledTasks\* -recurse
Remove-Item D:\ptc\Windchill_10.0\Windchill\logs\* -recurse


#Start Windchill
STARTWINDCHILL

#If Services started exit script
if($serviceStatus -eq $true){
}
#If Services did not start try again:
else{
$i = 0
while($i -lt 3){
sleep 20
STARTWINDCHILL
$serviceStatus = TESTSERVICESTATUS
$i++
}
}

Re: Which Rehosting Method?

Actually they are scripted the first time around, just not after the rehosting process. (For some reason the rehost process terminates the script I launch it from when finished.)

I'm just using plain old batch file syntax. Quite a bit simpler.

REM ====== Stop Windchill Services =======

REM ======================================

net stop "PTC Windchill Method Server"

net stop "PTCWindchillWebServer"

net stop "PTC Windchill Directory Server"

REM ========= Clear Tomcat Cache =========
REM ======================================
RMDIR E:\ptc\Windchill_10.2\Windchill\tomcat\instances /Q /S
RMDIR E:\ptc\Windchill_10.2\Windchill\tasks\codebase\com\infoengine\compiledTasks /Q /S

REM ===== Delete Windchill Log Files =====
REM ======================================
RMDIR /S /Q E:\PTC\Windchill_10.2\Windchill\logs\
MKDIR E:\PTC\Windchill_10.2\Windchill\logs\

REM ====== Delete Apache Log Files =======
REM ======================================
del /f /q E:\PTC\Windchill_10.2\HTTPServer\logs\*

REM ====== Delete Directory Server Log Files ======
REM ======================================
del /f /q E:\PTC\Windchill_10.2\WindchillDS\server\logs\*

Re: Which Rehosting Method?

Ah, I see. I wonder why it terminates? Maybe you could use the start command to launch a second batch file and then wait for it to terminate before continuing?