Configuration File
The LSMCD configuration file is located at “/usr/local/lsmcdctrl/bin/conf/node.conf”. This wiki entry will explain the list of the available configuration options within the file.
A sample node.conf is included with lsmcd. It can make it easier initially copying the file from the distribution to the destination and making changes to it from there. Notes are discussed which mention the changes you will need to make and some recommended changes.
Installation is usually done as root and is done after compilation make install
. However, if you wish to run as an specific user you can run directly from the build directory. When starting the facility, run lsmcdctrl start
from the build dist/bin directory.
CacheD Configurations
These options configure the CacheD portion of LSMCD.
Cached.Addr
Cached.Addr is the LSMCD public listening address and port. This is the address used when connecting and interacting with LSMCD. If replacing Memcached, this should match the current Memcached listening address. You must stop memcached before starting LSMCD.
Cached.Addr=127.0.0.1:11211
If you will be using LSMCD entirely within a single machine and do not need it to listen on a IP port, you can specify a UNIX Domain Socket file name for extra security. For example, using the socket name /tmp/lsmcd.sock
specify:
Cached.Addr=UDS:///tmp/lsmcd.sock
If you are using UNIX domain sockets, see your memcached language guide for connecting to it. For example, for PHP, you specify the domain socket file name as the first parameter (hostName) to addServer and a 0 as the second parameter (port).
Cached.Slices
Cached.Slices is the number of slices that the data will be stored in. This should be equal to or higher than CachedProcCnt to minimize lock contention.
Cached.Slices=2
Cached.Slice.Priority
Cached.Slice.Priority is the priority of the slice in the replication group. This is explained in detail here.
Cached.Slice.Priority.0=100 Cached.Slice.Priority.1=200 #Cached.Slice.Priority.2=300 #Cached.Slice.Priority.3=400
Cached.ShmDir
Cached.ShmDir defines the location of LSMCD data files, such as cache data. If /dev/shm is used, the data will be stored in memory, but will be lost after a server reboot. If using the regular disk, data will be persistent, but it will be slower due to disk I/O. It is recommended to use an SSD for data storage, as SSDs will provide faster performance while keeping data persistent.
Cached.ShmDir=/dev/shm/lsmcd
Cached.HashTableName
Cached.HashTableName is the global hash table name. There is no need to have a different setting per slice.
#Cached.HashTableName=memcache
User and Group
The User and Group options define the user and group that LSCMD will run as.
User=nobody Group=nobody
CachedProcCnt
CachedProcCnt setting determines how many LSMCD processes will run. LSMCD uses multiprocessing unlike MemcacheD, which uses multithreading.
CachedProcCnt=4
TmpDir
TmpDir specifies the location of the LSMCD pid file.
TmpDir=/tmp/lsmcd
LogLevel
LogLevel determines the level of the log messages output in LSMCD. Example levels include Info, Error, Warn, Notice, Info, Debug (as well as dbg_high, dbg_medium, dbg_low) and Trace.
LogLevel=notice #LogLevel=dbg_medium
LogFile
LogFile specifies the location of the LSMCD log file. It should be checked for any problems or issues.
LogFile=/tmp/lsmcd.log
CACHED.USESASL
Set to TRUE if you wish to enable SASL in your memcached installation. This requires that your application provide a user and password with every transaction. If you are using SASL, see this wiki for additional configuration details: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:lsmcd:sasl
CACHED.USESASL=TRUE
Once you have changed this value, you must delete your existing LSMCD files:
rm -rf /dev/shm/lsmcd
Cached.DataByUser
Can only be used if CACHED.USESASL=TRUE and if no replication is used. If set to 'true', each SASL user will be allocated an individual set of data within the data pool. When memcached requests are preceded by a user authorization (which is always the case unless you are using legacy code and enable the Cached.Anonymous option) the request is always for the user specified in the request whether it's a get, put, or stats. See the SASL wiki (above) for details on use.
Cached.Anonymous
Can only be used if CACHED.USESASL=TRUE and if no replication is used. While legacy apps (those without user/password validation) can be made to work with this option until they've all been updated, it makes the most sense if you've specified Cached.DataByUser=true. If set to 'true', users without validation code can access the system, but operate within the common area and do not affect the user specified data areas. See the SASL wiki (above) for details on use.
Cached.SaslDB
Can only be used if CACHED.USESASL=TRUE and if no replication is used. Allows you to specify a database name other than the default sasl database of /etc/sasldb2. Recommended in very secure sensitive environments. See the SASL section for use of this option, particularly with saslpasswd2
and sasldblistusers2
.
Cached.MemMaxSz
If set to a non-zero value, it is the number of bytes that will be stored in the hash before least recently used items begin to be purged. The default is 64000000.
Cached.UserSize
If user level databases are turned on, the initial size of each user's database. The default is 1000.
Cached.HashSize
The default initial cache entry size in bytes. Defaults to 500000. The maximum size is controlled with Cached.MemMaxSz.
Cached.ValMaxSz
The maximum size of any individual entry in the cache. 0 disables the limit, the default is 1000000.
Replicator Configurations
These options configure the replication portion of LSMCD. If there is no replication group, none of these parameters are required.
Repl.LbAddrs
Repl.LbAddrs is a comma separated list of IP addresses (with port number) that form the replication group. This is always required for replication and should be two or more address/port number entries, comma separated.
Repl.LbAddrs=127.0.0.1:12340,192.168.0.122:12340
Cached.PriAddr
Cached.PriAddr is the LSMCD private listening address and port used for interactions between LSMCD instances. Required for replication.
Cached.PriAddr=127.0.0.1:11000
Repl.ListenSvrAddr
Repl.ListenSvrAddr is a required parameter which is the IP address and port that lsmcd will be listening on. Required for replication. Most users will use:
Repl.ListenSvrAddr=127.0.0.1:12340
Repl.DispatchAddr
Repl.DispatchAddr is a replication required parameter. It is recommended that it be specified as:
Repl.DispatchAddr=127.0.0.1:5501
RepldSockPath
RepldSockPath specifies the location of the Repld sock file.
RepldSockPath=/tmp/repld.usock
CachedSockPath
CachedSockPath specifies the location of the Cached sock file and is required. The extra dot at the end is important as this is used as a prefix for a number of separate files.
CachedSockPath=/tmp/cached.usock.
Repl.HeartBeatReq
Repl.HeartBeatReq is the frequency of the replication heartbeat.
Repl.HeartBeatReq=5
Repl.HeartBeatRetry
Repl.HeartBeatRetry is the maximum timeout for replication heartbeat.
Repl.HeartBeatRetry=30
Repl.MaxTidPacket
Repl.MaxTidPacket is the maximum replication packet size.
Repl.MaxTidPacket=2048000
Repl.GzipStream
Repl.GzipStream indicates whether or not LSMCD should use gzip stream for replication traffic.
Repl.GzipStream=YES