installing_apcu_memcache_nextcloud_27_0_ubuntu_22_04
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
installing_apcu_memcache_nextcloud_27_0_ubuntu_22_04 [2023/06/25 03:54] – created wikiadmin | installing_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 1: | Line 1: | ||
====== Installing APCu Memcache for NextCloud 27.0 on Ubuntu 22.04 ====== | ====== Installing APCu Memcache for NextCloud 27.0 on Ubuntu 22.04 ====== | ||
+ | |||
+ | Reference: [[https:// | ||
APCu is a data cache, and it is available in most Linux distributions. On Red Hat/ | APCu is a data cache, and it is available in most Linux distributions. On Red Hat/ | ||
Line 81: | Line 83: | ||
</ | </ | ||
- | Which shows the config.php file | + | Which lists the config.php file |
- | <cod> | + | <code> |
sudo vim config.php | sudo vim config.php | ||
</ | </ | ||
- | Edit the file with vim editor to insert the following line: | + | Edit the file with vim editor to insert the following line and save the change and exit Vim: |
< | < | ||
' | ' | ||
</ | </ | ||
+ | |||
+ | Refresh your Nextcloud admin page, and the cache warning should disappear. In other words, while logged into NextCloud as an ' | ||
+ | |||
+ | **Warning** | ||
+ | |||
+ | 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. | ||
+ | |||
+ | < | ||
+ | cd / | ||
+ | |||
+ | ls | ||
+ | |||
+ | |||
+ | [which should list the ' | ||
+ | </ | ||
+ | |||
+ | Use vim to edit the php.ini file, and insert the following content, and save the php.ini file, and then restart the apache2 service. | ||
+ | |||
+ | < | ||
+ | sudo vim php.ini | ||
+ | </ | ||
+ | |||
+ | There is no section of the php.ini file named APCu. There is no line containing the setting ' | ||
+ | So, within vim, page down to the end of the php.ini file content and click the INS key in Vim to enter the Insert mode. Prese Enter key twice after that last line setting in the file in order to add a new line. On the new line, enter the following setting. | ||
+ | |||
+ | < | ||
+ | apc.enable-cli=1 | ||
+ | </ | ||
+ | |||
+ | Save the php.ini file with this edited content. | ||
+ | |||
+ | < | ||
+ | sudo systemctl restart apache2 | ||
+ | </ | ||
+ | |||
+ | Temporarily place a phpinfo.php file in any website on the server, and then access it from a web browser and locate the APCu section setttings to ensure that " | ||
+ | |||
+ | 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, | ||
+ | |||
+ | **Although APCu is now configured as a memcache for data, we may still need to install and configure ' | ||
+ | |||
+ | ===== 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/ | ||
+ | ** | ||
+ | |||
+ | On CentOS and Fedora install redis and php-pecl-redis. It will not start automatically, | ||
+ | |||
+ | You can verify that the Redis daemon is running with ps ax: | ||
+ | |||
+ | |||
+ | < | ||
+ | ps ax | grep redis | ||
+ | 22203 ? Ssl 0:00 / | ||
+ | </ | ||
+ | |||
+ | 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, | ||
+ | |||
+ | < | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | Additionally, | ||
+ | |||
+ | < | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | 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. | ||
+ | |||
+ | < | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | 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===== | ||
+ | |||
+ | < | ||
+ | ** | ||
+ | * Memory caching backend configuration | ||
+ | * | ||
+ | * Available cache backends: | ||
+ | * | ||
+ | * * ``\OC\Memcache\APCu`` | ||
+ | * * ``\OC\Memcache\ArrayCache`` In-memory array-based backend (not recommended) | ||
+ | * * ``\OC\Memcache\Memcached`` | ||
+ | * * ``\OC\Memcache\Redis`` | ||
+ | * | ||
+ | * Advice on choosing between the various backends: | ||
+ | * | ||
+ | * * APCu should be easiest to install. Almost all distributions have packages. | ||
+ | | ||
+ | * * Use Redis or Memcached for distributed environments. | ||
+ | | ||
+ | */ | ||
+ | |||
+ | /** | ||
+ | * Memory caching backend for locally stored data | ||
+ | * | ||
+ | * * Used for host-specific data, e.g. file paths | ||
+ | * | ||
+ | * Defaults to ``none`` | ||
+ | */ | ||
+ | ' | ||
+ | |||
+ | /** | ||
+ | * 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`` | ||
+ | */ | ||
+ | ' | ||
+ | |||
+ | /** | ||
+ | * 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:// | ||
+ | * for more information. | ||
+ | * | ||
+ | * We also support redis SSL/TLS encryption as of version 6. | ||
+ | * See https:// | ||
+ | */ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | // If redis in-transit encryption is enabled, provide certificates | ||
+ | // SSL context https:// | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ] | ||
+ | ], | ||
+ | |||
+ | /** | ||
+ | * Connection details for a Redis Cluster. | ||
+ | * | ||
+ | * Redis Cluster support requires the php module phpredis in version 3.0.0 or | ||
+ | * higher. | ||
+ | * | ||
+ | * Available failover modes: | ||
+ | | ||
+ | | ||
+ | | ||
+ | * | ||
+ | * 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:// | ||
+ | * | ||
+ | * Authentication works with phpredis version 4.2.1+. See | ||
+ | * https:// | ||
+ | */ | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ], | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | // If redis in-transit encryption is enabled, provide certificates | ||
+ | // SSL context https:// | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ] | ||
+ | ], | ||
+ | |||
+ | |||
+ | /** | ||
+ | * Server details for one or more memcached servers to use for memory caching. | ||
+ | */ | ||
+ | ' | ||
+ | // hostname, port and optional weight | ||
+ | // or path and port 0 for unix socket. Also see: | ||
+ | // https:// | ||
+ | // https:// | ||
+ | [' | ||
+ | // | ||
+ | ], | ||
+ | |||
+ | /** | ||
+ | * Connection options for memcached | ||
+ | */ | ||
+ | ' | ||
+ | // Set timeouts to 50ms | ||
+ | \Memcached:: | ||
+ | \Memcached:: | ||
+ | \Memcached:: | ||
+ | \Memcached:: | ||
+ | \Memcached:: | ||
+ | |||
+ | // Enable compression | ||
+ | \Memcached:: | ||
+ | |||
+ | // Turn on consistent hashing | ||
+ | \Memcached:: | ||
+ | |||
+ | // Enable Binary Protocol | ||
+ | \Memcached:: | ||
+ | |||
+ | // Binary serializer vill be enabled if the igbinary PECL module is available | ||
+ | // | ||
+ | ], | ||
+ | |||
+ | |||
+ | /** | ||
+ | * Location of the cache folder, defaults to ``data/ | ||
+ | * ``$user`` is the current user. When specified, the format will change to | ||
+ | * ``$cache_path/ | ||
+ | * and ``$user`` is the user. | ||
+ | * | ||
+ | * Defaults to ``'' | ||
+ | */ | ||
+ | ' | ||
+ | |||
+ | /** | ||
+ | * TTL of chunks located in the cache folder before they' | ||
+ | * 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) | ||
+ | */ | ||
+ | ' | ||
+ | |||
+ | |||
+ | </ | ||
+ | | ||
+ |
installing_apcu_memcache_nextcloud_27_0_ubuntu_22_04.1687665299.txt.gz · Last modified: 2023/06/25 03:54 by wikiadmin