Hello all,
I'm trying to use hazelcast (3.6.3) together with libmemcached (1.0.18). I try a simple set command and always get an CONNECTION FAILURE. Is the memcached support broken? I also tried the python-memcached module with the same result. Connecting with a real memcached daemon works fine.
Here is my source code (compile with gcc test.c -l memcached):
#include <libmemcached/memcached.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char **argv) {
memcached_server_st *servers = NULL;
memcached_st *memc;
memcached_return rc;
char *key = "keystring";
char *value = "keyvalue";
size_t value_length;
uint32_t flags;
memc = memcached_create(NULL);
servers = memcached_server_list_append(servers, "localhost", 5701, &rc);
rc = memcached_server_push(memc, servers);
if (rc == MEMCACHED_SUCCESS)
fprintf(stderr, "Added server successfully\n");
else
fprintf(stderr, "Couldn't add server: %s\n", memcached_strerror(memc, rc));
rc = memcached_set(memc, key, strlen(key), value, strlen(value), (time_t)0, (uint32_t)3600);
if (rc == MEMCACHED_SUCCESS)
fprintf(stderr, "Key stored successfully\n");
else
fprintf(stderr, "Couldn't store key: %s\n", memcached_strerror(memc, rc));
return 0;
}
The output of the client:
Added server successfully
Couldn't store key: CONNECTION FAILURE
The server output:
Jul 16, 2016 11:12:59 AM com.hazelcast.nio.tcp.SocketAcceptorThread
INFO: [172.16.243.141]:5701 [dev] [3.6.3] Accepting socket connection from /127.0.0.1:36681 Jul 16, 2016 11:12:59 AM com.hazelcast.nio.tcp.TcpIpConnectionManager
Jul 16, 2016 11:12:59 AM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [172.16.243.141]:5701 [dev] [3.6.3] Connection [/127.0.0.1:36681] lost. Reason: Socket explicitly closed
Both the client and the server are running on the same host. Can anybody explain what's happening? Is hazelcast's memcached support broken?
Thanks,
Tom.