千家信息网

Mencached基本部署

发表于:2026-11-01 作者:千家信息网编辑
千家信息网最后更新 2026年11月01日,Mencached基本部署Mamcached概述​ memcached是一套分布式的高速缓存系统,运行在内存中。memcached缺乏认证以及安全管制,这代表应该将memcached服务器放置在防火墙
千家信息网最后更新 2026年11月01日Mencached基本部署

Mencached基本部署

Mamcached概述

​ memcached是一套分布式的高速缓存系统,运行在内存中。memcached缺乏认证以及安全管制,这代表应该将memcached服务器放置在防火墙后。

实验准备

服务器角色地址
centos7-1服务端192.168.45.130
centos7-2客户端192.168.45.132

实验步骤

memcached服务端

1、安装环境包

[root@localhost libevent-2.1.8-stable]# yum install gcc gcc-c++ make -y

2、安装Libevent软件本体

挂载软件包,并到挂载目录下解压

[root@localhost memcached]# tar zxf libevent-2.1.8-stable.tar.gz -C /opt/[root@localhost memcached]# cd /opt/libevent-2.1.8-stable///配置并编译安装[root@localhost libevent-2.1.8-stable]# ./configure \--prefix=/usr/local/libevent[root@localhost libevent-2.1.8-stable]# make && make install

3、配置、安装Memcached

[root@localhost memcached]# tar zxf memcached-1.5.6.tar.gz -C /opt/[root@localhost memcached]# cd /opt/memcached-1.5.6/[root@localhost memcached-1.5.6]# ./configure \--prefix=/usr/local/memached \--with-libevent=/usr/local/libevent/[root@localhost memcached-1.5.6]# make && make install//建立软链接[root@localhost memcached-1.5.6]# ln -s /usr/local/memached/bin/* /usr/local/bin/启动服务[root@localhost memcached-1.5.6]# memcached -d -m 32m -p 11211 -u root//"-d":以守护进程的方式运行(后台运行)//"-m":指定最大使用内存大小//"-p":指定端口//"-u":指定用户[root@localhost memcached-1.5.6]# netstat -atnp | grep 11211tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN      12591/memcached     tcp6       0      0 :::11211                :::*                    LISTEN      12591/memcached     #关闭防火墙和安全功能[root@localhost memcached-1.5.6]# systemctl stop firewalld.service [root@localhost memcached-1.5.6]# setenforce 0

4、安装Telent用于连接Memcached

[root@localhost memcached-1.5.6]# yum install telnet -y//连接memcached[root@localhost memcached-1.5.6]# telnet 192.168.142.66 11211Trying 192.168.142.66...Connected to 192.168.142.66.Escape character is '^]'.

客户端

安装LAMP架构

详情请见本人之前的博客,里面有详细部署过程,这里就不在赘述了

博客地址:https://blog.csdn.net/Parhoia/article/details/102675756
博客最后的论坛架构不用安装

1、数据库中进行提权

[root@localhost ~]# mysql -uroot -pmysql> create database sky;mysql> grant all on sky.* to 'skyuser'@'%' identified by '123123';mysql> flush privileges;

2、测试PHP工具能否连接数据库

[root@localhost htdocs]# vim /usr/local/httpd/htdocs/index.phpSuccess!!!";else echo "Fail!!";mysql_close();?>

3、安装、配置memcache客户端

[root@localhost memcached]# tar zxf memcache-2.2.7.tgz -C /opt/[root@localhost memcached]# cd /opt/memcache-2.2.7/[root@localhost memcache-2.2.7]# /usr/local/php5/bin/phpize   //为memcache生成启动脚本[root@localhost memcache-2.2.7]# ./configure \--enable-memcache \--with-php-config=/usr/local/php5/bin/php-config//编译&安装[root@localhost memcache-2.2.7]# make && make install修改PHP的配置文件[root@localhost memcache-2.2.7]# vim /usr/local/php5/php.ini//736行后添加extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-zts-20131226/"extension = memcache.so

4、建立测试页面

[root@localhost memcache-2.2.7]# vim /usr/local/httpd/htdocs/index.phpconnect('192.168.142.136',11211);          //memached服务端地址$memcache->set('key',Memcache test Successfull!!!',0,60);$result = $memcache->get('key');unset($memcache);echo $result;?>
服务 配置 博客 地址 客户 客户端 运行 安全 内存 数据 数据库 服务器 架构 软件 防火墙 实验 测试 编译 防火 最大 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 深圳市人人互联网科技有限公司 云信互联网科技有限公司 互联网是不是新科技 互联网金融 科技金融 互联网科技公司怎么样 九亚互联网科技 远拓互联网科技 佰商互联网科技有限公司 湖南洣水互联网科技有限公司扣款 浙南科技城互联网大厦建设工程 朱啸虎曾投资哪些互联网科技企业 黑科技 体验场景 互联网大会 互联网营销推广黑科技 图游互联网科技 上海万顺科技互联网有限公司招聘 银川新华互联网科技学校原画 互联网的科技体现在哪里 互联网科技对化妆品行业 上海旺乐尼互联网科技有限公司 恒生互联网科技趋势 咖啡网 互联网巨头科技公司 科技互联网公司logo 成都狮子座互联网科技 科技伦理 互联网公司 福建科技产业互联网发展 西安小鹰速贷互联网科技有限公司 扫呗互联网科技有限公司 互联网科技大佬云集 六子台科技互联网展会
0