Walkthrough: Remote Database Server Deployment

This deployment walkthrough shows how to deploy an instance of Notification Services when the databases are located on a remote server. This deployment is more scalable than the single-server deployment, and is a good solution for medium to large applications.

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 illustration shows the hardware configuration for this deployment scenario. The scenario uses two servers: NS1 and SQL1. You install Notification Services on NS1 and the Database Engine on SQL1.

Remote-server configuration

NS1 runs the Notification Services engine components and has one or two disk drives; the number of drives is not critical on this server. SQL1 hosts the instance and application databases. SQL1 has multiple disk drives, one each for the database files, log files, tempdb, and the Database Engine, 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 and have applied all applicable service packs and updates.
  • You have previously installed Microsoft Windows and the 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.
  • You or your domain administrator has created or specified an account for Notification Services to use. For the purpose of these instructions, this account is called DOMAIN\NSService.
  • You have created any necessary file shares for source files and data files, and have granted the necessary permissions to your account and the DOMAIN\NSService account.
  • 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 on NS1, the server that runs the Notification Services engine:

  1. Install Notification Services.
  2. Grant Windows permissions to the NSService account.
  3. Create and enable the instance of Notification Services.
  4. Register the instance of Notification Services, which creates the Windows service that runs the Notification Services engine components.
  5. When you are ready to start generating notifications, start the instance of Notification Services.

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

Perform the following steps on server NS1 to create, register, and enable the instance of Notification Services.

Step 1: Install Software

  1. 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\NSService Account

  1. 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.

  2. Add the DOMAIN\NSService account to the local Users group. At the command prompt, type the following net localgroup command:

    net localgroup users DOMAIN\NSService /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

  1. At the command prompt, type 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.

  2. Type the following command to enable the instance:

    nscontrol enable -nameinstanceName-serverdatabaseServer

    The engine components are 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

  1. At the command prompt, type the following command:

    nscontrol register -nameinstanceName-serverdatabaseServer-service

        -serviceusername DOMAIN\NSService

        -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.

You have now completed the tasks on server NS1.

SQL1 Tasks

You must grant SQL Server and database permissions to the Notification Services engine. If you have the SQL Server workstation components installed on NS1, you could perform these steps on NS1.

Step 1: Grant SQL Server and Database Permissions

  1. Open a Command Prompt window.

  2. At the command prompt, type the following command to create a SQL Server login for the DOMAIN\NSService account:

    sqlcmd -E -SdatabaseServer-Q "CREATE LOGIN [DOMAIN\NSService] FROM WINDOWS;"

  3. Type the following command to grant the DOMAIN\NSService account access to the instance database and to add the account to the NSRunService database role:

    sqlcmd -E -SdatabaseServer-Q "USEinstanceDatabase**;**

    **    CREATE USER [DOMAIN\NSService];**

    **    EXEC sp_addrolemember N'NSRunService', N'DOMAIN\NSService';"**

  4. If you have separate application databases, type the following command to grant the DOMAIN\NSService account access to the application database and to add the account to the NSRunService database role:

    sqlcmd -E -SdatabaseServer-Q "USEapplicationDatabase**;**

    **    CREATE USER [DOMAIN\NSService];**

    **    EXEC sp_addrolemember N'NSRunService', N'DOMAIN\NSService';"**

    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 do 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 server NS1, open a Command Prompt window and type the following command:

**net start NS$**instanceName

For more information, see Starting and Stopping Instances of Notification Services.

Troubleshooting

If your application does not produce notifications, check the status of the instance by typing 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.

You can 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

Help and Information

Getting SQL Server 2005 Assistance