Updated on 2024-09-24 GMT+08:00

Using Auto Flow Control

Auto flow control allows you to auto kill sessions, including killing all sessions and killing specific sessions by criteria. Additionally, you can view killed sessions, making it easier to manage sessions.

To kill the current session or manually kill a session, see Managing Real-Time Sessions.

Functions

  • Killing all sessions: After this function is triggered, all sessions are automatically deleted.
  • Killing specific sessions by criteria: You can add a kill task. Sessions that meet the criteria will be killed.
  • Viewing history: You can view killed sessions.

Killing Specific Sessions by Criteria

  1. Log in to the management console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner of the page and choose Databases > GaussDB(for MySQL).
  4. On the Instances page, click the instance name.
  5. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  6. Click SQL Explorer and then Auto Flow Control.
  7. Click on the right of Auto Kill Sessions. In the displayed dialog box, click OK.

    Figure 1 Auto Kill Sessions

  8. Click Add Kill Task.

    Figure 2 Add Kill Task

  9. In the displayed dialog box, set the criteria for killing sessions.

    Figure 3 Setting the criteria for killing sessions

    • The parameters listed in Table 1 are in a logical AND relationship.
    • If you only specify Session Duration and Task Duration, all sessions that meet the criteria will be killed.
    • A maximum of five conditional kill tasks can be executed at the same time.
    Table 1 Parameter description

    Parameter

    Description

    User

    Enter a single value, for example, root.

    Host IP Address

    Enter a single value, for example, 168.192.0.0.

    Database Name

    Enter a database name.

    Command

    Enter a command.

    SQL Statement

    Enter an SQL statement.

    Session Duration

    The value ranges from 1 to 2147483647, in seconds.

    Task Closure Method

    If you select Scheduled, you need to set Task Duration. After the duration ends, the task is automatically closed.

    If you select Manual, you can click Stop in the Operation column of the task list to manually close a task after it is created.

    Task Duration

    The value ranges from 10 to 31535999, in seconds.

  10. Click OK.

    When the criteria for killing sessions are met, the system automatically kills the sessions.

Killing All Sessions

  1. On the Instances page, click the instance name.
  2. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  3. Click SQL Explorer and then Auto Flow Control.
  4. Click on the right of Auto Kill Sessions. In the displayed dialog box, click OK.

    Figure 4 Auto Kill Sessions

  5. Click Kill All Sessions.

    Figure 5 Kill All Sessions

  6. In the displayed dialog box, click OK.

Viewing History

  1. On the Instances page, click the instance name.
  2. In the navigation pane, choose DBA Assistant > Historical Diagnosis.
  3. Click SQL Explorer and then Auto Flow Control.
  4. Click on the right of Auto Kill Sessions. In the displayed dialog box, click OK.

    Figure 6 Auto Kill Sessions

  5. Click View History.

    Figure 7 Viewing killed sessions

  6. In the displayed dialog box, select a time range to view killed sessions within that period.

    Figure 8 Viewing killed sessions

    A maximum of 500 records can be displayed.