Skip to content

Commit

Permalink
Update Readmefile🎨, handle if there is no sdtdin 🐛,, Update Setup.py 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
alivx committed Dec 26, 2020
1 parent 5aea82b commit 0510ffb
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
Binary file added Generator/redis-mirror-logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Mirror Redis Traffic to another redis node
<img src="https://raw.githubusercontent.com/alivx/redis-mirror/master/Generator/redis-mirror-logo.jpg" alt="logo" style="zoom:50%;" />


# redis-mirror
Realtime Redis Traffic Mirror to another instance, this script read the STDOUT from `redis-cli monitor` command and mirror keys to another instance.
Expand All @@ -9,6 +11,7 @@ In some production/development cases, you need to mirror Redis traffic to anothe
* For now, this script support `set`,`hset` I will add the other command soon, or if you have a time, please create a pull request :).



## TO DO:
1. Add the most common redis command to mirror script.
2. Add TTL as an option in mirrored redis instance, plus add an option to expand the origin `TTL`.
Expand All @@ -22,6 +25,28 @@ In some production/development cases, you need to mirror Redis traffic to anothe
redis-cli monitor | python redismirror.py
```

## Exmaple output:
```
$redis-cli monitor | redismirror run
Init connection redis..
Skip line | OK
Key mirroed sucessfully | 05439891-2f59-45c3-931d-4918d3aaf121_1_uuid_ran
Key mirroed sucessfully | 05439891-2f59-45c3-931d-4918d3aaf121_1_date_ran
Key mirroed sucessfully | 05439891-2f59-45c3-931d-4918d3aaf121_1_date2_ran
Key mirroed sucessfully | 05439891-2f59-45c3-931d-4918d3aaf121_1_json_ran
Key mirroed sucessfully | 05439891-2f59-45c3-931d-4918d3aaf121_1_image_ran
Key mirroed sucessfully | 1609021903_1_uuid_ran
Key mirroed sucessfully | 1609021903_1_date_ran
Key mirroed sucessfully | 1609021903_1_date2_ran
Key mirroed sucessfully | 1609021903_1_json_ran
Key mirroed sucessfully | 1609021903_1_image_ran
```

## Installation using pypi
```
pip install redismirror
```

## Installation

Expand Down
5 changes: 4 additions & 1 deletion redismirror/controllers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def hsetFunc(rLine, connection):
def getSTDOUT(connection):
if not sys.stdin.isatty():
input_stream = sys.stdin
else:
print("There is no stdin, check help for more info. exit 1")
sys.exit(1)
for line in input_stream:
try:
tmpLine = line.split(" ", 5)
Expand All @@ -68,7 +71,7 @@ class Meta:
description = "Mirror Redis Traffic to another redis node"

# text displayed at the bottom of --help output
epilog = "Usage: redismirror run"
epilog = "Usage: redis-cli monitor | redismirror run"

# controller level arguments. ex: 'redismirror --version'
arguments = [
Expand Down
2 changes: 1 addition & 1 deletion redismirror/core/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from cement.utils.version import get_version as cement_get_version

VERSION = (0, 0, 2, 'alpha', 0)
VERSION = (0, 0, 13, 'final', 0)

def get_version(version=VERSION):
return cement_get_version(version)
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
LONG_DESCRIPTION = f.read()
f.close()

requirements = (
["cement==3.0.4", "redis==3.5.3", "redis-py-cluster==2.1.0", "jinja2", "colorlog"],
)
with open('requirements.txt') as f:
requirements = f.read().splitlines()


setup(
name="redismirror",
version=VERSION,
description="Mirror Redis Traffic to another redis node",
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
install_requires=requirements,
setup_requires=requirements,
author="Ali Saleh Baker",
author_email="[email protected]",
url="https://github.com/alivx/redis-mirror",
Expand Down

0 comments on commit 0510ffb

Please sign in to comment.