installing_apcu_memcache_nextcloud_27_0_ubuntu_22_04

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
installing_apcu_memcache_nextcloud_27_0_ubuntu_22_04 [2023/06/25 05:43] wikiadmininstalling_apcu_memcache_nextcloud_27_0_ubuntu_22_04 [2023/06/25 06:28] (current) – [Contents of config.sample.php with respect to MemCache Configuration] wikiadmin
Line 97: Line 97:
 Refresh your Nextcloud admin page, and the cache warning should disappear. In other words, while logged into NextCloud as an 'admin' group user, access or refresh "Overview" in the "Administration" menu section and the warning message, that a memcache has not been installed, is gone. Well, it's gone if everything was done properly.  There is no need at this point to restart the apache2 service in order to obtain this result. Refresh your Nextcloud admin page, and the cache warning should disappear. In other words, while logged into NextCloud as an 'admin' group user, access or refresh "Overview" in the "Administration" menu section and the warning message, that a memcache has not been installed, is gone. Well, it's gone if everything was done properly.  There is no need at this point to restart the apache2 service in order to obtain this result.
  
-**Warning*.*  The NextCloud documentation states that --+**Warning**  The NextCloud documentation states that --
  
 APCu is disabled by default on CLI which could cause issues with nextcloud’s cron jobs. **Please make sure you set the apc.enable_cli to 1 on your php.ini config file** or append --define apc.enable_cli=1 to the cron job call. APCu is disabled by default on CLI which could cause issues with nextcloud’s cron jobs. **Please make sure you set the apc.enable_cli to 1 on your php.ini config file** or append --define apc.enable_cli=1 to the cron job call.
Line 133: Line 133:
 Check the administrative panel of NextCloud and see if any warning disappears. Check the administrative panel of NextCloud and see if any warning disappears.
  
 +There should still be a couple/few warnings in Administration / Overview, including the following:
 +
 +**"The database is used for transactional file locking. To enhance performance, please configure memcache, if available. See the documentation for more information."**
 +
 +**Although APCu is now configured as a memcache for data, we may still need to install and configure 'Redis' for file locking and distributed, but not local.  Continue to use APCu for local memcache. So, configure both APCu and Redis to handle different things** 
 +
 +===== Redis =====
 +
 +Redis is an excellent modern memcache to use for distributed caching, and as a key-value store for Transactional File Locking because it guarantees that cached objects are available for as long as they are needed.
 +
 +The Redis PHP module must be version 2.2.6+. If you are running a Linux distribution that does not package the supported versions of this module, or does not package Redis at all, see install_redis_label.
 +
 +**On Debian/Ubuntu/Mint install redis-server and php-redis. The installer will automatically launch redis-server and configure it to launch at startup.
 +**
 +
 +On CentOS and Fedora install redis and php-pecl-redis. It will not start automatically, so you must use your service manager to start redis, and to launch it at boot as a daemon.
 +
 +You can verify that the Redis daemon is running with ps ax:
 +
 +
 +<code>
 +ps ax | grep redis
 +22203 ? Ssl    0:00 /usr/bin/redis-server 127.0.0.1:6379
 +</code>
 +
 +Restart your Web server, add the appropriate entries to your config.php, and refresh your Nextcloud admin page.
 +
 +**Redis configuration in Nextcloud (config.php)
 +**
 +
 +**For best performance, use Redis for file locking by adding this:**
 +
 +<code>
 +'memcache.locking' => '\OC\Memcache\Redis',
 +</code>
 +
 +Additionally, you should use Redis for the distributed server cache:
 +
 +<code>
 +'memcache.distributed' => '\OC\Memcache\Redis',
 +</code>
 +
 +Further more, you could use Redis for the local cache like so, but it’s not recommended (see warning below).
 +
 +Also, recall that we already installed and configure config.php for APCu as memcache.local.  So, the following setting should probably be omitted or skipped.  Memcache.local is already addressed by APCu setting.
 +
 +<code>
 +'memcache.local' => '\OC\Memcache\Redis',
 +</code>
 +
 +Warning
 +
 +Using Redis for local cache on a multi-server setup can cause issues. Also, even on a single-server setup, APCu (see section above) should be faster. 
 +
 +===== Contents of config.sample.php with respect to MemCache Configuration=====
 +
 +<code>
 +**
 + * Memory caching backend configuration
 + *
 + * Available cache backends:
 + *
 + * * ``\OC\Memcache\APCu``       APC user backend
 + * * ``\OC\Memcache\ArrayCache`` In-memory array-based backend (not recommended)
 + * * ``\OC\Memcache\Memcached``  Memcached backend
 + * * ``\OC\Memcache\Redis``      Redis backend
 + *
 + * Advice on choosing between the various backends:
 + *
 + * * APCu should be easiest to install. Almost all distributions have packages.
 +   Use this for single user environment for all caches.
 + * * Use Redis or Memcached for distributed environments.
 +   For the local cache (you can configure two) take APCu.
 + */
 +
 +/**
 + * Memory caching backend for locally stored data
 + *
 + * * Used for host-specific data, e.g. file paths
 + *
 + * Defaults to ``none``
 + */
 +'memcache.local' => '\OC\Memcache\APCu',
 +
 +/**
 + * Memory caching backend for distributed data
 + *
 + * * Used for installation-specific data, e.g. database caching
 + * * If unset, defaults to the value of memcache.local
 + *
 + * Defaults to ``none``
 + */
 +'memcache.distributed' => '\OC\Memcache\Memcached',
 +
 +/**
 + * Connection details for redis to use for memory caching in a single server configuration.
 + *
 + * For enhanced security it is recommended to configure Redis
 + * to require a password. See http://redis.io/topics/security
 + * for more information.
 + *
 + * We also support redis SSL/TLS encryption as of version 6.
 + * See https://redis.io/topics/encryption for more information.
 + */
 +'redis' => [
 +        'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock'
 +        'port' => 6379,
 +        'timeout' => 0.0,
 +        'read_timeout' => 0.0,
 +        'user' =>  '', // Optional: if not defined, no password will be used.
 +        'password' => '', // Optional: if not defined, no password will be used.
 +        'dbindex' => 0, // Optional: if undefined SELECT will not run and will use Redis Server's default DB Index.
 +        // If redis in-transit encryption is enabled, provide certificates
 +        // SSL context https://www.php.net/manual/en/context.ssl.php
 +        'ssl_context' => [
 +                'local_cert' => '/certs/redis.crt',
 +                'local_pk' => '/certs/redis.key',
 +                'cafile' => '/certs/ca.crt'
 +        ]
 +],
 +
 +/**
 + * Connection details for a Redis Cluster.
 + *
 + * Redis Cluster support requires the php module phpredis in version 3.0.0 or
 + * higher.
 + *
 + * Available failover modes:
 +  - \RedisCluster::FAILOVER_NONE - only send commands to master nodes (default)
 +  - \RedisCluster::FAILOVER_ERROR - failover to slaves for read commands if master is unavailable (recommended)
 +  - \RedisCluster::FAILOVER_DISTRIBUTE - randomly distribute read commands across master and slaves
 + *
 + * WARNING: FAILOVER_DISTRIBUTE is a not recommended setting, and we strongly
 + * suggest to not use it if you use Redis for file locking. Due to the way Redis
 + * is synchronized it could happen, that the read for an existing lock is
 + * scheduled to a slave that is not fully synchronized with the connected master
 + * which then causes a FileLocked exception.
 + *
 + * See https://redis.io/topics/cluster-spec for details about the Redis cluster
 + *
 + * Authentication works with phpredis version 4.2.1+. See
 + * https://github.com/phpredis/phpredis/commit/c5994f2a42b8a348af92d3acb4edff1328ad8ce1
 + */
 +'redis.cluster' => [
 +        'seeds' => [ // provide some or all of the cluster servers to bootstrap discovery, port required
 +                'localhost:7000',
 +                'localhost:7001',
 +        ],
 +        'timeout' => 0.0,
 +        'read_timeout' => 0.0,
 +        'failover_mode' => \RedisCluster::FAILOVER_ERROR,
 +        'user' =>  '', // Optional: if not defined, no password will be used.
 +        'password' => '', // Optional: if not defined, no password will be used.
 +        // If redis in-transit encryption is enabled, provide certificates
 +        // SSL context https://www.php.net/manual/en/context.ssl.php
 +        'ssl_context' => [
 +                'local_cert' => '/certs/redis.crt',
 +                'local_pk' => '/certs/redis.key',
 +                'cafile' => '/certs/ca.crt'
 +        ]
 +],
 +
 +
 +/**
 + * Server details for one or more memcached servers to use for memory caching.
 + */
 +'memcached_servers' => [
 +        // hostname, port and optional weight
 +        // or path and port 0 for unix socket. Also see:
 +        // https://www.php.net/manual/en/memcached.addservers.php
 +        // https://www.php.net/manual/en/memcached.addserver.php
 +        ['localhost', 11211],
 +        //array('other.host.local', 11211),
 +],
 +
 +/**
 + * Connection options for memcached
 + */
 +'memcached_options' => [
 +        // Set timeouts to 50ms
 +        \Memcached::OPT_CONNECT_TIMEOUT => 50,
 +        \Memcached::OPT_RETRY_TIMEOUT =>   50,
 +        \Memcached::OPT_SEND_TIMEOUT =>    50,
 +        \Memcached::OPT_RECV_TIMEOUT =>    50,
 +        \Memcached::OPT_POLL_TIMEOUT =>    50,
 +
 +        // Enable compression
 +        \Memcached::OPT_COMPRESSION =>          true,
 +
 +        // Turn on consistent hashing
 +        \Memcached::OPT_LIBKETAMA_COMPATIBLE => true,
 +
 +        // Enable Binary Protocol
 +        \Memcached::OPT_BINARY_PROTOCOL =>      true,
 +
 +        // Binary serializer vill be enabled if the igbinary PECL module is available
 +        //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY,
 +],
 +
 +
 +/**
 + * Location of the cache folder, defaults to ``data/$user/cache`` where
 + * ``$user`` is the current user. When specified, the format will change to
 + * ``$cache_path/$user`` where ``$cache_path`` is the configured cache directory
 + * and ``$user`` is the user.
 + *
 + * Defaults to ``''`` (empty string)
 + */
 +'cache_path' => '',
 +
 +/**
 + * TTL of chunks located in the cache folder before they're removed by
 + * garbage collection (in seconds). Increase this value if users have
 + * issues uploading very large files via the Nextcloud Client as upload isn't
 + * completed within one day.
 + *
 + * Defaults to ``60*60*24`` (1 day)
 + */
 +'cache_chunk_gc_ttl' => 60*60*24,
 +
 +
 +</code>
 +        
  
installing_apcu_memcache_nextcloud_27_0_ubuntu_22_04.1687671838.txt.gz · Last modified: 2023/06/25 05:43 by wikiadmin