SharePoint RBS - 1 (Installation)

What is RBS.

One of the new things in SQL Server 2008 is Remote Blob Storage (RBS) which allows admins to setup SQL to save data that would normally go into a BLOB field to be stored somewhere else using an RBS provider. This provider could store data on a cheaper disk solution (compared to the expensive disk solutions usually selected for SQL Server), to a SAN or maybe even into the cloud… it really doesn’t matter where. The point is that BLOBs can be kept out of a SQL Server DB.

Why we need RBS ?

By using RBS for SharePoint, customer maybe able to leverage cheaper storage, improve performance, and enable better integration stories with 3rd party technology for their SharePoint databases. But be careful, the benefit is different case by case.

What all we need ?

SQL Server 2008 or SQL Server 2008 R2.
SharePoint 2010

How to configure ?
Step 1 : To enable and change FILESTREAM settings
  1. On the Start menu, point to All Programs, point to Microsoft SQL Server 2008 R2, point to Configuration Tools, and then click SQL Server Configuration Manager.

  2. In the list of services, right-click SQL Server Services, and then click Open.

  3. In the SQL Server Configuration Manager snap-in, locate the instance of SQL Server on which you want to enable FILESTREAM.

  4. Right-click the instance, and then click Properties.

  5. In the SQL Server Properties dialog box, click the FILESTREAM tab.

  6. Select the Enable FILESTREAM for Transact-SQL access check box.

  7. If you want to read and write FILESTREAM data from Windows, click Enable FILESTREAM for file I/O streaming access. Enter the name of the Windows share in the Windows Share Name box.

  8. If remote clients must access the FILESTREAM data that is stored on this share, select Allow remote clients to have streaming access to FILESTREAM data.

  9. Click Apply.

  10. In SQL Server Management Studio, click New Query to display the Query Editor.

  11. In Query Editor, enter the following Transact-SQL code:

    EXEC sp_configure filestream_access_level, 2
    RECONFIGURE

  12. Click Execute.

image

NOTE :- If you have active passive sql cluster then “Allow remote client to have streaming access to FILESTREAM data” will be checked by default

Refer to  https://msdn.microsoft.com/en-us/library/cc645923.aspx

Step 2 : Provision a BLOB store for each content database

After you have enabled and configured FILESTREAM, provision a BLOB store on the file system as described in the following procedure. You must provision a BLOB store for each content database.

To provision a BLOB store

1.Click Start, click All Programs, click Microsoft SQL Server 2008, and then click SQL Server Management Studio.

2.Connect to the instance of SQL Server that hosts the content database.

3.Expand Databases.

4.Click the content database for which you want to create a BLOB store, and then click New Query.

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

If you get any error “FileStream not enabled” then try

EXEC sp_configure filestream_access_level, 2 RECONFIGURE

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

If you sql active passive cluster then you will get this error

Msg 5184, Level 16, State 2, Line 2
Cannot use file 'c:\Blobstore' for clustered server. Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource of the Sql Server does not have a dependency on it.

Then we have to try

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

Verify the blob folder.

image

Step 3 : Install the RBS client library on each Web server.

You must install RBS client library on all Web servers in the SharePoint farm. The RBS client library are installed only once per Web server, but RBS is configured separately for each associated content database. The client library consists of a client-side dynamic link library (DLL) that is linked into a user application, and a set of stored procedures that are installed on SQL Server.

https://www.microsoft.com/download/en/details.aspx?id=16177

image

Run this on SQL and first SharePoint box .

Click Start, click Run, type cmd into the Run text box, and then click OK.

Copy and paste the following command into the Command Prompt window. Replace WSS_Content with the database name, and replace DBInstanceName with the SQL Server instance name. You should run this command by using the specific database name and SQL Server instance name only one time. The operation should finish within approximately one minute.

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

image

 

image

What if ?

  • if we don't find any rbs tables.
    • Reinstall RBS.msi again  

Run this on all other SharePoint box .

msiexec /qn /lvx* rbs_install_log.txest /i RBS.msi DBNAME="WSS_Content" DBINSTANCE="DBInstance Name" ADDLOCAL="Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer"

Step 4 : Enable RBS for Content Database from Web Server:

Open SharePoint PowerShell as Administrator and perform the steps below:

$cdb = Get-SPContentDatabase “WSS_Content”
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Installed()
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])

What if ?

  • We have more then one database in a application ?
    • $cdb = Get-SPContentDatabase –WebApplication <URL>

Step 4 : Test the RBS installation

You should test the RBS installation on one Web server in the SharePoint farm to ensure that the system works correctly.

To test the RBS data store
  1. On the computer that contains the RBS data store, click Start, and then click Computer.

  2. Browse to the RBS data store directory.

  3. Confirm that the folder is empty.

  4. On the SharePoint farm, upload a file that is at least 60 kilobytes (KB) to a document library.

  5. On the computer that contains the RBS data store, click Start, and then click Computer.

  6. Browse to the RBS data store directory.

  7. Browse to the file list and open the file that has the most recent modified date. This should be the file that you uploaded.

Step 4 : Enable RBS on another content database:

Follow step 2 for other databases.

Run this script on sql server for new database

msiexec /qn /i rbs.msi REMOTEBLOBENABLE=1 FILESTREAMPROVIDERENABLE=1 DBNAME=”WSS_Content_NEW” FILESTREAMSTORENAME=FilestreamProvider_1 ADDLOCAL=EnableRBS,FilestreamRunScript DBINSTANCE=”DBInstanceName”$cdb = Get-

On SharePoint server in PowerShell run:

SPContentDatabase “WSS_Content_NEW”
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Installed()
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])

To be continued…