Monday, April 30, 2012

Installation and Verification of Remote Blob Storage (RBS) on SharePoint 2010

Introduction

Remote Blob Storage (RBS) facilitates storage of BLOB data outside the SQL Server Content Database onto the file system by using the FILESTREAM feature of SQL Server 2008. The advantages of storing BLOBs on the file system are:

  • Cheaper storage solution.
  • Improved database performance since database size becomes smaller as BLOB data is stored on the file system.
  • Better integration of SharePoint with other ECM systems.
  • Small and medium size customers can get around with the SQL Express limit of 4GB DB size.
There are five steps to be performed for RBS to be up and running on a SharePoint 2010 Farm:
  1. Enable FILESTREAM on SQL Server
  2. Provision the Content Database to use RBS Filestream Provider
  3. Install RBS
  4. Enable RBS on Content Database
  5. Test RBS data store
Enable FILESTREAM on SQL Server
  1. Click Start => All Programs => SQL Server 2008 R2 => Configuration Tools => SQL Server Configuration Manager.
     
  2. Under SQL Server Configuration Manager in the left pane, select SQL Server Services.

    RBSShare1.gif
     
  3. Locate the instance of the SQL Server that needs to be enabled as shown above.
  4. Right-click the SQL Server instance and select Properties.
  5. In the SQL Server Properties dialog box, select the FILESTREAM tab.
  6. Ensure that Enable FILESTREAM for Transact-SQL access is checked.
  7. Ensure that Enable FILESTREAM for file I/O stream access is checked.

    RBSShare2.gif
     
  8. Ensure that Allow remote clients to have streaming access to FILESTREAM data is checked as shown above.
Setting the filestream_access_level Parameter

By default, the filestream_access_level parameter in SQL Server is set to 1 (Enables FILESTREAM for Transact-SQL access). In order for the RBS provider to function properly, this parameter must be set to 2 (Enables FILESTREAM for Transact-SQL and Win32 streaming access).

  1. Open SQL Management Studio and click New Query to launch the Query Editor
  2. Execute the following commands using the Query Editor:

    EXEC sp_configure filestream_access_level, 2
    RECONFIGURE

    RBSShare3.gif

    3. To verify that the configuration has been enabled, execute the following command using the Query Editor:

    EXEC sp_configure filestream_access_level

    The results should look like this:

    RBSShare4.gif

Provision the Content Database to use RBS Filestream Provider

  1. Select the content database for which you want to create a BLOB store, and then click New Query.
  2. In the Query pane, copy and execute each of the following SQL queries in the sequence provided here.

use [ContentDbName]
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 [ContentDbName]
if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')alter database [ContentDbName]
add filegroup RBSFilestreamProvider contains filestream

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

Where [ContentDbName] is the content database name, and d:\BLOBStore is the directory in which you want the BLOB store created. You can provision a BLOB store only one time.

You should see something like this on the file system.

RBSShare5.gif

Install RBS

  1. Double-click the rbs.msi (10.50.x.x) and follow the steps as shown below. Provide the Server\Instance name, Content Database name and FileGroup. Make sure to select the Windows Authentication.

    RBSShare6.gif
     
  2. In the next screen where the FileGroup for FileStreamProvider is asked - make sure to give the correct name. As in this case it is RBSFilestreamProvider.
     
  3. Select the check box for TRUSTSERVERCERTIFICATE.

    RBSShare7.gif
     
  4. For now do not choose to install the maintainer task.

    RBSShare8.gif
     
  5. Mention the Store Name or accept the default name.
     
  6. Choose the logging level details:

    RBSShare9.gif
     
  7. Once the installation is done you will see tables added in the Content Database as below.

    RBSShare10.gif
Errors while installation on RBS

You may the following error while installing RBS:

RBSShare11.gif

You need to disable User Account Control. Follow below steps.

  1. Click Start, and then click Control Panel.
  2. In Control Panel, click User Accounts.
  3. In the User Accounts window, click User Accounts.
  4. In the User Accounts tasks window, click Turn User Account Control on or off.
  5. If UAC is currently configured in Admin Approval Mode, the User Account Control message appears. Click Continue.

    RBSShare12.gif
     
  6. Clear the Use User Account Control (UAC) to help protect your computer check box, and then click OK.
Enable RBS on Content Database
  1. On the Start menu, click Programs, click Microsoft SharePoint 2010 Products, and then right click SharePoint 2010 Management Shell and run as Administrator.
  2. At the Windows PowerShell command prompt, type each of the following commands.

    $cdb = Get-SPContentDatabase –WebApplication http://SiteName
    Where <http://SiteName> is the URL of the Web application that is connected to the content database.
    $rbss = $cdb.RemoteBlobStorageSettings
    $rbss.Installed()
    $rbss.Enable()
    $rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
    $rbss
     
  3. I was facing an issue at command $rbss.Installed() as shown below. When I printed only $rbss the following was the result.

    RBSShare13.gif
     
  4. The problem was there were more than one Content Databases attached to the Web Application where I was enabling RBS. After removal of the second database the above commands worked smoothly.
  5. The final result is as shown below.

    RBSShare14.gif
Test the RBS data store
  1. Connect to a document library on any Web server.
  2. Upload a file that is at least 100 kilobytes (KB) to the document library.
  3. On the computer that contains the RBS data store, click Start, and then click Computer.
  4. Browse to the RBS data store directory.
  5. Browse to the file list and open the folder that has the most recent modified date (other than $FSLOG). In that folder, open the file that has the most recent modified date. Verify that this file has the same size and contents as the file that you uploaded. If it does not, ensure that RBS is installed and enabled correctly as below.

    RBSShare15.gif
     
  6. If you check the database you will see the followiing. In the table AllDocStreams where the Content is actually stored, there is a Null in the Content column and value in the RBSId column.
This completes installation and verification of RBS on SharePoint 2010.

No comments:

Post a Comment