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

stats items not working #11

Closed
pouyadarabi opened this issue Apr 25, 2020 · 4 comments
Closed

stats items not working #11

pouyadarabi opened this issue Apr 25, 2020 · 4 comments

Comments

@pouyadarabi
Copy link

Hi,

I cannot use stats items with lsmcd
but it's working on native memcached

this error shown:

CLIENT_ERROR bad command line format

and getallkeys in php return empty array

i'm using php 7.3 and cetnos 7

@rperper
Copy link
Collaborator

rperper commented Apr 26, 2020

Hi,
Are you using SASL? In PHP are you in binary mode?
Some of the stuff I'd like to see is:

  • node.conf.
  • /tmp/lsmcd.log
    Thanks,
    Bob Perper

@pouyadarabi
Copy link
Author

No,

PHP code:

<?php $c = new Memcached(); $c->addServer("127.0.0.1", 11211); var_dump( $c->getAllKeys() );

node.conf

Repl.HeartBeatReq=30
Repl.HeartBeatRetry=3000
Repl.MaxTidPacket=2048000
Repl.GzipStream=YES
Repl.LbAddrs=127.0.0.1:12340
Repl.ListenSvrAddr=127.0.0.1:12340
REPL.DispatchAddr=127.0.0.1:5501
RepldSockPath=/tmp/repld.usock
CACHED.PRIADDR=127.0.0.1:11000
CACHED.ADDR=127.0.0.1:11211
#CACHED.ADDR=UDS:///tmp/lsmcd.sock
#default is 8, it can be bigger depending on cache data amount
Cached.Slices=8
Cached.Slice.Priority.0=100
Cached.Slice.Priority.1=100
Cached.Slice.Priority.2=100
Cached.Slice.Priority.3=100
Cached.Slice.Priority.4=100
Cached.Slice.Priority.5=100
Cached.Slice.Priority.6=100
Cached.Slice.Priority.7=100
Cached.ShmDir=/dev/shm/lsmcd
Cached.UseSasl=false
Cached.DataByUser=true
Cached.Anonymous=false
#Cached.SaslDB=/etc/sasllsmcd
##this is the global setting, no need to have per slice configuration.
User=nobody
Group=nobody
#depends CPU core
CachedProcCnt=4
CachedSockPath=/tmp/cached.usock.
TmpDir=/tmp/lsmcd
LogLevel=notice
#LogLevel=dbg_medium
LogFile=/var/log/lsmcd.log

I set debug mode to dbg_high
lsmcd.log

2020-04-27 13:14:31.142 [DEBUG] [__root] About to test USESASL
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.USESASL = false
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.0=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.0=/dev/shm/lsmcd/data0
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.1=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.1=/dev/shm/lsmcd/data1
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.2=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.2=/dev/shm/lsmcd/data2
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.3=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.3=/dev/shm/lsmcd/data3
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.4=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.4=/dev/shm/lsmcd/data4
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.5=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.5=/dev/shm/lsmcd/data5
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.6=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.6=/dev/shm/lsmcd/data6
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SLICE.PRIORITY.7=100
2020-04-27 13:14:31.142 [DEBUG] [__root] CACHED.SHMFILEPATH.7=/dev/shm/lsmcd/data7
2020-04-27 13:14:31.142 [NOTICE] [__root] LSMCD/1.4.11 LiteSpeed Memcached Replacement

output is array(0) { }

I write another test

$c = new Memcached();
$c->addServer("127.0.0.1", 11211);
$c->set('pouya','test');
var_dump($c->get('pouya'));
var_dump($c->getAllkeys());

output is: string(4) "test" array(0) { }

@rperper
Copy link
Collaborator

rperper commented Apr 27, 2020

Your initial problem was an error in stats(). So I wrote the following program:

echo "Entering PHP<br>";
$c = new Memcached();
echo "addServer<br>";
$c->addServer("127.0.0.1",11211);
echo "set: ";
echo $c->set('pouya','test');
echo "<br>var_dump of the key<br>";
var_dump($c->get('pouya'));
echo "<br>var_dump of all keys<br>";
var_dump($c->getAllkeys());
echo "<br>get: " . $c->get('pouya') . "<br>";
echo "stats: " ;
var_dump($c->getStats());
echo "<br>";
?>

Which displayed the following results in a browser:
Entering PHP
addServer
set: 1
var_dump of the key
string(4) "test"
var_dump of all keys
array(0) { }
get: test
stats: array(1) { ["127.0.0.1:11211"]=> array(24) { ["pid"]=> int(3803) ["version"]=> string(5) "1.0.0" ["pointer_size"]=> int(64) ["rusage_user"]=> float(0.016648) ["rusage_system"]=> float(0.015964) ["cmd_get"]=> int(34) ["cmd_set"]=> int(14) ["cmd_flush"]=> int(2) ["cmd_touch"]=> int(0) ["get_hits"]=> int(19) ["get_misses"]=> int(15) ["delete_misses"]=> int(0) ["delete_hits"]=> int(0) ["incr_misses"]=> int(0) ["incr_hits"]=> int(0) ["decr_misses"]=> int(0) ["decr_hits"]=> int(0) ["cas_misses"]=> int(0) ["cas_hits"]=> int(0) ["cas_badval"]=> int(0) ["touch_hits"]=> int(0) ["touch_misses"]=> int(0) ["auth_cmds"]=> int(0) ["auth_errors"]=> int(0) } }

This shows us several things:

  • The set and get seem to work as expected.
  • The memcached function getAllKeys() does not work
  • The getStats() function works as expected.

This is actually as documented. There is no documentation for the telnet command stats items or similar function. The full list of commands is here: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:lsmcd:commands

Thanks,

Bob Perper
rperper@litespeedtech.com

@pouyadarabi
Copy link
Author

I started this issue with "stats items not working"
anyway thanks for your help.

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

2 participants