-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
RedisLockStore support for cluster mode #6227
Comments
Exalate commented: akelad commented: from @rgstephens:
for now i think the user that's having this issue has found a workaround, so let's postpone for now |
Exalate commented: sahajvss commented: Is there a workaround for this issue? |
Exalate commented: sahajvss commented: @wochinge Can you share the workaround you used to make the Redislockstore work in cluster mode? |
Exalate commented: mitallast commented: My solution: requirements.txt redis-py-cluster==2.1.2 cluster_lock_store.py import logging import json from typing import Text, Optional from rasa.core.lock import TicketLock from rasa.core.lock_store import LockStore from rasa.utils.endpoints import EndpointConfig from rediscluster import RedisCluster logger = logging.getLogger(__name__) class RedisClusterLockStore(LockStore): def __init__(self, endpoint_config: EndpointConfig) -> None: self.startup_nodes = endpoint_config.kwargs['startup_nodes'] self.key_prefix = endpoint_config.kwargs['key_prefix'] logger.info(f"startup nodes: {self.startup_nodes} ") logger.info(f"key_prefix nodes: {self.key_prefix} ") self.client = RedisCluster(startup_nodes=self.startup_nodes, decode_responses=True) super().__init__() def lock_key(self, conversation_id: Text) -> Text: return self.key_prefix + conversation_id def get_lock(self, conversation_id: Text) -> Optional[TicketLock]: serialised_lock = self.client.get(self.lock_key(conversation_id)) if serialised_lock: return TicketLock.from_dict(json.loads(serialised_lock)) def delete_lock(self, conversation_id: Text) -> None: deletion_successful = self.client.delete(self.lock_key(conversation_id)) self._log_deletion(conversation_id, deletion_successful) def save_lock(self, lock: TicketLock) -> None: self.client.set(self.lock_key(lock.conversation_id), lock.dumps()) endpoints.yml lock_store: type: 'cluster_lock_store.RedisClusterLockStore' startup_nodes: * host: localhost port: 7000 key_prefix: "chatbot" |
Exalate commented: wladneto commented: To use redis in cluster "natively" just follow this: lock_store: I hope this usefull |
Exalate commented: brunohjs commented: this would be nice to be in the Rasa docs like note |
➤ Maxime Verger commented: 💡 Heads up! We're moving issues to Jira: https://rasa-open-source.atlassian.net/browse/OSS. From now on, this Jira board is the place where you can browse (without an account) and create issues (you'll need a free Jira account for that). This GitHub issue has already been migrated to Jira and will be closed on January 9th, 2023. Do not forget to subscribe to the corresponding Jira issue! ➡️ More information in the forum: https://forum.rasa.com/t/migration-of-rasa-oss-issues-to-jira/56569. |
This error happens when using the
RedisLockStore
with a Redis instance in cluster mode (e.g. https://aws.amazon.com/elasticache/)The text was updated successfully, but these errors were encountered: