diff --git a/src/Dictionaries/RedisDictionarySource.cpp b/src/Dictionaries/RedisDictionarySource.cpp index 124da141899..5215f5035cd 100644 --- a/src/Dictionaries/RedisDictionarySource.cpp +++ b/src/Dictionaries/RedisDictionarySource.cpp @@ -139,6 +139,9 @@ namespace DB BlockInputStreamPtr RedisDictionarySource::loadAll() { + if (!client->isConnected()) + client->connect(host, port); + RedisCommand command_for_keys("KEYS"); command_for_keys << "*"; @@ -189,6 +192,9 @@ namespace DB BlockInputStreamPtr RedisDictionarySource::loadIds(const std::vector & ids) { + if (!client->isConnected()) + client->connect(host, port); + if (storage_type != RedisStorageType::SIMPLE) throw Exception{"Cannot use loadIds with \'simple\' storage type", ErrorCodes::UNSUPPORTED_METHOD};