Walkthrough: Scale-Out Deployment
This scenario shows how to deploy an instance of Notification Services on multiple servers. In this scenario, the databases are located on a remote server, and engine components are scaled out across three servers. This deployment scenario is for large applications that need multiple servers to efficiently format and distribute large numbers of notifications.
Note
All deployments of Notification Services are unique. Use the procedures in this topic as a guideline for developing and testing your own deployment instructions.
The following picture shows the hardware configuration for this deployment scenario. The scenario uses four servers: NS1, NS2, NS3 and SQL1. The Notification Services engine runs on servers NS1, NS2, and NS3; NS1 runs the event providers and generators and NS2 and NS3 run distributors. SQL1 hosts the instance and application databases.
NS1, NS2, and NS3 can use one or two disk drives; the number of drives is not critical on these servers. However, SQL1 has multiple disk drives, one each for the Database Engine, data files, log files, and tempdb, to improve the performance of the databases.
Prerequisites
Before you deploy an instance of Notification Services, verify that all prerequisites are met:
- You have previously installed the operating system on NS1, NS2, and NS3 and have applied all applicable service packs and updates.
- You have previously installed Microsoft Windows and Microsoft SQL Server 2005 Database Engine on SQL1 and have applied all applicable service packs and updates.
- You are running these procedures under an account that has administrative privileges on the server and is a member of the sysadmin fixed server role in SQL Server.
- You or your domain administrator has created an account for the Notification Services Windows services. For this walkthrough, the account is DOMAIN\NSEPGen for server NS1, where the hosted event providers and generators run, and DOMAIN\NSDist for servers NS2 and NS3, where the distributors run. Creating separate accounts allows more control over permissions.
- You have created any necessary file shares for event and notification data, and you have granted the necessary permissions to access these files to your account, to the DOMAIN\NSEPGen account for event pickup, and to the DOMAIN\NSDist account for notification distribution.
- TCP/IP or the named pipes network protocol is enabled on the Database Engine. In SQL Server 2005, these network protocols are disabled by default. For more information, see SQL Server Surface Area Configuration.
Deployment Overview
In this deployment walkthrough, you perform the following tasks on NS1, the server than runs the Notification Services engine:
- Install Notification Services.
- Grant Windows permissions to the NSEPGen account.
- Create and enable the instance of Notification Services.
- Register the instance of Notification Services, which creates the Windows service that runs the Notification Services engine components.
- Start the instance of Notification Services when you are ready to start generating notifications.
You perform the following tasks on NS2 and NS3, which run additional Notification Services engine components:
- Install Notification Services.
- Grant Windows permissions to the NSDist account.
- Register the instance of Notification Services, which creates the Windows service that runs the Notification Services engine components.
- tart the instance of Notification Services when you are ready to start generating notifications.
You perform the following on SQL1, the server that hosts the databases:
Grant database permissions to the Windows account.
Note
Notification Services also supports SQL Server Authentication. When possible, use Windows Authentication.
The instructions below use the Notification Services Command Prompt to show how you can script deployment. You can also deploy an instance of Notification Services using SQL Server Management Studio. For single-server deployment instructions that use SQL Server Management Studio, see SQL Server Notification Services Samples.
NS1 Tasks
Step 1: Install Software
Install Notification Services. You can install additional components, but they are not required for the steps in this walkthrough.
For more information about installing components, see Installing SQL Server Notification Services.
Step 2: Grant Windows Permissions to the DOMAIN\NSEPGen Account
On the Start menu, point to All Programs, point to Microsoft SQL Server 2005, point to Notification Services, and then click Notification Services Command Prompt to open a Notification Services command prompt window.
Add the DOMAIN\NSEPGen account to the local Users group. At the command prompt type the following net localgroup command:
net localgroup users DOMAIN\NSEPGen /add
For more information on adding accounts to a local group, see your Windows documentation.
Step 3: Create and Enable the Instance of Notification Services
At the command prompt, type the following command to create the instance and application databases:
nscontrol create -in "Path\ICFName"
Depending on the ICF, you might need to provide additional command prompt arguments and parameters.
Type the following command to enable the instance:
nscontrol enable -nameinstanceName-serverdatabaseServer
The engine components is in the Enable Pending state because the Notification Services engine has not been installed and started.
If you enable the instance after registering it, you can omit the -server argument.
Step 4: Register the Instance of Notification Services
In the open command prompt window, type the following command:
nscontrol register -nameinstanceName-serverdatabaseServer-service
-serviceusername DOMAIN\NSEPGen
-servicepassword"password"
When this command completes, a Windows service named NS$instanceName exists on the local computer.
Note
If you use SQL Server Authentication, you provide a SQL Server Authentication login and password when you register the instance, and then you grant permissions to this login.
Procedures for NS2 and NS3
NS2 and NS3 run the distributors in this scale-out scenario. On these servers, you must register the instance, which creates the Windows service. Before registering the instance, you must install Notification Services and grant Windows permissions to the service account.
Step 1: Install Software
Install Notification Services. You can install additional components, but they are not required for the steps in this walkthrough.
For more information about installing components, see Installing SQL Server Notification Services.
Step 2: Grant Windows Permissions to the DOMAIN\NSDist Account
On the Start menu, point to All Programs, point to Microsoft SQL Server 2005, point to Notification Services, and then click Notification Services Command Prompt to open a Notification Services Command Prompt window.
Add the DOMAIN\NSDist account to the local Users group. At the command prompt, type the following net localgroup command:
net localgroup users DOMAIN\NSDist /add
For more information on adding accounts to a local group, see your Windows documentation.
Step 3: Register the Instance of Notification Services
In the open Command Prompt window, type the following command:
nscontrol register -nameinstanceName-serverdatabaseServer-service
-serviceusername DOMAIN\NSDist
-servicepassword"[password]"
When this command completes, a Windows service named NS$instanceName exists on the local computer.
Note
If you use SQL Server Authentication, you provide a SQL Server Authentication login and password when you register the instance, and then you grant permissions to this login.
SQL1 Tasks
You must grant SQL Server and database permissions to the Notification Services engine. If you have workstation components installed on NS1, NS2, or NS3, you can perform this task on one of those servers, removing the need to log in to SQL1.
Grant SQL Server and Database Permissions
Open a Command Prompt window.
Type the following command to create SQL Server logins for the DOMAIN\NSEPGen and DOMAIN\NSDist accounts:
sqlcmd -E -S databaseServer -Q "CREATE LOGIN [DOMAIN\NSEPGen] FROM WINDOWS;"
sqlcmd -E -S databaseServer -Q "CREATE LOGIN [DOMAIN\NSDist] FROM WINDOWS;"
At the command prompt, type the following command to create DOMAIN\NSEPGen and DOMAIN\NSDist users in the instance database and add the DOMAIN\NSEPGen user to the NSEventProvider and NSGenerator database roles and the DOMAIN\NSDist user to the NSDistributor database role:
sqlcmd -E -SdatabaseServer-Q "USEinstanceDatabase;
** EXEC CREATE USER [DOMAIN\NSEPGen];**
** EXEC CREATE USER [DOMAIN\NSDist];**
** EXEC sp_addrolemember N'NSEventProvider', N'DOMAIN\DOMAIN\NSEPGen';"**
** EXEC sp_addrolemember N'NSGenerator', N'DOMAIN\DOMAIN\NSEPGen';"**
** EXEC sp_addrolemember N'NSDistributor', N'DOMAIN\DOMAIN\Dist';"**
If you have separate application databases, type the following command to create DOMAIN\NSEPGen and DOMAIN\NSDist users in the application database and add the DOMAIN\NSEPGen user to the NSEventProvider and NSGenerator database roles and the DOMAIN\NSDist user to the NSDistributor database role:
sqlcmd -E -S databaseServer -Q "USE applicationDatabase**;**
** EXEC CREATE USER [DOMAIN\NSEPGen];**
** EXEC CREATE USER [DOMAIN\NSDist];**
** EXEC sp_addrolemember N'NSEventProvider', N'DOMAIN\DOMAIN\NSEPGen';"**
** EXEC sp_addrolemember N'NSGenerator', N'DOMAIN\DOMAIN\NSEPGen';"**
** EXEC sp_addrolemember N'NSDistributor', N'DOMAIN\DOMAIN\Dist';"**
If the instance hosts multiple applications, repeat this step for each application database.
You have now deployed the instance of Notification Services. You should be able to load subscriber and subscription data and submit events to your applications. Notification Services does not process data until the Windows service is started. Starting the Windows service is discussed below.
Starting the Instance of Notification Services
When you are ready for the instance to start generating notifications, start the Windows service on all servers that run engine components. For this walkthrough, open a command prompt window on servers NS1, NS2, and NS3 and type the following command:
**net start NS$**instance_name
For more information, see Starting and Stopping Instances of Notification Services.
You can start all services at once by using SQL Server Management Studio. For more information, see How to: Start an Instance of Notification Services (SQL Server Management Studio).
Troubleshooting
If your application does not produce notifications, check the status of the instance by running the following command at the Notification Services command prompt:
nscontrol status-name instanceName
Verify that all components are running on the expected servers and are in the Enabled state. For more information, see Viewing the Status of Instances, Applications, and Components.
Also check the Windows Application log for errors. For more information, see Troubleshooting Notification Services.
See Also
Concepts
Deploying an Instance of Notification Services
Deploying a Non-Hosted Event Provider
Deploying a Subscription Management Interface
Other Resources
nscontrol create Command
nscontrol enable Command
nscontrol register Command
sqlcmd Utility