Issues reading memcached data from multiple mcrouters
I have two mcrouters with the same config setting, and using PrefixSelectorRoute to determine which pool certain prefixed keys should go. Below is my config file:
{
"pools": {
"memcached-session": {
"servers": [ "10.1.9.100:11211", "10.1.9.101:11211", "10.1.9.102:11211" ]
},
"memcached-shared": {
"servers": [ "10.1.9.200:11211", "10.1.9.201:11211" ]
}
},
"route": {
"type": "PrefixSelectorRoute",
"policies": {
"session_": "PoolRoute|memcached-session",
"shared_": "PoolRoute|memcached-shared"
},
"wildcard": "ErrorRoute|Got key with unexpected prefix"
}
}
The issue is that when i write using one of the mcrouters to one of the pools e.g., session, i can use the "get" command to access that data on the same mcrouter server that i used to set or add the data. However, i cannot access the data when i use the same "get" command on the other mcrouter server even if they have the same mcrouter config files. What would be causing this?
Below are the commands i am using for testing:
printf "set session_ k1 0 0 4\r\n1234\r\n" | nc localhost 11212
printf "get session_k1 \r\n" | nc localhost 11212
@chilumbugeorge, the command you provided for writing data is invalid (it has space in key). I assume it's a typo in here and not in the commands that you actually ran on your server.
So if it's not a typo, the same key would always be routed to the same server as long as mcrouters have the same config.
You may try looking into where mcrouter would route the request by sending get __mcrouter__.route_handles(set,session_k1) to the mcrouter. (The arguments to route_handles command are the operation and the key).
This would output you the routing tree that would be used for that key.