{ "info": { "author": "Anton Aleksandrov", "author_email": "antonaleksandrov24@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Tool for Redis Cluster administration.\n## Description\nThis tool is a Python CLI built on the top of [redis-cli](https://redis.io/topics/rediscli).\nThe reason this tool was made is that some automation features are missing in redis-cli. \nFor example, to reshard a Redis cluster, a user has to manually move slots from one node to another.\nMoreover, it is not possible to add more than one node to a Redis cluster once in a time.\n\nPossibly those features will be added natively to redis-cli in [a near future](https://github.com/antirez/redis/issues/4052).\n### Data sharding\n\nGenerally, there are 16383 [hash slots](https://stackoverflow.com/questions/48314328/what-do-we-mean-by-hash-slot-in-redis-cluster) in one Redis cluster instance.\nTherefore, upon starting a Redis cluster with 3 masters and 3 slaves you will have:\n- Master 1 contains hash slots from 0 to 5500. Slave 1 replicates Master 1\n- Master 2 contains hash slots from 5501 to 11000. Slave 2 replicates Master 2\n- Master 2 contains hash slots from 11001 to 16383. Slave 3 replicates Master 3\n\nAs you can see, Redis Cluster strives to keep an equal amount of hash slots on each master.\nThe concept of hash slots, allows easily add and remove master nodes.\nThe only catch here, you have to do resharding of your cluster each time amount of masters changes.\nOne option to do it [manually](https://redis.io/topics/cluster-tutorial).\nAnother one is to use my python CLI.\n\nIt works as following:\n - Define master nodes that contain has slots\n - Define \"empty\" master nodes - ones that contain no hash slots\n - Calculate how many slots can be moved from each master with slots\n - Perform `redis-cli --cluster reshard ` for each master with slots. This command will transfer slots to an \"empty\" master.\n - Check if all hash slots have been covered\n \n \nIn this image you can see the way hash slots will be distributed:\n\n![Hash slots distribution](https://github.com/AntonAleksandrov13/python-redis-tool/blob/master/docs/sharding.png)\n\n#### Pros/cons\nPros\n- Executed in a single command.\n- Done via redis-cli.\n- Zero downtime. A client is still able to wrote to a Redis cluster while resharding is done.\n\nCons\n- Processing time grows linearly depending on amount of master nodes.\n\n\n### Adding multiple nodes \nIn my opinion, scaling up is never done by adding one master of one slave node to a Redis Cluster.\nTherefore, another feature in my CLI is to add multiple nodes with a certain role at once.\n\nA user can define in which mode certain nodes will be launched using `--role` argument with `add_node`.\nYou don`t have to worry to which master a slave will be assigned. redis-cli finds master with the least amount slaves itself.\n\n## tl;dr\nThis CLI is just a wrapper for redis-cli with two key features: adding nodes and resharding a Redis cluster.\n\n### Resharding \nResharding is done by `python redis-tool.py -s SOURCE_NODE_ADDRESS reshard`.\n`SOURCE_NODE_ADDRESS` - One of the nodes from the Redis cluster. It will be used as an entrypoint to all cluster operations.\n`reshard` command requires at least one \"empty\" master. Otherwise, it will not work.\n\n### Adding multiple nodes\nAdding multiple node is done by `python redis-tool.py -s SOURCE_NODE_ADDRESS add_node --role{master,slave} --target`.\n`SOURCE_NODE_ADDRESS` - One of the nodes from the Redis cluster. `TARGET_NODE_ADDRESS` - Address of the node you would like to add to the cluster.\nYou can provide more than one `TARGET_NODE_ADDRESS`.\n\n# Sum up\nThis tool does not aims to replace redis-cli. It only tries to supplement redis-cli functionality.\n\nIn order to get more information about how to use this tool, please use `python redis-tool.py -h`.\nIf you want to have more information about a specific command run `python redis-tool.py add_node|reshard -h`.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/AntonAleksandrov13/python-redis-tool.git", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "redis-cluster-tools", "package_url": "https://pypi.org/project/redis-cluster-tools/", "platform": "", "project_url": "https://pypi.org/project/redis-cluster-tools/", "project_urls": { "Homepage": "https://github.com/AntonAleksandrov13/python-redis-tool.git" }, "release_url": "https://pypi.org/project/redis-cluster-tools/1/", "requires_dist": null, "requires_python": "", "summary": "A small example package", "version": "1" }, "last_serial": 4528815, "releases": { "1": [ { "comment_text": "", "digests": { "md5": "7085d70124c2b7e0d265f997ee0d594b", "sha256": "7dc965a245d4e2a78cd908abc09acde4a7cfef678e1b7ee0d5635b4aaa045b99" }, "downloads": -1, "filename": "redis-cluster-tools-1.tar.gz", "has_sig": false, "md5_digest": "7085d70124c2b7e0d265f997ee0d594b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6386, "upload_time": "2018-11-26T08:57:08", "url": "https://files.pythonhosted.org/packages/25/60/d7154791c456c28a6a3db6341be69c62bbad3754bf978ff9301377698f43/redis-cluster-tools-1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7085d70124c2b7e0d265f997ee0d594b", "sha256": "7dc965a245d4e2a78cd908abc09acde4a7cfef678e1b7ee0d5635b4aaa045b99" }, "downloads": -1, "filename": "redis-cluster-tools-1.tar.gz", "has_sig": false, "md5_digest": "7085d70124c2b7e0d265f997ee0d594b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6386, "upload_time": "2018-11-26T08:57:08", "url": "https://files.pythonhosted.org/packages/25/60/d7154791c456c28a6a3db6341be69c62bbad3754bf978ff9301377698f43/redis-cluster-tools-1.tar.gz" } ] }