CentOS7安装Memcached 三步曲
CentOS7安装Memcached 三步曲
1.yum 安装
yum clean all
yum -y update
yum -y install memcached
2.Memcached 运行yum -y update
yum -y install memcached
memcached -h
//查看考号修改配置
vim /etc/sysconfig/memcached
内容如下:
PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=”"
可以修改端口,用户和最大内存,缓存大小
//重启,启动,开机启动,状态,关闭
systemctl restart memcached
systemctl start memcached
systemctl enable memcached
systemctl status memcached
systemctl stop memcached
//查看考号修改配置
vim /etc/sysconfig/memcached
内容如下:
PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=”"
可以修改端口,用户和最大内存,缓存大小
//重启,启动,开机启动,状态,关闭
systemctl restart memcached
systemctl start memcached
systemctl enable memcached
systemctl status memcached
systemctl stop memcached
memcached-tool 127.0.0.1:11211 stats
#127.0.0.1:11211 Field Value
accepting_conns 1
auth_cmds 0
auth_errors 0
bytes 0
bytes_read 7
bytes_written 0
cas_badval 0
cas_hits 0
cas_misses 0
cmd_flush 0
cmd_get 0
cmd_set 0
cmd_touch 0
conn_yields 0
connection_structures 11
curr_connections 10
curr_items 0
decr_hits 0
decr_misses 0
delete_hits 0
delete_misses 0
evicted_unfetched 0
evictions 0
expired_unfetched 0
get_hits 0
get_misses 0
hash_bytes 524288
hash_is_expanding 0
hash_power_level 16
incr_hits 0
incr_misses 0
libevent 2.0.21-stable
limit_maxbytes 67108864
listen_disabled_num 0
pid 27929
pointer_size 64
reclaimed 0
reserved_fds 20
rusage_system 0.055134
rusage_user 0.091092
threads 4
time 1429863174
total_connections 11
total_items 0
touch_hits 0
touch_misses 0
uptime 910
version 1.4.15
3.扩展一下,安装PHP-memcache扩展,防火墙放开11211端口accepting_conns 1
auth_cmds 0
auth_errors 0
bytes 0
bytes_read 7
bytes_written 0
cas_badval 0
cas_hits 0
cas_misses 0
cmd_flush 0
cmd_get 0
cmd_set 0
cmd_touch 0
conn_yields 0
connection_structures 11
curr_connections 10
curr_items 0
decr_hits 0
decr_misses 0
delete_hits 0
delete_misses 0
evicted_unfetched 0
evictions 0
expired_unfetched 0
get_hits 0
get_misses 0
hash_bytes 524288
hash_is_expanding 0
hash_power_level 16
incr_hits 0
incr_misses 0
libevent 2.0.21-stable
limit_maxbytes 67108864
listen_disabled_num 0
pid 27929
pointer_size 64
reclaimed 0
reserved_fds 20
rusage_system 0.055134
rusage_user 0.091092
threads 4
time 1429863174
total_connections 11
total_items 0
touch_hits 0
touch_misses 0
uptime 910
version 1.4.15
yum -y install php-pecl-memcache
如果是PHP56版本的应该运行
yum -y install php56w-pecl-memcache
防火墙放开11211
如果是PHP56版本的应该运行
yum -y install php56w-pecl-memcache
防火墙放开11211
firewall-cmd --permanent --zone=public --add-port=11211/tcp
检查端口是否开放
检查端口是否开放
echo stats | nc memcache_host_name_or_ip 11211
在centos7上安装memcached服务
memcached是一套分布式的快取系统,与redis相似,其本质上就是一个内存key-value数据库。用python读取memcached数据很方便,所以我们项目通常使用memcached.
️安装gcc
yum install gcc
yum install gcc-c++
️安装libevent
wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
tar xvf libevent-2.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=/usr --libdir=/usr/lib64
make
make install
️安装memcached
wget http://www.memcached.org/files/memcached-1.6.6.tar.gz
tar xvf memcached-1.6.6.tar.gz
cd memcached-1.6.6
./configure && make && sudo make install
️启动memcached
/usr/local/bin/memcached -d -m 512 -l 0.0.0.0 -p 11211 -u root
如果需要随系统启动,需要把上面命令加入到/etc/rc.d/rc.local 文件里.如果加入后还不好用,可能是rc.local文件没有可执行权限, 给执行权限就好了
chmod 755 /etc/rc.d/rc.local
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· DeepSeek “源神”启动!「GitHub 热点速览」
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器