Tag Archives: RBS

Remote Blob Storage Maintainer Configuration

Requirement

When you implement Remote Blob Storage for SharePoint 2010, you also need to configure the RBS Maintainer as a scheduled task on your SharePoint database server in order to periodically clean the blob stores from orphaned objects (files that have been permanently removed from SharePoint do not get automatically deleted from the blob store!).

Solution

Step 1 – Install the Remote Blob Storage tool from Microsoft on your SQL Server

You may download the tool from http://www.microsoft.com/en-us/download/details.aspx?id=26728

Assuming that you have already configured RBS on your SharePoint farm, you will need to run the following command to install the tool.

Open an administrator Command Prompt and type the following in:

msiexec /qn /lvx* rbs_install_log.txt /i RBS_x64.msi DBNAME=”WSS_Content” DBINSTANCE=”DBInstanceName” ADDLOCAL=Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer

Replace WSS_Content and DBInstanceName to suit your environment as required.

Check the rbs_install_log.txt file and look for the line at near the bottom of the file ‘Product: SQL Server 2008 R2 Remote Blob Store — Installation completed successfully.’

Step 2 – Configure the RBS Maintainer

Assuming you have installed the 64 bit version of the tool, browse to C:\Program Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer and type the following commands:

Note that you only need to do the following if you have configured RBS on more than one database. The first RBS database should already exist in the file and its default ConnectionStringName is RBSMaintainerConnection

Decrypt the configuration file using ASPNET_REGIIS

rename Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config web.config
c:\windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pdf connectionStrings .

*Note that the word connectionStrings is case sensitive.

Add the connection strings to all your RBS enabled databases

Add your connection strings following the same format as the existing one. MAke sure you add it under <connectionStrings>here</connectionStrings>

Encrypt the configuration file using ASPNET_REGIIS

c:\windows\Microsoft.NET\Framework\v2.0.50727\-pef connectionStrings . -prov DataProtectionConfigurationProvider
rename web.config Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.config

Step 3 – Set the RBS Maintainer to run as a scheduled task

Go to Start -> Administrative Tools -> Task Scheduler

Create a new Basic Task called ‘RBS Maintenance’ and give it a useful description.

Under actions -> Set it to ‘Start a program’.

Browse to “C:\Program Files\Microsoft SQL Remote Blob Storage 10.50\Maintainer\Microsoft.Data.SqlRemoteBlobs.Maintainer.exe”

Add arguments (optional): -ConnectionStringName RBSMaintainerConnection -Operation GarbageCollection ConsistencyCheck -GarbageCollectionPhases rdo -ConsistencyCheckMode r

Click OK to Save

Set the task to run however often you like, it is preferable to run the RBS Maintainer after-hours.

Testing

The default Garbage collection period is 30 days, this means that only objects that have been orphaned for more than 30 days will be deleted by the RBS Maintainer. For your testing purposes, you may wish to reconfigure this to delete immediately, but be sure to change it back to 30 days once you have finished testing.

To set Garbage collection to delete immediately:

exec mssqlrbs.rbs_sp_set_config_value 'garbage_collection_time_window', 'time 00:00:00';
exec mssqlrbs.rbs_sp_set_config_value 'delete_scan_period', 'time 00:00:00';
exec mssqlrbs.rbs_sp_set_config_value 'orphan_scan_period', 'time 00:00:00';

To set it back to 30 days:

exec mssqlrbs.rbs_sp_set_config_value 'garbage_collection_time_window', 'days 30';
exec mssqlrbs.rbs_sp_set_config_value 'delete_scan_period', 'days 30';
exec mssqlrbs.rbs_sp_set_config_value 'orphan_scan_period', 'days 30';

Note that you must delete the files from the End User Recycle bin for RBS to recognise that the file has actually been deleted.

Another thing to take note of is that the blob files only get deleted after 2 log backups and 2 checkpoints on the database. This is when the garbage collector deems that the files are no longer needed. To test this:

  • Backup your database log file
  • Type the command ‘checkpoint’ -> Execute
  • Backup your database log file
  • Type the command ‘checkpoint’ -> Execute

Browse to your blob store, the blobs should now be deleted from the file system.

Comments ( 1 )

Configuring Remote Blob Storage on SharePoint 2010

Since recently upgrading to SQL Server 2008 R2, we decided to do some testing with the new feature called Remote Blog Storage. This new feature allows files to be stored locally on disk if it exceeds a specified size, thereby reducing the size of SharePoint content databases.

There are several resources on the net that provide a step by step guide on how to configure RBS. However, no one guide worked completely for me. Hence, I decided to write by own guide by pulling the stuff that worked for me from several guides

You will need:

  1. SharePoint 2010
  2. SQL Server 2008 R2
  3. RBS Client (http://go.microsoft.com/fwlink/?LinkID=165839&clcid=0x409)
Process
This is a high level break down of what you need to do to enable Remote Blob Storage on SharePoint 2010.
  1. Enable FILESTREAM on the target SQL Server Instance.
  2. Provision the RBS Data Store.
  3. Install the Microsoft SQL Server 2008 R2 Remote Blob Store
  4. Enable Remote Blob Storage
  5. Configure Minimum Blob Storage Size
  6. Test the RBS Data Store
Enable the FILESTREAM on the target SQL Server Instance.
Run SQL Server Configuration Manager and select your target SQL Server Instance.
Right click -> Properties -> FILESTREAM and check all the boxes as shown below.

Provision the RBS Data Store
Here we run a number of SQL statements in SQL Server Management Studio to provision the RBS Data Store.
EXEC sp_configure filestream_access_level, 2
RECONFIGURE

For the following statements, replace WSS_Content with the name of your database and c:\Blobstore with the location and name of your blob store.

use [WSS_Content]
if not exists
(select * from sys.symmetric_keys
where name = N'##MS_DatabaseMasterKey##')
create master key encryption by password = N'Admin Key Password !2#4'

use [WSS_Content]
if not exists
(select groupname from sysfilegroups
where groupname=N'RBSFilestreamProvider')
alter database [WSS_Content]
add filegroup RBSFilestreamProvider contains filestream

use [WSS_Content]
alter database [WSS_Content]
 add file (name = RBSFilestreamFile, filename =
'c:\Blobstore')
to filegroup RBSFilestreamProvider

Install the Microsoft SQL Server 2008 R2 Remote Blob Store

Download the RBS Client and copy it to all your web front end servers (WFE).

On the first WFE, open Command Prompt with ‘Run as Administrator‘. For each of the following msiexec commands, replace WSS_Content with your database name and DBInstanceName with the name of your database instance, e.g. vm100 or vm100\sharepoint.

Navigate to where you downloaded the RBS_X64.msi file and type the following command:

msiexec /qn /lvx* rbs_install_log.txt /i RBS_X64.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME="WSS_Content" DBINSTANCE="DBInstanceName" FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=FilestreamProvider_1


Open the rbs_install_log.txt file and look for the line:

Product: SQL Remote Blob Storage -- Configuration completed successfully

The log file should be more than 1 MB if the configuration was successful.

On the database server, run the following query in SQL Server Management Studio to check if the RBS tables have been created.

use WSS_Content
select * from dbo.sysobjects
where name like 'rbs%'

You should see something like the following in the results panel.

For additional Web servers, do the same as above but run the following msiexec command instead:
msiexec /qn /lvx* rbs_install_log.txt /i RBS_x64.msi DBNAME=”WSS_Content” DBINSTANCE=”DBInstanceName” ADDLOCAL=Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer
Enable Remote Blob Storage
Note: You will need to perform the steps below for each content database.
On your Web Front end server, open SharePoint 2010 Management Shell and type in the following commands in sequence, replacing WSS_Content with the name of your database:
$cdb = Get-SPContentDatabase WSS_Content
$rbss = $cdb.RemoteBlobStorageSettings $rbss.Installed()
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
$rbss
With the last command you should see the following result:
If not, it is most likely that the RBS Client has not installed correctly. Go through the rbs_install_log.txt and search for errors.
Configure Minimum Blob Storage Size
You may want to configure th e minimum blob storage size. This means that any file that exceeds this configured size will go straight to the blob store on the file system.
On any WFE, open SharePoint 2010 Management Shell and type the following commands, again replacing WSS_Content with the name of your database:
$database = Get-SPContentDatabase WSS_Content
$database.RemoteBlobStorageSettings.MinimumBlobStorageSize=1048576
$database.Update()

This will set the minimum size of your blob store to 1MB.

Test the RBS Data Store
If you provisioned a new database to test your blob store, you will need to create a site collection in that database. I prefer to use PowerShell to do any site creations as it lets me specify the database I wish to create in. Otherwise,  if you do it via Central Administration, you have to set all your other database to read-only so that your site creates in that specific database.
Open SharePoint 2010 Management Shell and type the following command:

New-SPSite -url <your sharepoint site collection> -owneralias <account name> -contentdatabase <blob database>


Note: you have to define a managed path first before you run the above command.

Once your site has been created, upload a file that is greater than the minimum blog storage size you specified in the previous step.

Now, browse to the location of your blob store, e.g. c:\Blobstore

You will see that your file has been copied directly to the blob store.
More information
The following resources were helpful in helping me configure RBS successfully:
http://blogs.msdn.com/b/sqlrbs/
http://technet.microsoft.com/en-us/library/ee748631.aspx#Section3
http://www.sp-blogs.com/blogs/adnan/Lists/Posts/Post.aspx?ID=9
http://blogs.msdn.com/b/tejasr/archive/2011/04/01/experience-of-configuring-remote-blob-storage-rbs-with-sharepoint-2010.aspx
Comments ( 0 )