Sunday, July 22, 2012

Crawl Target Configuration using powershell


Hi,

Generally if user search any content in the site, due to network load balancing request may hit to any server.
That is why we can configure any one of the WFE so that any search requests can hit to crawl target server without disturbing other servers.

In SharePoint 2010 we can configure Crawl Target Server with the help of power shell.

I have run the below script on our application server to configure crawl target server.

//CrawlTargetScript.ps1
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null)
{
Write-Host "Loading SharePoint Powershell Snap-in"
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}
[xml]$xmldata=Get-Content D:\Naga\CrawlTargetScript\CrawlTargetInputs.xml

$svc=[Microsoft.SharePoint.Administration.SPWebServiceInstance]::LocalContent
$svc.DisableLocalHttpThrottling
$svc.DisableLocalHttpThrottling=$true
$svc.Update()
$listOfUri = new-object System.Collections.Generic.List[System.Uri](1)
$zoneUrl = [Microsoft.SharePoint.Administration.SPUrlZone]'Default'

## This is your web application url(e.g. http://webappaurl, note crawl target configuration is
## per web application
$webAppUrl = $xmldata.CrawlTargetConfigurationInputs.WebApplicationUrl
$webApp = Get-SPWebApplication -Identity $webAppUrl
$webApp.SiteDataServers.Remove($zoneUrl) 

## This is your crawl target server
## You can use a server name e.g.  http://crawltargetname, or a URL e.g. ##http://webappurl
## you can also add multiple crawl target servers
## this assumes that the web application is provisioned on port 80, otherwise specify the port no
$URLOfDedicatedMachine = New-Object System.Uri($xmldata.CrawlTargetConfigurationInputs.DedicatedMachineUrl)

$listOfUri.Add($URLOfDedicatedMachine);
$webApp.SiteDataServers.Add($zoneUrl, $listOfUri);
$WebApp.Update()

##Verify the crawl target configuration, the following script will list the configured crawl target urls
$webAppUrl = $xmldata.CrawlTargetConfigurationInputs.WebApplicationUrl
$webApp = Get-SPWebApplication -Identity $webAppUrl
$webapp.SiteDataServers | fl

write-host $xmldata.CrawlTargetConfigurationInputs.DedicatedMachineName has been configured as crawl target server successfully -ForegroundColor Green

// CrawlTargetInputs.xml
<?xml version="1.0" encoding="utf-8" ?>
<CrawlTargetConfigurationInputs>
  <WebApplicationUrl>https://webappurl</WebApplicationUrl>
  <DedicatedMachineName>crawltargetservername</DedicatedMachineName>
  <DedicatedMachineUrl>http:// crawltargetservername</DedicatedMachineUrl>
</CrawlTargetConfigurationInputs>

Now after running the script, our challenge is to find out if requests is going to crawl target server or not.
For that I followed the below steps to get confirmation.

Step 1) In the central admin page, Start the crawlers 

Step 2) Verify the Crawl target servers logs/ CPU etc

·         You  will see CPU jump up in the crawl target servers
·         Wait for the crawling to complete and Check the IIS Logs (i.e. C:\inetpub\logs\LogFiles\W3SVC<SiteId>\) – in all WFE’s you will see requests coming in from the SEARCH(MS+Search) server to crawl target server as below.
Even there is NetMon tool to confirm if search requests is going to crawl target or not i.e.
1)Created Filter where i provided destination server as crawl target server, after that searched text in other WFE and came to the tool to monitor.
I saw the requests coming in with source and destination IP as below


Tuesday, July 3, 2012

Unable to connect to the specified address.Verify the URL you entered and contact the service administrator for more details


Hi,

We had a requirement to Publish Search Service Application in one farm and to consume in another farm

I followed  the below link to do the above requirement


Now when i was trying to connect to the service application in consuming farm i was getting the below issue

 But I was able to browse the url that i will be getting after publishing the service application in publishing farm as below
I approached our Architect for the same,he told me two steps to resolve this issue as below

1)In the consuming farm,in powershell I entered below command
2)I copied the generated Id as above in the below publishing,clicked farm while setting the permission to a published service application.

Clicked ‘Add’ after entering the Id and was able to see the Id under ‘Local Farm’
Finally what I understood is,in consuming farm it was not identifying the URL of published farm due to different farm id.