redis-diagnose-tool


Nameredis-diagnose-tool JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/tair-opensource/tair-tools/tree/main/redis-diagnose-tool
Summaryredis-diagnose-tool is a tool for diagnosing Redis/Tair client connection errors.
upload_time2024-09-02 02:55:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # redis-diagnose-tool
[![Python - Version](https://img.shields.io/badge/python-%3E%3D3.6-brightgreen)](https://www.python.org/doc/versions/)
[![PyPI - Version](https://img.shields.io/pypi/v/redis-diagnose-tool)](https://pypi.org/project/redis-diagnose-tool/)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)

`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](https://help.aliyun.com/zh/tair/developer-reference/in-house-commands-for-tair-instances-in-proxy-mode?spm=a2c4g.11174283.0.0.6484137doOGYo5) self-developed `IINFO` command and `RIINFO` command to detect the response rtt of the DB Server

<img src="https://github.com/tair-opensource/tair-tools/blob/main/redis-diagnose-tool/assets/diagnostic_process_en.png" width="35%" height="35%" />

****

## Installation

**Install from pip, requires Python 3.6 or higher**

```bash
# 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.



## 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](https://help.aliyun.com/zh/tair/developer-reference/openapi-sdk?spm=a2c4g.11186623.0.0.42447a9eQX2LVu) 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](https://help.aliyun.com/zh/ecs/developer-reference/api-reference-ecs/?spm=a2c4g.11186623.0.0.6ada2e55g69huQ) 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:**

```bash
# Installed from pip, you can run diag directly when the bin directory is added to the environment path

diag --help
```

run in basic mode

```bash
diag -h "connection_address" -p 6379 -u "user" -a "password"
```

run in advanced mode

```bash
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

```bash
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](https://github.com/tair-opensource/tair-tools/blob/main/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tair-opensource/tair-tools/tree/main/redis-diagnose-tool",
    "name": "redis-diagnose-tool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/cb/f3/eebf0b3421f08e98e00120fd6773003aa09d5cf49ca864b372a82cb1ad97/redis_diagnose_tool-0.1.2.tar.gz",
    "platform": null,
    "description": "# redis-diagnose-tool\n[![Python - Version](https://img.shields.io/badge/python-%3E%3D3.6-brightgreen)](https://www.python.org/doc/versions/)\n[![PyPI - Version](https://img.shields.io/pypi/v/redis-diagnose-tool)](https://pypi.org/project/redis-diagnose-tool/)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n\n`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.\n\n**This diagnostic tool is only applicable to clients connecting to Alibaba Cloud's Redis and Tair instances**\n\n**Process:**\n\n1. The client attempts to establish a TCP connection with the `Redis/Tair` instance\n2. 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\n3. Use the `INFO` command and Alibaba Cloud [proxy](https://help.aliyun.com/zh/tair/developer-reference/in-house-commands-for-tair-instances-in-proxy-mode?spm=a2c4g.11174283.0.0.6484137doOGYo5) self-developed `IINFO` command and `RIINFO` command to detect the response rtt of the DB Server\n\n<img src=\"https://github.com/tair-opensource/tair-tools/blob/main/redis-diagnose-tool/assets/diagnostic_process_en.png\" width=\"35%\" height=\"35%\" />\n\n****\n\n## Installation\n\n**Install from pip, requires Python 3.6 or higher**\n\n```bash\n# 1. Install from pypi\npip install redis-diagnose-tool\n\n# 2. Intall from source\ngit clone https://github.com/tair-opensource/tair-tools.git\ncd redis-diagnose-tool\npip install .\n```\n\nthe executable program `diag` will be installed in the bin directory of the Python interpreter. \n\nUse `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.\n\n\n\n## Usage\n\nThe tool supports basic mode and advanced mode.\n\nThe 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.\n\nIn advanced mode, you can use the [OpenAPI](https://help.aliyun.com/zh/tair/developer-reference/openapi-sdk?spm=a2c4g.11186623.0.0.42447a9eQX2LVu) 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](https://help.aliyun.com/zh/ecs/developer-reference/api-reference-ecs/?spm=a2c4g.11186623.0.0.6ada2e55g69huQ) 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.\n\nBoth basic mode and advanced mode support verifying user passwords and detecting the response of the DB Server inside the instance.\n\n**Arguments Description:**\n\n```\nRedis diagnose tool configuration\n\noptional arguments:\n  --help                        Help information\n  -c CONFIG, --config CONFIG    Configuration file path (YAML format). If the configuration file is specified, the command arguments won't work.\n\nTool options:\n  -A, --advanced                   Enable advanced mode, default off\n  -d, --detect_server              Detect server, default off\n  -l {zh,en}, --language {zh,en}   Language, zh for Chinese and en for English, default zh\n\nRedis instance connection information:\n  -h HOST, --host HOST                Connection hostname\n  -p PORT, --port PORT                Connection port, default 6379\n  -t TIMEOUT, --timeout TIMEOUT       Connection timeout, second, default 2s\n  -u USER, --user USER                Username\n  -a PASSWORD, --password PASSWORD    Password\n\nRedis instance information:\n  Following arguments should be specified in advanced mode. You only need to specify one of redis_region_id and redis_endpoint.\n\n  -r REDIS, --redis REDIS                                  Redis instance id\n  -g REDIS_REGION_ID, --redis_region_id REDIS_REGION_ID    Redis instance region id\n  -o REDIS_ENDPOINT, --redis_endpoint REDIS_ENDPOINT       Redis instance endpoint\n\nECS instance information:\n  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.\n\n  -e ECS, --ecs ECS                                  ECS instance id\n  -G ECS_REGION_ID, --ecs_region_id ECS_REGION_ID    ECS instance region id\n  -O ECS_ENDPOINT, --ecs_endpoint ECS_ENDPOINT       ECS instance endpoint\n\nSDK information:\n  Following arguments should be specified in advanced mode.\n\n  -k AK, --ak AK        Access key id\n  -s SK, --sk SK        Access key secret\n```\n\n**Usage Examples:**\n\n```bash\n# Installed from pip, you can run diag directly when the bin directory is added to the environment path\n\ndiag --help\n```\n\nrun in basic mode\n\n```bash\ndiag -h \"connection_address\" -p 6379 -u \"user\" -a \"password\"\n```\n\nrun in advanced mode\n\n```bash\ndiag -h \"connection_address\" -p 6379 -u \"user\" -a \"password\" -k \"ak\" -s \"sk\" -r \"redis_instance_id\" -g \"redis_region_id\" -A\n```\n\nUse argument template `arguments.yaml`\n\nIn 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\n\n```bash\ndiag --config \"arguments.yaml\"\n```\n\nIf the argument template is used, the command line arguments will be invalid.\n\n## Log Description\n\n- diagnose.log: diagnostic logs, which record the diagnostic process, detailed connection diagnostic reports, and DB Server diagnostic reports\n\n- sdk.log: record the call log of Open API, including interface, return value, and error\n- error.log: record exception information and exception throwing links\n\n## License\n\n[MIT](https://github.com/tair-opensource/tair-tools/blob/main/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "redis-diagnose-tool is a tool for diagnosing Redis/Tair client connection errors.",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/tair-opensource/tair-tools/tree/main/redis-diagnose-tool"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5aa3be027e0585760dde7955de1f1d76ac4102cd4af2ea88a98c374fe9d1dab4",
                "md5": "5c31f78f8a17101d98d273944c9bdeca",
                "sha256": "a043cc75f1742114f34ec1c84dd62985c77b444dcac3484085894685c68ef195"
            },
            "downloads": -1,
            "filename": "redis_diagnose_tool-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5c31f78f8a17101d98d273944c9bdeca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 37513,
            "upload_time": "2024-09-02T02:55:13",
            "upload_time_iso_8601": "2024-09-02T02:55:13.334377Z",
            "url": "https://files.pythonhosted.org/packages/5a/a3/be027e0585760dde7955de1f1d76ac4102cd4af2ea88a98c374fe9d1dab4/redis_diagnose_tool-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbf3eebf0b3421f08e98e00120fd6773003aa09d5cf49ca864b372a82cb1ad97",
                "md5": "c06ce1a8d0a7a058578a98536caae1a6",
                "sha256": "f5503b00d5f48f42379ba79b378879f3daae3f5098c1b7eb5986da2274523055"
            },
            "downloads": -1,
            "filename": "redis_diagnose_tool-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c06ce1a8d0a7a058578a98536caae1a6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 45465,
            "upload_time": "2024-09-02T02:55:15",
            "upload_time_iso_8601": "2024-09-02T02:55:15.678182Z",
            "url": "https://files.pythonhosted.org/packages/cb/f3/eebf0b3421f08e98e00120fd6773003aa09d5cf49ca864b372a82cb1ad97/redis_diagnose_tool-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-02 02:55:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tair-opensource",
    "github_project": "tair-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "redis-diagnose-tool"
}
        
Elapsed time: 0.46230s