利用APCu作为本地缓存,同时使用Memcahed将缓存分布到多台服务器上,提高性能。
安装APCu
Hat/CentOS/Fedora:
yum install -y php-pecl-apcu
systemctl restart httpd
Debian/Ubuntu/Mint:
apt-get install php5-apcu/trusty-backports
systemctl restart httpd
安装Memcached和php-pecl-memcached
方法一:编译安装
安装编译器
yum -y install gcc gcc-c++
从官网中下载最新的 memcached http://www.memcached.org/
tar -xvf memcached-1.4.15.tar.gz
cd memcached-1.4.15
./configure –prefix=/usr/local/memcache
出现了 configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/
就直接去,那个网站下载
tar zxvf libevent-1.2.tar.gz
cd libevent-1.2
./configure -prefix=/usr
make
make install
编译安装php模块的memcache模块 下载地址 http://pecl.php.net/package/memcache
tar -xvf memcache-2.2.7.tar.gz
cd memcache-2.2.7
#/usr/local/php/bin/phpize
#./configure –with-php-config=/usr/local/php/bin/php-config –enable-memcache
make & make install
#/usr/local/bin/memcached -d -m 10 -u root -l 192.168.12.201 -p 13001 -c 256 -P /tmp/memcached.pid #启动memcache
方法二:yum/apt-get安装
Hat/CentOS/Fedora:
yum install memcached php-pecl-memcached
systemctl start memcached
Debian/Ubuntu/Mint:
apt-get install memcached php5-memcached
systemctl start memcached
重启apache:
systemctl restart httpd #centos/hat/fedora
systemctl restart apache2 #ubuntu/debain/mint
您可以验证Memcached守护程序是否正在使用ps ax运行:
ps ax | grep memcached
19563 ? Sl 0:02 /usr/bin/memcached -m 64 -p 11211 -u memcache -l
127.0.0.1
配置config.php文件
编辑config.php文件
vim /var/www/html/nextcloud/config/config.php
在);
前添加下面的的代码:
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.distributed’ => ‘\OC\Memcache\Memcached’,
‘memcached_servers’ => array(
array(‘localhost’, 11211),
array(‘server1.example.com’, 11211),
array(‘server2.example.com’, 11211),
),
其中
array(‘server1.example.com’, 11211),
array(‘server2.example.com’, 11211),
指向第二、第三台memcached服务器(如果没有,这两行必须删去。同理,按以上格式可以增加更多memcached服务器),实现将数据缓存分布到多个服务器上。
如图:
检查
登录nextcloud,进入http://ip/nextcloud/index.php/settings/admin
APCu+Memcahed已开启
文章目录
安装APCu
安装Memcached和php-pecl-memcached
方法一:编译安装
方法二:yum/apt-get安装
配置config.php文件
检查
本文由 橙叶博客 作者:FrankGreg 发表,转载请注明来源!
[
FrankGreg
](https://www.orgleaf.com/author/1 “FrankGreg”)文章:260 画廊:7 视频:11
……
热评文章
- 1使用Docker部署ONLYOFFICE Document Server
- 2Owncloud安装过程
- 3OCC命令给ownCloud/Nextcloud手动添加文件
- 4ocDownloader 配置Nextcloud离线下载功能
- 5【ownCloud】9.1.3安装完整演示教程