Changing Domain and Changing SharePoint Distributed Cache Host Name

Today, I’m asked to change my SharePoint Servers to another domain. (jaw dropped). And I’m gonna share the important steps that help you to rename your existing distributed cache host name to a new host name.

I will be using the following naming for better illustration

SharePointWeb01.olddomain.com  -> SharePointWeb01.newdomain.com

As usual, you would domain disjoint, restart server, join to the new domain (using enterprise admin of the new domain). Once the server is joint to the new domain. You can instantly see many error log generated in your event viewer. This post I’m gonna cover only how to swing Distributed Cache and make it goes Live again and with assumption that you have changed the SharePoint Farm Account to a new account. (cause this is domain change activity! big task)

 

First thing first

Make sure the OLD distrbuted host name is pingable and it is still connecting back to the same server. How to do that?

Fire NOTEPAD and edit C:\windows\system32\drivers\etc\hosts

Add in your server IP with the old host name. You will then remove the old host name AFTER successfully getting the distributed cache cluster up.

 

Secondly, change the distributed cache service from the old orphan service account to a new one in the new domain.

Run the following to change the service account

[sourcecode language=”powershell”]

$farm = Get-SPFarm
$cacheService = $farm.Services | where {$_.Name -eq "AppFabricCachingService"}
$accnt = Get-SPManagedAccount -Identity "NEWDOMAIN\NewFarmAdmin"
$cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$cacheService.ProcessIdentity.ManagedAccount = $accnt
$cacheService.ProcessIdentity.Update()
$cacheService.ProcessIdentity.Deploy()

Restart-CacheCluster

## At this step you will see error but please ignore.

Get-CacheHost

## And you should see your old cache host is UP.

## Register your new Host Name

## Note the DataSource=XXX it may be different from your environment. Change it accordingly to yours.

Register-CacheHost -Provider "SPDistributedCacheClusterProvider"
-ConnectionString "Data Source=SQL;Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False"
-Account "<NEW DOMAIN>\<NEW FARM ACCOUNT>"
-CachePort 22233 -ClusterPort 22234 -ArbitrationPort 22235 -ReplicationPort 22236
-HostName <HOST NAME of the server, SharePointWeb01>

[/sourcecode]

After executing the Register-CacheHost

Kindly perform a Export-CacheClusterConfig -Path c:\cache.xml to double check cache.xml if the new FQDN of your server is showing under datacache > hosts

Should look something like that

[sourcecode language=”xml”]

<hosts>
<host replicationPort="22236" arbitrationPort="22235" clusterPort="22234"
hostId="54695588" size="781"
leadHost="true" account="<new service account>"
cacheHostName="AppFabricCachingService"
name="<new and Correct FQDN e.g. SharePointWeb01.newdolmain.com>"
cachePort="22233" />

<!– Together with another host that stating your OLD FQDN e.g. SharePointWeb01.olddomain.com –>
</hosts>

[/sourcecode]

new host’s name should be a FQDN that you can ping and resolve right away without the need of editing HOSTS file.

Once this is done, run the final command in SharePoint Powershell console

[sourcecode language=”powershell”]
Unregister-CacheHost -Provider "SPDistributedCacheClusterProvider"
-ConnectionString "Data Source=SQL;Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False"
-HostName <the old host name e.g. SharePointWeb01.olddomain.com>
[/sourcecode]

Go back to your HOSTS file and remove the old ip mapping to SharePointWeb01.olddomain.com.

 

Leave a Reply

Your email address will not be published. Required fields are marked *