Installing RBS FILESTREAM Provider in a SharePoint 2010 system

Source: Internet
Author: User
Tags filegroup

Installing RBS FILESTREAM Provider in a SharePoint 2010 system

These two days in the study of how to write an RBS Provider, unfortunately the document is very scarce, basically, in addition to a spec, only the SQL product group wrote a sample. Then if the research results, and then organized into articles, now talk about how to directly install and use the RBS FILESTREAM Provider.
--------------the separation line between gibberish and text--------------------
If you use SharePoint 2007 as a document management platform, it's a big criticism that SharePoint 2007 stores the file itself directly in the SQL Server database. Although Windows SharePoint Services 3.0 SP1 adds a external BLOB Storage (EBS) interface, Microsoft does not provide implementations, but it requires developers to implement it themselves.
SharePoint 2010 is still compatible with EBS, but it is not recommended to use EBS, the recommended solution is to use SQL Server Remote BLOB Storage (RBS).
SQL RBS is a set of APIs that, through RBS, a SQL Server 2008 database no longer needs to store the binary data (BLOBs) inside the database, but can be stored somewhere outside, where a reference to the external BLOB data may only be stored in the database. Both SQL Server 2008 and SQL Server R2 support RBS.
It sounds to me that RBS is a really good thing. But RBS is just a set of APIs, in other words, RBS allows developers to exploit this set of APIs to develop an RBS Provider that actually accesses BLOB data. If you do not have RBS provider,rbs yourself, you will not automatically store blobs in a specified place. Different RBS Provider allows us to store blobs to file systems, disk storage devices, file servers, and so on, anyway, without continuing to put them in the SQL Server database.

After you have a preliminary understanding of RBS, let's go on to another new feature in SQL Server 2008: FILESTREAM. The following is an excerpt from SQL Server 2008 Books Online: "by storing varbinary (max) binary large object (BLOB) data as a file on the file system, FILESTREAM makes the SQL Server database engine and the NTFS file system a A whole. "So, FileStream can have the administrator choose to store the varbinary (max) type BLOB data inside the SQL Server database on the local NTFS file system. When accessing BLOB data through FileStream, you can also enjoy the benefits of database transaction processing.
Sounds like FileStream and RBS are very similar, isn't it? But in fact, RBS and FileStream are two different things, they don't depend on each other. RBS is a set of API interfaces that enable applications to store BLOB data somewhere outside of the database and implement the RBS provider created by the developer. FileStream is a built-in SQL Server 2008 feature that stores BLOB data that is originally stored in a database intoServerOn the local NTFS file system.
SharePoint 2010 leverages the RBS API, not the FileStream feature. So, without an RBS Provider, we can't immediately store the files stored in SharePoint 2010 somewhere outside the database. However, since the FileStream feature already has a ready-made blob in the databaseData StorageTo the ability on the NTFS file system, why not use FILESTREAM directly, do an RBS FILESTREAM Provider, that is, an RBS Provider implemented with the functionality of FILESTREAM? Wouldn't it be possible to store the files in SharePoint 2010 on the NTFS file system?
Microsoft also thought of it, so Microsoft provided an RBS FILESTREAM Provider in the form of a Feature Pack (Feature pack). You can download the x64 version of the RBS FILESTREAM Provider from here. However, to install and use it on a SharePoint 2010 system, you need to follow some steps to do so. Here are the specific steps.
1. Determine that SQL Server 2008 has FileStream enabled
When you install SQL Server 2008, there is a step that prompts you to install FileStream. If you are not sure whether this attribute is installed, from SQL Server 2008Server, open SQL Server Configuration Manager, select SQL Server service from the left, and then right-click the running SQL Server instance from the right pane, and select the Properties menu item.

In the Properties window that opens, select the FILESTREAM tab, and then select the Enable FILESTREAM selection box and click the OK button.

Open SQL Server Management Studio, select the SQL Server instance on the left, then click New Query in the toolbar area, open a query interface, and then enter the following SQL statement and execute it.
EXEC sp_configure filestream_access_level, 2 RECONFIGURE

2. Determine the content database to which you want to apply the RBS FILESTREAM provider
Because RBS is enabled on a database-by-cell basis, you can choose which SharePoint content databases to enable RBS on. This means that for SharePointServerThe content databases that store a few files in the farm may not be necessary to enable RBS for it, and those that may store a large number of files, you can enable RBS to efficiently optimize them.
In SharePoint 2010 systems, the relationship between a content database and a Web site is:
A Web application can use one or more content databases, and when a new Web application creates a content database for it, the administrator can later create more content databases for this Web application, and when a site collection is created in a Web application, the site assembly is stored in In a content database of a Web application, a site collection, including the top-of-the-list and all subsites it contains, can be stored in only one content database and cannot be split into multiple content databases.
Administrators can open the content database management interface in SharePoint 2010 Central Administration, view the content databases used by each Web application, or add a new content database for a Web application.

In the following demonstration operation, we will enable RBS for the content database named "WSS_Content" shown in.
3. Configure the content database
When you have determined what you want to enable for RBSdatabase , open SQL Server Management Studio, locate the content database, right-click and select the new Query menu item.

In the query window that opens, enter the following SQL statements and execute them.
Use [wss_content] if not EXISTS (SELECT * from sys.symmetric_keys where name = N ' # #MS_DatabaseMasterKey # # ') CR Eate 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 ') t o Filegroup Rbsfilestreamprovider
In the above SQL directives, marked green, you have copied these instructions, you need to follow the actual situation in your environment, need to modify the section. "WSS_Content" needs to be modified to the content you want to enable RBSDatabaseThe actual name of the. "C:blobstore" to change to the one you want to use to store blob files.folderPath. From a practical point of view, you need to select a non-system partition, the remaining space is large, fast, stable and reliable folder. Note that this folder can only be a local path, not a network path, because FileStream does not support remote NTFS folders. In addition, this folder should not be established in advance, the above SQL instructions will automatically help you to create this folder.

After the above SQL statements have been executed, you can open the Resource manager and confirm that the corresponding folders have been created successfully on the SQL Server server.
4. Install RBS FILESTREAM Provider
Copy the downloaded Rbs_x64.msi file to each server in the SharePoint farm, and you must install this RBS Provider on all SQL Server database servers and SharePoint servers.
On the SQL Server database first and on the SharePointServerOn (if there are multiple SharePoint servers in the farm, on a single web front-end server), install RBS FILESTREAM Provider, and install the steps below.
Run the command prompt as an administrator.

In the Command Prompt window, use the "CD" directive to set the current path to the location of the "Rbs_x64.msi"folder, and then enter the following line of instructions and execute:
msiexec/qn/lvx* rbs_install_log.txt/i rbs_x64.msi trustservercertificate=true filegroup=primary DBNAME= "WSS_Content "Dbinstance=" sp2010 "Filestreamfilegroup=rbsfilestreamprovider filestreamstorename=filestreamprovider_1
The green-labeled part of the above directive is the part that needs to be modified according to the actual situation in your environment. "WSS_Content" needs to be modified to content that requires RBS to be enabledDatabase, "sp2010" needs to be modified to the actual SQL Server 2008 Instance name (if you do not use the default instance name when you install SQL Server 2008, it may have a value similar to the format "sp2010express"). For each content database, this instruction should only be executed once with Msiexec.exe.

After you've typed in this long command and hit enter, the command Prompt window will appear to be complete immediately, but in fact, the background will continue to execute the installation program for RBS provider. You can open Windows Task Manager and you should see that there are several Msiexec.exe processes in progress. After a while, the task manager will no longer show a few Msiexec.exe running (there will still be another Msiexec.exe process left in my environment), which indicates that the RBS provider installation process is complete.

During the RBS provider installation, it writes log information to the "Rbs_install_log.exe" file in the same directory as the "Rbs_x64.msi" installation file. Open the log file from Explorer and search for information such as "Installation completed successfully", which indicates that the installation of "Rbs_x64.msi" was successful.

If you are in your SharePointServerFarm, there is only one SharePoint server, so as described above, after it installs RBS Filestrream provider is done. However, if more than one SharePoint server exists in the farm, you will need to continue to install RBS FILESTREAM Provider on other web front-end servers and application servers, but the commands in the command prompt need to be replaced with:
msiexec/qn/lvx* rbs_install_log.txt/i rbs_x64.msi dbname= "wss_content" dbinstance= "sp2010" ADDLOCAL= "Client,Docs, Maintainer,serverscript,filestreamclient,filestreamserver "
After the RBS FILESTREAM provider is installed on all servers, open SQL Server Management Studio to refresh the contentDatabaseTable list, you should see more of the table with the name "Mssqlrbs", which is related to RBS. If you execute the following SQL statement in the Query window, you should be able to query for some results.
SELECT * from dbo.sysobjects where name like ' rbs% '

If none of the above table is in the content database and no results are queried for running the above SQL statement, then the RBS provider is not properly installed on the content database. If this is the case, on each server, open the Explorer, double-click Rbs_x64.msi, and then, in the installation interface that appears, use the uninstall option to uninstall the RBS provider first, and then follow the steps above to try to install it again in the Command Prompt window.
5. Enable the RBS FILESTREAM for the content database Provider
Finally to the last step. In the SharePointServer, open the SharePoint Management Shell, which is a Windows PowerShell-based command-line management tool.

In the SharePoint Management Shell, execute the following command in turn:
(1) $cdb = get-spcontentdatabase "WSS_Content" gets to the specified contentDatabase(SPContentDatabase) Object instance, the green labeled "wss_content" needs to be replaced by the actual content database name in your environment.
(2) $RBSS = $cdb. Remoteblobstoragesettings gets an instance of the RBS settings (spremoteblobstoragesettings) object for the content database.
(3) $rbss. Installed () Checks if RBS is installed on the content database and, if necessary, updates the corresponding property values.
(4) $rbss. Enable () enables RBS on the content database.
(5) $pvdName = $rbss. Getprovidernames () [0] Gets the name of the first RBS provider registered on the content database.
(6) $rbss. Setactiveprovidername ($pvdName) sets the RBS Provider to be activated for the content database.

You can then perform a "$RBSS" to see some of its property values, and if set correctly, its output should look like the following.
If you have a site collection enabled in the content database for RBS FILESTREAM provider, after you enable RBS provider, the documents inside the site collection are not automatically transferred to the NTFS file system immediately via FILESTREAM. Only new documents will be stored on the NTFS file system, and documents uploaded before the site collection will still be saved in the contentDatabaseInside. If you want to dump all of those old documents into the NTFS file system that we specify, you can continue to execute the following command in the SharePoint Management Shell:
(7) $rbss. Migrate ()
If you want to set a document size threshold, only documents larger than this threshold are stored on the NTFS file system via RBS FILESTREAM provider, and documents smaller than this threshold are still stored in the content database, you can do so in SharePoint 2010 Continue executing the following instruction in the Management shell (assuming a threshold value of 1048000 bytes, which is 1M):
(8) $rbss. Minimumblobstoragesize = 1048000 (9) $rbss. Update ()
The above instructions are for one contentof the database . If you have multiple content databases to enable RBS, perform the above instructions for each content database once.
6, check the final effect
After you have completed all of the above steps, upload some documents in the SharePoint site, and then check the NTFS folder that you set, which should contain some subfolders that store the documents.

Installing RBS FILESTREAM Provider in a SharePoint 2010 system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.