0

我们在 Java 中使用 memcached。我们的环境在 OpenShift Online (PaaS) 上运行,目前我们有一个“齿轮”运行我们的后端 Java 应用程序,一个“齿轮”运行 memcached。

由于它会更便宜,我们希望迁移到 AWS ElastiCache - 但不更改我们当前的 memcached 客户端,即 xmemcached。但是我们必须如何处理身份验证?我试过 [访问密钥 ID] / [秘密访问密钥]:

MemcachedClient memcachedClient;

MemcachedClientBuilder builder = new XMemcachedClientBuilder(AddrUtil.getAddresses([aws node endpoint]));
builder.setCommandFactory(new BinaryCommandFactory());
builder.addAuthInfo(AddrUtil.getOneAddress([aws node endpoint]), AuthInfo.plain([Access Key ID], [Secret Access Key]));

memcachedClient = builder.build();

没有成功。我总是遇到一个例外:

net.rubyeye.xmemcached.exception.MemcachedException: There is no available connection at this moment

如果我根本不进行身份验证,我会得到同样的异常。

我知道最好使用 AWS 客户端;但由于我们实际上只使用一个节点,我们不需要自动发现。关键是我们确实有一些其他的 memcached 服务器,例如在测试/本地环境中,aws 客户端可能不支持这些服务器(或者我错了吗?)。

4

0 回答 0