Configure Remote Blob Storage (RBS) with FILESTREAM for SharePoint Foundation 2010


Ok, so i just finished configuring Remote Blob Storage with FILESTREAM for SharePoint Foundation. I hit a few glitches hence thought I will share the steps with you.

First, why RBS??

For all of you guys who has WSS 3.0 running on Windows Internal Database, when you install SharePoint Foundation 2010, it installs SQL 2008 Express which has the 4 GB limit. So when you are thinking about upgrading to 2010 and have a Content DB larger than 4 GB you got a few options:

    • Move the full blows SQL
    • Move to SQL 2008 R2 Express (10 GB Limit)… Read more here.
    • Install and Configure Remote BLOB Storage.

In this post I will talk about how to configure SharePoint Foundation (similar steps for SharePoint 2010 as well) with RBS and FILESTREAM.

  • Configure FILETREAM – http://msdn.microsoft.com/en-us/library/cc645923.aspx 
    1. Step 7 in the above article is particularly important:
      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.
    2. Run this script in SQL MGMT Studio:

      EXEC sp_configure filestream_access_level, 2
      RECONFIGURE

  • Download RBS (SQL 2008 R2 Nov CTP at the time of this post) from here.
  • Run the 3 SQL commands on your Content DB from here.

image

  • Run the following command (Note: My App and SQL are both on the same box) from an elevated command prompt:

C:\>msiexec /qn /lvx* rbs_install_log.txt /i c:\downloads\RBS_X64.msi TRUSTSERVERCERTIFICATE=true FILEGROUP=PRIMARY DBNAME=WSFContent DBINSTANCE=SQL01 FILESTREAMFILEGROUP=RBSFilestreamProvider FILESTREAMSTORENAME=RBSFSStore

Underlined words in the above command can be replaced with your own values.

image

This will take a couple of mins to complete and the log size is approx 1200 to 1400 KB. This is where i got stuck a couple of times. The log file may state Installed successfully, but that doesn’t mean it will work for SharePoint. To ensure that the installation was successful, open up the Content DB and you should see a bunch of tables starting with “rbs_” :

image

  • If you have additional servers, use this command after running the above one:

msiexec /qn /lvx* rbs_install_log.txt /i RBS_X64.msi DBNAME="ContentDbName" DBINSTANCE="DBInstanceName" ADDLOCAL="Client,Docs,Maintainer,ServerScript,FilestreamClient,FilestreamServer"

Once you see these tables, you know for sure that the RBS is working. Now open up SharePoint 2010 Management Shell and type the commands in the order below:

$cdb = Get-SPContentDatabase –WebApplication http://YourSiteName
$rbss = $cdb.RemoteBlobStorageSettings
$rbss.Installed() – This should result in True. Else the next command will fail.
$rbss.Enable()
$rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
$rbss

image

Now when you upload files to SharePoint Doc Lib that will reside in the File system and not in the DB. You can upload a file more than 100 KB and test it out. The same will be available in the Folder (BLOB Store). The File Name will not match but they are not encrypted and will open fine in the client apps. To change the file size Limit (say only files with 1 MB or more will go to the BLOB) enter the following command:

$cbd = Get-SPContentDatabase “WSS_Content”
$cbd.RemoteBlobStorageSettings.MinimumBlobStorageSize=1048576
$cdb.Update()

The above is from Jei Li’s post at – http://blogs.msdn.com/opal/archive/2009/12/07/sharepoint-2010-beta-with-filestream-rbs-provider.aspx . Read it for more information on RBS and SharePoint.

Good luck!!

This posting is provided "AS IS" with no warranties, and confers no rights.

Comments (10)

  1. Vince says:

    I followed the post and was able to successfully set up filestream and remote blob storage on our sharepoint farm.  I then decided to disable stream.  I ran the sp_configure statement to disable filestream and then re-started sql service.  It broke my site because my database would not come on-line.  It was in a recovery_pending status.  I re-enabled filestream and everything was back to working.  How do I disable filestream without messing up the database?

  2. priyo says:

    Hello Vince,

    The ideal was to disable RBS is through powershell, anything else might render the DB unusable. To remove RBS us this:

    $site=Get-SPSite "<http://yourSiteURL>&quot;

    $rbss=$site.ContentDatabase.RemoteBlobStorageSettings

    $rbss.SetActiveProviderName("")

    Note: this will not uninstall RBS. To uninstall RBS you need to call SPRemoteBlobStorageSettings.Disable Method

    Hope this help.s

    Priyo

  3. David says:

    after installing RBSx64.msi the logs show "installation completed succesfully" but the tables were not created in the content DB. How do I troubleshoot that?

  4. priyo says:

    David,

    Installation completed successfully just means that the binaries have been installed. Go through the log file and see what's missing, it would point out the error and the line would read something like "Cannot configure…". Look for the following keywords in the Log file – Fail, failed, error, exception

    Seems like an communication error (SQL Named pipes). Also make sure you are running the command from an elevated cmdshell.

    HTH,

    Priyo

  5. Jonathan Herschel says:

    Great post, thanks!

  6. eabdo says:

    Installation completed successfully  and  ables added also to the content data base but when i am trying to add file to a library it give me the follwoing error from log

    05/24/2011 18:44:07.45 w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       9j7o Medium   Exception thrown storing stream in new SqlRemoteBlob: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> Microsoft.Data.SqlRemoteBlobs.BlobStoreException: There was a generic database error. For more information, see the included exception. —> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)     at Syste… 2cf364fa-82c2-4b20-80c3-e57da532ee7f

    05/24/2011 18:44:07.45* w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       9j7o Medium   …m.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)     at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)     at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)     at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)     at System.Data.SqlClient.SqlInternalConnectionTd… 2cf364fa-82c2-4b20-80c3-e57da532ee7f

    05/24/2011 18:44:07.45* w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       9j7o Medium   …s.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)     at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)     at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)     at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)     at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)  … 2cf364fa-82c2-4b20-80c3-e57da532ee7f

    05/24/2011 18:44:07.45* w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       9j7o Medium   …   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)     at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)     at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)     at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)     at System.Data.SqlClient.SqlConnection.Open()     at Microsoft.Data.BlobStores.FilestreamBlobStore.FilestreamStoreLibrary.Initialize(ConfigItemList commonConfiguration, ConfigItemList coreConfiguration, ConfigItemList extendedConfiguration, BlobStoreCredentials[] credentials)     — End of inner exception stack trace —     at Microsoft.Data.BlobStores.FilestreamBlobStore.File… 2cf364fa-82c2-4b20-80c3-e57da532ee7f

    05/24/2011 18:44:07.45* w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       9j7o Medium   …streamStoreLibrary.Initialize(ConfigItemList commonConfiguration, ConfigItemList coreConfiguration, ConfigItemList extendedConfiguration, BlobStoreCredentials[] credentials)     at Microsoft.Data.BlobStores.BlobStore.InitializeInternal(Request request)     at Microsoft.Data.SqlRemoteBlobs.ProviderSession.Connect()     at Microsoft.Data.SqlRemoteBlobs.RemoteBlobCommand.ExecuteInternal()     at Microsoft.Data.SqlRemoteBlobs.RemoteBlobCommand.Execute()     at Microsoft.Data.SqlRemoteBlobs.SqlRemoteBlob.WriteFromStream(Stream inStream)  BlobStoreException Code: OperationFailedAuthoritative      — End of inner exception stack trace —     at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHand… 2cf364fa-82c2-4b20-80c3-e57da532ee7f

    05/24/2011 18:44:07.45* w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       9j7o Medium   …le typeOwner)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)     at Microsoft.SharePoint.RBSWrapper.SqlRemoteBlob.WriteFromStream(Stream stream)     at Microsoft.SharePoint.SqlRemoteBlobSession.StoreStreamInBlob(Int32 collectionId, String providerName, Stream stream) 2cf364fa-82c2-4b20-80c3-e57da532ee7f

    05/24/2011 18:44:07.47 w3wp.exe (0x1B60)                       0x1150 SharePoint Foundation         General                       8kh7 High     The URL 'DataConnections/CamelotSharePointConnectorGuide.pdf' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web. 2cf364fa-82c2-4b20-80c3-e57da532ee7f

  7. priyo says:

    From this section of the log it seems to be a communication error between the SP Server and the SQL Server.

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server

  8. eabdo says:

    i enabled the  remote connections on my server and the same error occure again

  9. priyo says:

    check this post for more troubleshooting steps – blogs.msdn.com/…/named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server.aspx

    Chances are Named Pipes are not enabled or a firewall is blocking the communication. You should also check if you are able to connect to the remote instance of SQL from other machines.

  10. Nice information says:

    Nice information