Nextcloud

Nextcloud/ownCloud配置APCu本地缓存+Memcached分布式缓存

安装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已开启

(4)

本文由 橙叶博客 作者:FrankGreg 发表,转载请注明来源!

关键词:,

热评文章

评论:

5 条评论,访客:5 条,博主:0 条
  1. avatar
    雨曼晴川发布于: 

    你好!我按照你的步骤操作,最后访问不到啊。加完缓存就加载不出网页,请教一下这是什么原因,谢谢!

  2. avatar
    Streaming Jav Online Free发布于: 

    What you posted was very reasonable. However, what about this?
    suppose you were to write a killer post title? I ain’t suggesting your information isn’t solid, however suppose you added a
    headline that grabbed folk’s attention? I mean Nextcloud/ownCloud配置APCu本地缓存+Memcached分布式缓存 –
    橙叶博客 is kinda boring. You could peek at Yahoo’s home page and see how they create post headlines to get people interested.
    You might try adding a video or a related pic or two to get people excited about what you’ve written. In my
    opinion, it could make your posts a little bit more interesting.

  3. avatar
    大信发布于: 

    大侠,冒昧打扰。根据上述文档,在安装apcu出错,特向您求助:
    环境:Ubuntu17.10,PHP7.1(Ubuntu17.10版不支持低版本PHP)
    安装apcu命令:apt-get install php5-apcu/trusty-backports
    报错内容:
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package php5-apcu
    ———————–
    将php5-apcu换成 php7-,php7.1-也是同样的报错信息。请问应该怎么办?

  4. avatar
    小鱼发布于: 

    我添加memcached时,网站无法打开,memcached都可以正常运行,我应该如何去查找问题?

发表评论