Redis Connection Test icon

Redis Connection Test

Test Redis connection and credentials

Overview

This node tests the connection and functionality of a Redis server using various methods. It is useful for verifying that your Redis credentials and server are correctly configured and operational before running more complex workflows that depend on Redis.

Common scenarios include:

  • Checking basic connectivity to a Redis instance.
  • Verifying read/write operations to ensure data can be stored and retrieved.
  • Retrieving server information such as version, mode, and uptime.
  • Running a comprehensive test that combines all above checks.

Practical examples:

  • Before deploying a workflow that caches data in Redis, use this node to confirm the Redis server is reachable and working.
  • Troubleshoot connection issues by running individual tests like "Basic Connection" or "Read/Write Test".
  • Monitor Redis server details periodically by retrieving server info.

Properties

Name Meaning
Test Type Selects the type of test to perform:
- Basic Connection: Tests basic Redis connection with PING command.
- Read/Write Test: Tests read/write operations using SET, GET, and DEL commands.
- Server Info: Retrieves Redis server information such as version, mode, OS, process ID, etc.
- Complete Test: Runs all the above tests sequentially.

Output

The node outputs a JSON object containing detailed results of the selected test(s). The structure includes:

  • timestamp: ISO string of when the test was run.
  • connectionType: Type of connection used (e.g., connection string or host/port).
  • connectionDetails: Summary of connection details (masked connection string or host:port).
  • testType: The selected test type.
  • tests: An object with keys corresponding to each test performed (basic, readwrite, serverInfo), each containing:
    • status: "success" or "error".
    • message: A human-readable message indicating success or failure.
    • Additional fields depending on the test:
      • For basic: result (response from PING), responseTime (duration in ms).
      • For readwrite: operations showing results of SET, GET, DEL commands.
      • For serverInfo: info object with Redis server details like version, mode, OS, process ID, TCP port, uptime.
  • overallStatus: "success" if all tests passed, "partial_success" if some failed.
  • summary: A summary message reflecting overall test results.

No binary data output is produced by this node.

Example output snippet:

{
  "timestamp": "2024-06-01T12:00:00.000Z",
  "connectionType": "connectionString",
  "connectionDetails": "redis://user:***@host:6379",
  "testType": "complete",
  "tests": {
    "basic": {
      "status": "success",
      "result": "PONG",
      "responseTime": "15ms",
      "message": "✅ Basic connection successful"
    },
    "readwrite": {
      "status": "success",
      "operations": {
        "set": "OK",
        "get": "connection_test_value",
        "delete": 1
      },
      "message": "✅ Read/Write operations successful"
    },
    "serverInfo": {
      "status": "success",
      "info": {
        "redis_version": "7.0.5",
        "redis_mode": "standalone",
        "os": "Linux 5.10.0-21-amd64 x86_64",
        "process_id": "12345",
        "tcp_port": "6379",
        "uptime_in_seconds": "3600"
      },
      "message": "✅ Server info retrieved successfully"
    }
  },
  "overallStatus": "success",
  "summary": "✅ All tests passed successfully"
}

Dependencies

  • Requires a valid Redis server connection.
  • Needs an API key credential or equivalent authentication configured in n8n to connect to Redis.
  • Uses the ioredis library internally for Redis communication.
  • No additional environment variables are required beyond the Redis credentials.

Troubleshooting

Common Issues

  • Connection refused: Redis server is not running or unreachable at the specified host/port.
  • Host not found: Incorrect hostname or IP address.
  • Connection timeout: Network issues or firewall blocking access.
  • Authentication errors: Missing or incorrect password for Redis.
  • Value mismatch in read/write test: Indicates possible permission or data consistency issues.

Error Messages and Resolutions

  • "Failed to connect to Redis: ...": Check Redis server status, network connectivity, and credentials.
  • "PING timeout": Redis server may be overloaded or network latency is high; try increasing timeout or checking server health.
  • "Value mismatch: SET/GET failed": Verify that Redis allows write operations and no data corruption occurs.
  • "Redis connection test failed: Connection refused.": Ensure Redis service is running and accessible.
  • "Redis connection test failed: Host not found.": Confirm DNS resolution or IP address correctness.
  • "Redis connection test failed: Authentication required.": Provide correct password in credentials.
  • "Redis connection test failed: Invalid password.": Double-check password accuracy.

Links and References

Discussion