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

当使用的别名不是hosts内绑定的第一个时带auth请求失败 #104

Open
lujian0571 opened this issue Sep 3, 2019 · 0 comments

Comments

@lujian0571
Copy link

lujian0571 commented Sep 3, 2019

        String ip = "<IP>";
        int port = 11211;
        String user = "cacheuser";
        String password = "12345";
        InetSocketAddress inetSocketAddress = new InetSocketAddress(ip, port);
        XMemcachedClientBuilder memcachedClientBuilder = new XMemcachedClientBuilder(Arrays.asList(inetSocketAddress));
        memcachedClientBuilder.setConnectionPoolSize(3);
        memcachedClientBuilder.setCommandFactory(new BinaryCommandFactory());
        memcachedClientBuilder.setAuthInfoMap(Collections.singletonMap(inetSocketAddress, AuthInfo.plain(user, password)));
        MemcachedClient memcachedClient = memcachedClientBuilder.build();
        memcachedClient.set("aaa", 86400, "12345");
        String a2 = memcachedClient.get("aaa");
        System.out.println(a2);
  • 当hosts内存在

192.168.1.5 cache1

代码<IP>直接使用使用ip:192.168.1.5时会验证失败,使用cache1正常

  • 当hosts内存在
192.168.1.5 cache1
192.168.1.5 cache2

代码<IP>使用别名: cache2会验证失败,使用cache1正常


出错代码 AuthMemcachedConnectListener
内的

      AuthInfo authInfo =
          authInfoMap.get(AddrUtil.getServerString(tcpSession.getRemoteSocketAddress()));

取到null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant