Skip to main content

This is a tool for diagnosing Redis/Tair client connection errors.

Reason this release was yanked:

unofficial version

Project description

redis-diagnose-tool

MIT licensed

English | 简体中文

redis-diagnose-tool is a tool for diagnosing Redis/Tair client connection errors and supports detecting the response rtt of the DB Server in the Redis/Tair instance.

This diagnostic tool is only applicable to clients connecting to Alibaba Cloud's Redis and Tair instances

Process:

  1. The client attempts to establish a TCP connection with the Redis/Tair instance
  2. Execute the AUTH command to verify the username and password. If no password is specified, execute the PING command to verify whether the password-free function is enabled
  3. Use the INFO command and Alibaba Cloud proxy self-developed IINFO command and RIINFO command to detect the response rtt of the DB Server

Installation

Install from pip, requires Python 3.6 or higher

# 1. Install from pypi
pip install redis-diagnose-tool

# 2. Intall from source
git clone https://github.com/tair-opensource/tair-tools.git
cd redis-diagnose-tool
pip install .

the executable program diag will be installed in the bin directory of the Python interpreter.

Use pip show redis-diagnose-tool to find the installation path of the redis-diagnose-tool package. The argument template arguments.yaml is stored in the diagnose directory under the installation path.

Install from yum, requires Alibaba mirror source

sudo yum install redis-diagnose-tool -b current

There will be an executable program arguments.yaml and an argument template arguments.yaml in the path /opt/redis-diagnose-tool-{version} .

Usage

The tool supports basic mode and advanced mode.

The basic mode can only detect whether the client can establish a TCP connection with the Redis/Tair instance and give an error message if the connection fails.

In advanced mode, you can use the OpenAPI of Redis/Tair to obtain basic information, network information, whitelist, and other information about the instance. If the client is on ECS, it can also use the ECS OpenAPI to obtain information about the ECS instance. Therefore, advanced mode can diagnose specific problems that cause connection failures, including incorrect connection information, connecting to the instance through the instance's intranet address in a public network environment, incorrect configuration of the whitelist or instance security group, and ECS security group interception.

Both basic mode and advanced mode support verifying user passwords and detecting the response of the DB Server inside the instance.

Arguments Description:

Redis diagnose tool configuration

optional arguments:
  --help                        Help information
  -c CONFIG, --config CONFIG    Configuration file path (YAML format). If the configuration file is specified, the command arguments won't work.

Tool options:
  -A, --advanced                   Enable advanced mode, default off
  -d, --detect_server              Detect server, default off
  -l {zh,en}, --language {zh,en}   Language, zh for Chinese and en for English, default zh

Redis instance connection information:
  -h HOST, --host HOST                Connection hostname
  -p PORT, --port PORT                Connection port, default 6379
  -t TIMEOUT, --timeout TIMEOUT       Connection timeout, second, default 2s
  -u USER, --user USER                Username
  -a PASSWORD, --password PASSWORD    Password

Redis instance information:
  Following arguments should be specified in advanced mode. You only need to specify one of redis_region_id and redis_endpoint.

  -r REDIS, --redis REDIS                                  Redis instance id
  -g REDIS_REGION_ID, --redis_region_id REDIS_REGION_ID    Redis instance region id
  -o REDIS_ENDPOINT, --redis_endpoint REDIS_ENDPOINT       Redis instance endpoint

ECS instance information:
  Following arguments should be specified in advanced mode if the client is on ECS. You only need to specify one of ecs_region_id and ecs_endpoint.

  -e ECS, --ecs ECS                                  ECS instance id
  -G ECS_REGION_ID, --ecs_region_id ECS_REGION_ID    ECS instance region id
  -O ECS_ENDPOINT, --ecs_endpoint ECS_ENDPOINT       ECS instance endpoint

SDK information:
  Following arguments should be specified in advanced mode.

  -k AK, --ak AK        Access key id
  -s SK, --sk SK        Access key secret

Usage Examples:

# 1. Installed from pip, you can run diag directly when the bin directory is added to the environment path
diag --help

# 2. Installed from yum
cd /opt/redis-diagnose-tool-{version}
./diag --help

run in basic mode

cd /opt/redis-diagnose-tool-{version}
./diag -h "connection_address" -p 6379 -u "user" -a "password"

run in advanced mode

cd /opt/redis-diagnose-tool-{version}
./diag -h "connection_address" -p 6379 -u "user" -a "password" -k "ak" -s "sk" -r "redis_instance_id" -g "redis_region_id" -A

Use argument template arguments.yaml

In advanced mode, you need to set multiple optional arguments in the command line, which is cumbersome and error-prone, so an argument template is provided

cd /opt/redis-diagnose-tool-{version}
./diag --config "arguments.yaml"

If the argument template is used, the command line arguments will be invalid.

Log Description

  • diagnose.log: diagnostic logs, which record the diagnostic process, detailed connection diagnostic reports, and DB Server diagnostic reports

  • sdk.log: record the call log of Open API, including interface, return value, and error

  • error.log: record exception information and exception throwing links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redis-diagnose-tool-0.0.1.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

redis_diagnose_tool-0.0.1-py3-none-any.whl (38.1 kB view details)

Uploaded Python 3

File details

Details for the file redis-diagnose-tool-0.0.1.tar.gz.

File metadata

  • Download URL: redis-diagnose-tool-0.0.1.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13

File hashes

Hashes for redis-diagnose-tool-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c72442baab6c48159eb5370eb48f5ee23e37363fe79ecac35ad2be878866850f
MD5 bce1984e53e9615734c2f67c765a7f3e
BLAKE2b-256 ad89ac4ddfe0cdfc9e00b0fc6822d4326e8b8aa80634502e248fe436c9c1cf9b

See more details on using hashes here.

File details

Details for the file redis_diagnose_tool-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: redis_diagnose_tool-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 38.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13

File hashes

Hashes for redis_diagnose_tool-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf1467e92c36594070525c7668de3aebdc5359ddfdcd3ef69dcd7ac7c3b9d72
MD5 197640b6a68a5c64a2ae5024d5fad103
BLAKE2b-256 62cd076e02f406d2adc9589f1901fb126cf176a4fb271c2f673d5c84e6bf151a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page