Service-Side # saslauthd -vsaslauthd 2.1.23authentication mechanisms: getpwent kerberos5 pam rimap shadow ldap# vi /etc/sysconfig/saslauthdmech=shadow# /etc/init.d /saslauthd restart# ps aux | grep saslauthd# /etc/init.d/saslauthd start# chkconfig saslauthd on# /usr/sbin/testsaslauthd -u root -p 1230 : ok "Success." Testsaslauthd appears 0: no "authentication failed" solution # setsebool -p allow_saslauthd_ read_shadow 1/usr/sbin/saslpasswd2 -a memcached -c rootpassword: again (for verification): 4. 2 installation libevent# tar -zxvf libevent-2.0.12-stable.tar.gz# cd libevent-2.0.12-stable# ./configure --prefix=/usr/local/ libevent# make# make install4. 3 installation memcached server# tar -zxvf Memcached-1.4.6.tar.gz # cd memcached-1.4.6 # ./configure --enable-sasl -- prefix=/usr/local/memcached --with-libevent=/usr/local/libeventmakemake install Start the memcached server, enable the SASL authentication feature, and require the-s (capital S) parameter to be added at startup # /usr/local/memcached/bin/memcached -d -s -m 64 -u root -l 192.168.1.10 -p 11211 -c 1024 -p /usr/ The local/memcached/memcached.pid# ps –ef|grep memcached startup command parameters are as follows in the table startup mode-d Run-u root specified user as daemon (daemon), if current is root , use this parameter to specify the user-p /tmp/a.pid Save the PID to the specified file memory settings-m 1024 data memory amount, does not contain memcached itself occupies, the unit is MB-M memory is not enough to prohibit LRU, error-n 48 initial CHUNK=KEY+SUFFIX+VALUE+32 structure, default 48 byte-f 1.25 growth factor, default 1.25-l enable large memory page, can reduce memory waste, Improved performance security settings-s enable SASL Security Authentication feature, when turned on, the client needs to provide a user name password to access memcached connection settings-l 127.0.0.1 listening IP address , the machine can not set this parameter-P 11211 &NBsp TCP port, default is 11211, can not set-U 11211 UDP port, default is 11211,0 to turn off concurrency setting-c 1024 maximum number of concurrent connections, default 1024, preferably 200-t 4 Number of threads, default 4. Since memcached uses NIO, more multithreading does not have much effect-r 20 each event connection maximum number of concurrent, default 20-c disable CAS command (can suppress version count, reduce overhead) client 2. Install SASL related Environment # yum install cyrus-sasl-plain cyrus-sasl cyrus-sasl-devel cyrus-sasl-lib3. Install Source Package libmemcached# wget https://launchpad.net/libmemcached/1.0/1.0.16/+ download/libmemcached-1.0.16.tar.gz # tar zxvf libmemcached-1.0.16.tar.gz# cd libmemcached-1.0.16# ./configure --prefix=/usr/local/libmemcached --enable-sasl# make# make install4. Install Source package memcached before installing memcached need to confirm whether there is zlib-devel# yum install zlib-devel# wget http://pecl.php.net/get/memcached-2.1.0.tgz# tar zxvf memcached-2.1.0.tgz# cd memcached-2.1.0# /usr/local/php/bin/phpize# ./configure -- With-php-config=/usr/local/php/bin/php-config --with-config-file-path=/usr/local/php/etc -with-libmemcached-dir=/usr/local/ libmemcached --enable-memcached-sasl# make# make install5. Modifying php.ini files/usr/local/php/ Etc/php.ini Add extension=memcached.somemcached.use_sasl = 16. Set account password for authentication memcached Setsaslauthdata (' root ', ' 123 '); //set account password for authentication
Reference: http://my.oschina.net/maczhao/blog/369794
linux--memcached SASL Installation