日に日に分からんことが増えていく…

プログラマー初心者としての日々を学んでいることを記録していく。

memcachedのインストール方法

  • Git hubよりインストール

github.com

[vagrant@localhost ~]$ tar -zxf memcached-1.5.3.tar.gz
[vagrant@localhost ~]$ cd memcached-1.5.3/
[vagrant@localhost memcached-1.5.3]$ ./configure --prefix=/usr/local/memcached --enable-64bit --with-libevent=/usr/lib64/


[vagrant@localhost memcached-1.5.3]$ make && make test && sudo make install
  • systemd serviceとして登録(ここ間違え情報) Job for memcached.service failed because a configured resource limit was exceeded. See "systemctl status memcached.service" and "journalctl -xe" for details.
[root@localhost memcached-1.5.3]# vi /usr/lib/systemd/system/memcached.service

#############################
[Unit]
Description=The memcached daemon is a network memory cache service.
After=syslog.target network.target

[Service]
Type=forking
User=memcached

Environment=PORT=11211
Environment=MAXCONN=1024
Environment=CACHESIZE=64

PIDFile=/usr/local/memcache/memcached.pid

EnvironmentFile=/etc/sysconfig/memcached  # オプション変数はここで指定できる

ExecStart=/usr/local/memcache/bin/memcached -d -p ${PORT} -u ${USER} -m ${CACHESIZE} -c ${MAXCONN} -P ${PIDFile} ${OPTIONS} -o modern
ExecReload=/bin/kill -HUP ${MAINPID}
ExecStop=. /etc/init.d/functions
ExecStop=killproc -p ${PIDFile} /usr/local/memcache/bin/memcached
ExecStop=rm -f ${PIDFile}
PrivateTmp=true
TimeoutSec=300

[Install]
WantedBy=multi-user.target

#############################

[root@localhost memcached-1.5.3]# vi /etc/sysconfig/memcached


#############################

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
PIDFile="/usr/local/memcache/memcached.pid"

#############################


## 起動コマンド
[root@localhost memcached-1.5.3]# systemctl enable memcached.service
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@localhost memcached-1.5.3]# systemctl start memcached.service
Job for memcached.service failed because a configured resource limit was exceeded. See "systemctl status memcached.service" and "journalctl -xe" for details.

あとは、telnetで接続できる。

[vagrant@localhost memcached-1.5.3]$ sudo yum -y install telnet

[vagrant@localhost memcached-1.5.3]$ telnet localhost 11211