Monitoring Redis instances

This page describes how to monitor your Cloud Memorystore for Redis instance's performance.

Monitoring allows you to check in on your instances to make sure they're behaving as desired. This guide covers a few basic examples of monitoring Redis instances. In addition to the types of monitoring covered here, Cloud Memorystore for Redis is compatible with open source Redis, so you can use existing Redis monitoring tools from Compute Engine VMs to monitor your instances.

Monitoring instances in the Google Cloud Platform Console

To view an instance's core metrics:

  1. Go to the Cloud Memorystore page in the Google Cloud Platform Console.
    Cloud Memorystore
  2. Click the Instance ID of the instance you'd like to view.

You can monitor several metrics by visiting an instance's Instance details page in the Google Cloud Platform Console. By default, the graph shows the instance's current memory usage and its max capacity. Other metrics available in the GCP Console are: evicted keys/expired keys, instance uptime, connected clients/blocked clients, and network bytes in/out.

To change the metrics shown on the graph, use the dropdown in its upper left corner. To change the time frame, select a different period of time in the upper right corner of the graph.

Monitoring instances with Stackdriver

Stackdriver is a monitoring service that lets you to view metrics such as uptime for your Redis instances. For more details about all Cloud Memorystore for Redis metrics available from Stackdriver, see the Stackdriver reference documentation.

Signing up for Stackdriver

If you're not using Stackdriver, sign up with your Google Cloud Platform account by navigating to Stackdriver.

  1. Click Log in with Google.
  2. Select the project that contains your Redis instances and then click Create Workspace.

    image

  3. Skip the step for installing the Stackdriver agents; they come pre-installed on Cloud Memorystore for Redis instances. Click Continue.

  4. Click Launch monitoring once the initial collection of data is finished.

For pricing information, see Stackdriver Pricing.

Setup of your Workspace is now complete.

Viewing instance uptime, restart, and failover information in Stackdriver

  1. To view instance uptime information in Stackdriver, go to the Metrics Explorer.
    Metrics Explorer

  2. If prompted, log in, then navigate to the project with your Redis instances. Click the button again to be taken directly to Redis's uptime metrics. You can also navigate to the uptime metrics by clicking Resources > Metrics Explorer and then selecting redis_instance as the resource type and redis/server/uptime as the metric.

Your graph looks something like this:

Graph of instance uptime

  • Each line indicates a single instance.
  • Up and to the right indicates Redis is up.
  • A drop off indicates a restart.
  • Missing data indicates unavailability.
  • Below your graph, there's a color-coded key that indicates which line belongs to which instance. As you hover over the key, the corresponding line on the graph is highlighted.

For Standard Tier instances, there will be two entries with the same name but different colors in the key below the graph. The master instance is the line with the highest uptime. You can identify a failover by looking for a spot on the graph where the master instance's line drops off to zero and the replica's line continues to rise, indicating it has become the new master instance.

You can change the time horizon in the upper-right hand corner as well as add filters to tailor the information you're seeing to a particular region, project, instance, or replica.

Viewing operations per second

  1. To view an instance's operations per second in Stackdriver, go to the Metrics Explorer.
    Metrics Explorer

    If prompted, log in and navigate to the project with your Redis instances. You can then click the link again to be taken directly to the operations per second metric or you can navigate to the metric directly:

  2. Click Resources > Metric Explorer.

  3. Select Redis instance as the resource type.

  4. Select Calls as the desired metric.

  5. Choose Sum from the aggregation drop-down menu.

Calls is a metric surfaced by Cloud Memorystore for Redis that mimics the Redis instantaneous_ops_per_sec metric when you set the aggregation to sum.

Monitoring your instance's memory usage

You can monitor how much available memory you have in your Redis instance with a Stackdriver dashboard. You can also set a Stackdriver alert to notify you when your Redis memory reaches a customizable threshold.

Creating a dashboard to monitor Redis memory usage

  1. Go to the Stackdriver Create Dashboard page:
    Create Dashboard

  2. Click Add Chart.

    1. Provide a name for the chart. For example, "Redis Memory Usage".

    2. In the search box labeled Find resource type and metric, search for "Cloud Memorystore Redis Instance", and select it.

      1. Enter Maximum Memory as the metric type.
        1. In the Filter box, add a filter for instance_id and select the instance you want to monitor.
        2. If you want to monitor the usage of all the Cloud Memorystore instances in your project, use "Group by" and select instance_id.
        3. Under Aggregation, set the Aligner and Reducer to Max.
    3. Click Add Metric, search for "Used Memory", and select it.

      1. In the Filter box, add a filter for instance_id and select the instance you want to monitor.
      2. If you want to monitor the usage of all the Cloud Memorystore instances in your project, use Group by and select instance_id.
      3. Under Aggregation, set the Aligner and Reducer to Max.
  3. Click Save. You can access this dashboard from the menu by hovering over Dashboards.

Setting a Stackdriver alert for memory usage

You can set an alert in Stackdriver to notify you if the Used Memory metric exceeds a threshold that you set. To create an alert for the Used Memory metric, follow these steps:

  1. Go to the Create New Alerting Policy page in Stackdriver:
    Create Policy
  2. Add a condition for Used Memory threshold:
    1. Click Add Condition.
    2. Provide a name for the condition, for example "Used Memory Alert".
    3. Under Target, select Cloud Memorystore Redis instance resource type.
      1. For the Metric, select "Used Memory".
    4. Under Configuration, choose Any time the series violates.
    5. Set Condition to Is above.
    6. Set Threshold to the equivalent, in bytes, of 50% of your instance size.
      1. When your memory usage exceeds 50%, you should regularly monitor your memory usage and consider scaling up the instance if your memory usage rises dramatically.
    7. Set For to 1 minute initially to understand the usage pattern; you can increase this threshold to a higher number as the usage stabilizes.
    8. Click Save.
  3. Set the appropriate notification channel.
  4. Name the policy (for example "Redis memory usage alert")
  5. click Save.

You are now notified anytime the threshold is violated.

Verifying configuration changes

If you change the configuration of your Redis instance, you can verify that the change has taken place:

  • View the instance's configuration by going to the Cloud Memorystore page in the GCP Console.
    Cloud Memorystore

    Click the name of the instance, then click Show advanced options to see its configurations.

    image

  • View the instance's configuration information by entering the gcloud describe command:

    gcloud redis instances describe INSTANCE_ID --region=REGION_ID

  • View all Redis configuration information using the redis-cli tool within your network. Create a Compute Engine VM in the same region, then select a Docker image, such as gcr.io/containers/busybox:

    image

    After your VM is ready, SSH to it. Then, enter the following command to view Redis configuration information, replacing HOST-IP with the IP address of your Redis instance:

    docker run -ti redis /usr/local/bin/redis-cli -h HOST-IP info

    You can use grep to filter the results.

Viewing Redis logs

Redis produces logs that Stackdriver Logging captures.

Viewing audit logs

  1. Go to the Logs Viewer page in the GCP Console.

    Logs Viewer

  2. To view the audit logs, select Audited Resource > redis.googleapis.com from the resources drop-down, as shown below:

    Logs viewer screen shot

Viewing activity logs

  1. Go to the Logs Viewer page in the GCP Console.

    Logs Viewer

  2. To view the activity logs, select Cloud Memorystore Redis instance from the resources drop-down.

Kunde den här sidan hjälpa dig? Berätta:

Skicka feedback om ...

Google Cloud Memorystore for Redis