boostorg / boostorg/redis

Using AWS cluster - Trouble writing values to it

Open
#166 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
282
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Hi,
Working on my app, everything looks fine in my local development environment with a single redis server on standard port. Running into problems when using an AWS environment with a cluster. Is there anything specific that needs to be set for a cluster?

The initial connection seems to go correctly using the following:
```C++
boost::redis::config cfg;
cfg.addr.host = "clustercfg.xxx-xxx-xxx.cache.amazonaws.com";
cfg.addr.port = "7000";
cfg.use_ssl = true;
cfg.clientname = "webserver";
cfg.log_prefix = "webserver.redis ";
```
and I see the following on std::cout, so it seems the cluster was correctly identified:
```
webserver.redis Resolve results: 10.32.35.71:7000, 10.32.35.244:7000, 10.32.34.195:7000, 10.32.34.189:7000
webserver.redis Connected to endpoint: 10.32.35.71:7000
webserver.redis SSL handshake: Success
webserver.redis Bytes written: 105
webserver.redis Hello: Success
webserver.redis Bytes written: 32

```
However, when trying an HSET operation I got an exception:
**Exception saving session to Redis. %s - keyid - Got RESP3 simple-error. [boost.redis:11]**

This is the code that tries to write to the Cluster: (redisInst is an instance of sync_connection as it came from the examples dir)
```C++
request req;
boost::redis::response<
int, // HSET
boost::redis::ignore_t// EXPIRE
> res;
try {
req.push("HSET", key, "response", responseField);
req.push("EXPIRE", key, maxSessionTimeToLiveSecs, "NX"); // Have the session teid expire
redisInst->exec(req, res);
return true;
}
catch ( const std::exception& e )
{
LogError("Exception saving session to Redis. %s - %s", key.c_str(), e.what());
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.