Re: Getting hostnames of servers where a particular key is stored when ketama hashing and replication is enabled

2018-08-03 Thread Om Kale
Hey,
Additionally, I see no example usage of the memcached_server_by_key API to
get the server where a key is stored.
When I try to print out the value contained in it in my c code, I get
dereferencing error:
  memcached_return_t rc2;
  memcached_instance_st* r_server;
  r_server = memcached_server_by_key(cache, key, (size_t) strlen(key),
&rc2);
  printf("%s \n", r_server->hostname());

This is the error:
testsasl.c:67:28: error: dereferencing pointer to incomplete type
‘memcached_instance_st {aka struct memcached_instance_st}’
   printf("%s \n", r_server->hostname());
^
Also, I observe that the common.h file does not get added in the usual
compilation path under /usr/include/lib/

Any help with this will be highly appreciated. Would I need to change
libmemcached code to view this?

Thanks and Regards,
Om Kale


On Thu, Aug 2, 2018 at 7:15 PM, Om Kale  wrote:

> Also, one more problem with the script approach, I would have to maintain
> a separate connection to all memcached servers in the list.
> How would I query them individually all the time when server list changes?
>
>
> Thanks and Regards,
> Om Kale
>
>
> On Thu, Aug 2, 2018 at 5:21 PM, Om Kale  wrote:
>
>> Yes. I do.
>> Oh..ok. You are saying to do it the other way around, instead of passing
>> a key and checking which server it belongs to, query every server in the
>> list for a given key? I could that..not very optimal..but a workaround.
>> Why I needed a way to get a server list where a particular key belongs
>> to, it will be easy to check the state as well during run time. So
>> whenever, some value fetch would give me an error, I could quickly use the
>> key to get the servers its stored on and go on from there.
>>
>> Thanks and Regards,
>> Om Kale
>>
>> On Thu, Aug 2, 2018 at 4:43 PM, dormando  wrote:
>>
>>> You have the list of all servers right? Just query them individually? if
>>> it's just for debugging it should take you a few minutes to code
>>> soemthing
>>> yup; you could even use a bash script.
>>>
>>> On Thu, 2 Aug 2018, Om Kale wrote:
>>>
>>> > The reason I am trying to do this is for better debugging. In case
>>> something goes wrong in the system and I am unable to get the value stored
>>> for a
>>> > particular key, I can go ahead and use this functionality to
>>> understand on which server that particular key is stored.
>>> > Also, the second question about why the printing doesn't work. Is
>>> there any other way to check on which server a key is stored.
>>> > Additionally, when you say brute force, how would I be able to do it
>>> on memcached server as I will not know on which server instance the key is
>>> stored.
>>> > Could you please elaborate on this?
>>> >
>>> > Thanks and Regards,Om Kale
>>> >
>>> > On Thu, Aug 2, 2018 at 4:27 PM, dormando  wrote:
>>> >   Why are you trying to do this? That's generally a bad sign, the
>>> >   replication is for redundancy. if you're just trying to confirm
>>> it works,
>>> >   you can do a brute force search for the key
>>> >
>>> >   On Thu, 2 Aug 2018, Om Kale wrote:
>>> >
>>> >   > Hi All,I have enabled replication (using --NUMBER_OF_REPLICAS)
>>> and ketama hashing.
>>> >   > This means, I will have replicas of keys stored on different
>>> servers memntioned in my server list.
>>> >   >
>>> >   > My question is, is there any way of retrieving the list of
>>> servers where replicas of a particular key lie, in libmemcached?
>>> >   > Example: If I give a key, I need all the servers where
>>> replicas of that key are stored.
>>> >   >
>>> >   > For getting one server where key is stored, I use this:
>>> >   > const struct memcached_instance_st *server;server = const
>>> memcached_instance_st * memcached_server_by_key(memcached_st *ptr, const
>>> >   > char *key, size_t key_length, memcached_return_t *error);
>>> >   >
>>> >   >
>>> >   >   However, I am unable to print the hostname from the returned
>>> structure using server->hostname
>>> >   >
>>> >   >   in a .c file. Can this info not be printed?
>>> >   >
>>> >   > Thanks and Regards,
>>> >   >
>>> >   > Om Kale
>>> >   >
>>> >   >
>>> >   >
>>> > > --
>>> > >
>>> > > ---
>>> > > You received this message because you are subscribed to the Google
>>> Groups "memcached" group.
>>> > > To unsubscribe from this group and stop receiving emails from it,
>>> send an email to memcached+unsubscr...@googlegroups.com.
>>> > > For more options, visit https://groups.google.com/d/optout.
>>> > >
>>> > >
>>> >
>>> > --
>>> >
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> Groups "memcached" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> an email to memcached+unsubscr...@googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>> >
>>> >
>>> > --
>>> >
>>> > ---
>>> > You received this message because you are sub

Re: Getting hostnames of servers where a particular key is stored when ketama hashing and replication is enabled

2018-08-02 Thread Om Kale
Yes. I do.
Oh..ok. You are saying to do it the other way around, instead of passing a
key and checking which server it belongs to, query every server in the list
for a given key? I could that..not very optimal..but a workaround.
Why I needed a way to get a server list where a particular key belongs to,
it will be easy to check the state as well during run time. So whenever,
some value fetch would give me an error, I could quickly use the key to get
the servers its stored on and go on from there.

Thanks and Regards,
Om Kale

On Thu, Aug 2, 2018 at 4:43 PM, dormando  wrote:

> You have the list of all servers right? Just query them individually? if
> it's just for debugging it should take you a few minutes to code soemthing
> yup; you could even use a bash script.
>
> On Thu, 2 Aug 2018, Om Kale wrote:
>
> > The reason I am trying to do this is for better debugging. In case
> something goes wrong in the system and I am unable to get the value stored
> for a
> > particular key, I can go ahead and use this functionality to understand
> on which server that particular key is stored.
> > Also, the second question about why the printing doesn't work. Is there
> any other way to check on which server a key is stored.
> > Additionally, when you say brute force, how would I be able to do it on
> memcached server as I will not know on which server instance the key is
> stored.
> > Could you please elaborate on this?
> >
> > Thanks and Regards,Om Kale
> >
> > On Thu, Aug 2, 2018 at 4:27 PM, dormando  wrote:
> >   Why are you trying to do this? That's generally a bad sign, the
> >   replication is for redundancy. if you're just trying to confirm it
> works,
> >   you can do a brute force search for the key
> >
> >   On Thu, 2 Aug 2018, Om Kale wrote:
> >
> >   > Hi All,I have enabled replication (using --NUMBER_OF_REPLICAS)
> and ketama hashing.
> >   > This means, I will have replicas of keys stored on different
> servers memntioned in my server list.
> >   >
> >   > My question is, is there any way of retrieving the list of
> servers where replicas of a particular key lie, in libmemcached?
> >   > Example: If I give a key, I need all the servers where replicas
> of that key are stored.
> >   >
> >   > For getting one server where key is stored, I use this:
> >   > const struct memcached_instance_st *server;server = const
> memcached_instance_st * memcached_server_by_key(memcached_st *ptr, const
> >   > char *key, size_t key_length, memcached_return_t *error);
> >   >
> >   >
> >   >   However, I am unable to print the hostname from the returned
> structure using server->hostname
> >   >
> >   >   in a .c file. Can this info not be printed?
> >   >
> >   > Thanks and Regards,
> >   >
> >   > Om Kale
> >   >
> >   >
> >   >
> > > --
> > >
> > > ---
> > > You received this message because you are subscribed to the Google
> Groups "memcached" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> an email to memcached+unsubscr...@googlegroups.com.
> > > For more options, visit https://groups.google.com/d/optout.
> > >
> > >
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> Groups "memcached" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to memcached+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> Groups "memcached" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to memcached+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to memcached+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting hostnames of servers where a particular key is stored when ketama hashing and replication is enabled

2018-08-02 Thread dormando
You have the list of all servers right? Just query them individually? if
it's just for debugging it should take you a few minutes to code soemthing
yup; you could even use a bash script.

On Thu, 2 Aug 2018, Om Kale wrote:

> The reason I am trying to do this is for better debugging. In case something 
> goes wrong in the system and I am unable to get the value stored for a
> particular key, I can go ahead and use this functionality to understand on 
> which server that particular key is stored.
> Also, the second question about why the printing doesn't work. Is there any 
> other way to check on which server a key is stored.
> Additionally, when you say brute force, how would I be able to do it on 
> memcached server as I will not know on which server instance the key is 
> stored.
> Could you please elaborate on this?
>
> Thanks and Regards,Om Kale
>
> On Thu, Aug 2, 2018 at 4:27 PM, dormando  wrote:
>   Why are you trying to do this? That's generally a bad sign, the
>   replication is for redundancy. if you're just trying to confirm it 
> works,
>   you can do a brute force search for the key
>
>   On Thu, 2 Aug 2018, Om Kale wrote:
>
>   > Hi All,I have enabled replication (using --NUMBER_OF_REPLICAS) and 
> ketama hashing.
>   > This means, I will have replicas of keys stored on different servers 
> memntioned in my server list.
>   >
>   > My question is, is there any way of retrieving the list of servers 
> where replicas of a particular key lie, in libmemcached?
>   > Example: If I give a key, I need all the servers where replicas of 
> that key are stored.
>   >
>   > For getting one server where key is stored, I use this:
>   > const struct memcached_instance_st *server;server = const 
> memcached_instance_st * memcached_server_by_key(memcached_st *ptr, const
>   > char *key, size_t key_length, memcached_return_t *error);
>   >
>   >
>   >   However, I am unable to print the hostname from the returned 
> structure using server->hostname
>   >
>   >   in a .c file. Can this info not be printed?
>   >
>   > Thanks and Regards,
>   >
>   > Om Kale
>   >
>   >
>   >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google Groups 
> > "memcached" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to memcached+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to memcached+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to memcached+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting hostnames of servers where a particular key is stored when ketama hashing and replication is enabled

2018-08-02 Thread Om Kale
The reason I am trying to do this is for better debugging.
In case something goes wrong in the system and I am unable to get the value
stored for a particular key, I can go ahead and use this functionality to
understand on which server that particular key is stored.
Also, the second question about why the printing doesn't work. Is there any
other way to check on which server a key is stored.
Additionally, when you say brute force, how would I be able to do it on
memcached server as I will not know on which server instance the key is
stored. Could you please elaborate on this?

Thanks and Regards,
Om Kale

On Thu, Aug 2, 2018 at 4:27 PM, dormando  wrote:

> Why are you trying to do this? That's generally a bad sign, the
> replication is for redundancy. if you're just trying to confirm it works,
> you can do a brute force search for the key
>
> On Thu, 2 Aug 2018, Om Kale wrote:
>
> > Hi All,I have enabled replication (using --NUMBER_OF_REPLICAS) and
> ketama hashing.
> > This means, I will have replicas of keys stored on different servers
> memntioned in my server list.
> >
> > My question is, is there any way of retrieving the list of servers where
> replicas of a particular key lie, in libmemcached?
> > Example: If I give a key, I need all the servers where replicas of that
> key are stored.
> >
> > For getting one server where key is stored, I use this:
> > const struct memcached_instance_st *server;server = const
> memcached_instance_st * memcached_server_by_key(memcached_st *ptr, const
> > char *key, size_t key_length, memcached_return_t *error);
> >
> >
> >   However, I am unable to print the hostname from the returned structure
> using server->hostname
> >
> >   in a .c file. Can this info not be printed?
> >
> > Thanks and Regards,
> >
> > Om Kale
> >
> >
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to the Google
> Groups "memcached" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to memcached+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> >
> >
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to memcached+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Getting hostnames of servers where a particular key is stored when ketama hashing and replication is enabled

2018-08-02 Thread dormando
Why are you trying to do this? That's generally a bad sign, the
replication is for redundancy. if you're just trying to confirm it works,
you can do a brute force search for the key

On Thu, 2 Aug 2018, Om Kale wrote:

> Hi All,I have enabled replication (using --NUMBER_OF_REPLICAS) and ketama 
> hashing.
> This means, I will have replicas of keys stored on different servers 
> memntioned in my server list.
>
> My question is, is there any way of retrieving the list of servers where 
> replicas of a particular key lie, in libmemcached?
> Example: If I give a key, I need all the servers where replicas of that key 
> are stored.
>
> For getting one server where key is stored, I use this:
> const struct memcached_instance_st *server;server = const 
> memcached_instance_st * memcached_server_by_key(memcached_st *ptr, const
> char *key, size_t key_length, memcached_return_t *error);
>
>
>   However, I am unable to print the hostname from the returned structure 
> using server->hostname
>
>   in a .c file. Can this info not be printed?
>
> Thanks and Regards,
>
> Om Kale
>
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups 
> "memcached" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to memcached+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"memcached" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to memcached+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.