Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复修复fix redis cluster异常问题 #2748

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mysql-replication==0.22
django-q==1.3.9
django-redis==5.2.0
redis==3.5.3
redis-py-cluster==2.1.3
pyodbc==4.*
gunicorn==22.0.0
pyecharts==2.0.4
Expand Down
10 changes: 4 additions & 6 deletions sql/engines/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import shlex

import redis
import rediscluster
import logging
import traceback

Expand All @@ -27,15 +28,12 @@ class RedisEngine(EngineBase):
def get_connection(self, db_name=None):
db_name = db_name or self.db_name
if self.mode == "cluster":
return redis.cluster.RedisCluster(
host=self.host,
port=self.port,
username=self.user,
password=self.password or None,
encoding_errors="ignore",
return rediscluster.RedisCluster(
startup_nodes=[{"host": self.host, "port": self.port}],
decode_responses=True,
socket_connect_timeout=10,
ssl=self.is_ssl,
password=self.password,
)
else:
return redis.Redis(
Expand Down
1 change: 0 additions & 1 deletion src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RUN apt-get update \
&& apt-get install -yq --no-install-recommends nginx mariadb-client \
&& source venv4archery/bin/activate \
&& pip install -r /opt/archery/requirements.txt \
&& pip install "redis>=4.1.0" \
&& cp -f /opt/archery/src/docker/nginx.conf /etc/nginx/ \
&& cp -f /opt/archery/src/docker/supervisord.conf /etc/ \
&& mv /opt/sqladvisor /opt/archery/src/plugins/ \
Expand Down
Loading