All Products
Search
Document Center

Database Autonomy Service:Session management

Last Updated:Jul 09, 2024

When performance issues or operation exceptions occur on a database, you can troubleshoot the issues or exceptions based on the session information about the database. Database Autonomy Service (DAS) provides the session management feature that allows you to view real-time session statistics about your database instance. You can also perform O&M operations such as exporting session statistics and terminating sessions on your database instance.

Prerequisites

The database instance is connected to DAS and is in the Normal Access state.

Limits

To monitor the performance of an ApsaraDB for MongoDB standalone instance, you must grant the required permissions to the database account of the instance. To do so, perform the following steps:

  1. Create an account in the ApsaraDB for MongoDB instance and grant permissions to the account.

    1. Connect to the ApsaraDB for MongoDB instance. For more information, see Connect to an ApsaraDB for MongoDB instance.

    2. Run the following commands to create an account for the admin database and grant permissions to the account:

      use admin;
      db.createUser({user:'das_test',pwd:'password',roles:[{role:'readAnyDatabase', db:'admin'}, {role:'clusterMonitor', db:'admin'}, {role: 'hostManager', db: 'admin'},{db: 'local', role: 'dbAdmin'},{db: 'config', role: 'dbAdmin'},{db: 'admin', role: 'dbAdminAnyDatabase'}]});
      Note

      In this example, the username das_test and the password password are used. Replace the username and password based on your business requirements.

  2. Authorize the account in DAS.

    1. Log on to the DAS console.

    2. In the left-side navigation pane, click Instance Monitoring.

    3. On the Instance Monitoring page, find the database instance that you want to monitor and choose Actions > Authorization in the Actions column.

      image

    4. In the Authorization dialog box, configure the Database Account and Password parameters and click Authorize.

    5. After the Access Status column displays Connected, click OK.

Procedure

  1. Log on to the DAS console.

  2. In the left-side navigation pane, click Instance Monitoring.

  3. On the page that appears, find the database instance that you want to manage and click the instance ID. The instance details page appears.

  4. In the left-side navigation pane, click Instance Sessions.

  5. On the Instance Sessions page, you can perform the following operations in the Instance Sessions, Session Statistics, and Connections sections:

    • Terminate sessions.

    • View summary information and session statistics by client and namespace. The summary information includes the total number of sessions, the number of active sessions, the longest session duration, the number of sessions longer than 3 seconds, and queries that do not use indexes.

    • Export summary information and session statistics by client and namespace.

    • View connection statistics, such as the total number of connections and the number of active connections.