memcached
memcached
-
安装依赖
ldconfig -p | grep libevent
wget https://github.com/libevent/libevent/releases/download/release-2.1.10-stable/libevent-2.1.10-stable.tar.gz
./configure make && make install
-
安装memcached
wget https://memcached.org/files/memcached-1.6.15.tar.gz
./configure --with-libevent=/usr/local make && make install
-
启动服务
tee /etc/systemd/system/memcached.service <<EOF [Unit] Description=memcached serveice After=network.target [Service] #-u 指定用户 #-c 并发连接数 ExecStart=memcached -m 16M -p 11211 -d -u root -c 8192 User=root [Install] WantedBy=multi-user.target EOF
测试服务
import memcache mc = memcache.Client(['10.4.7.50:11211'], debug=0) mc.set("name","wangendao") value=mc.get("name") print(value)
-
监控memcached
wget https://github.com/prometheus/memcached_exporter/releases/download/v0.9.0/memcached_exporter-0.9.0.linux-amd64.tar.gz
./memcached_exporter --memcached.address="127.0.0.1:11211" --web.listen-address=":9150" --web.telemetry-path="/metrics" &