Upgrading 3.1.5 to 3.4.1

Upgrading 3.1.5 to 3.4.1

Alain Raap -
回帖数:7
Particularly helpful Moodlers的头像

I'm researching an upgrade from Moodle 3.1.5 to 3.4.1. I have our website running on Redhat 7.3 with Apache 2.4, PHP5.6 and
MariaDB 10.1.

I managed to upgrade the website to 3.4.1, what I see is that my php Memcached extension is not included in PHP 7.1 anymore in our Redhat distribution. And I found out that in the plugins caching I got some problems with the Memcache configuration (I can't delete the configured Memcache instance).

We're using Memcached server with Moodle 3.1.5, and that works fine. Anyone who has had the same experiences?

I found some problems on this issue here https://github.com/php-memcached-dev/php-memcached/issues/269, this post from Jeff White https://moodle.org/mod/forum/discuss.php?d=343949 and this tutorial https://serversforhackers.com/c/installing-php-7-with-memcached

What's the best way to upgrade and is it required to keep using Memcached server with PHP 7.1?  

回复Alain Raap

Re: Upgrading 3.1.5 to 3.4.1

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

By not doing... switch to Redis perhaps?

BTW... you don't say where PHP came from but I seem to recall installing 5.6 some time ago from Webtatic and having to compile the memcached client from the latest github source to get a version that worked. 

回复Howard Miller

Re: Upgrading 3.1.5 to 3.4.1

Alain Raap -
Particularly helpful Moodlers的头像

Hi Howard, that's my  point of view too, we're going to use another caching server, probably redis.

回复Howard Miller

Re: Upgrading 3.1.5 to 3.4.1

Alain Raap -
Particularly helpful Moodlers的头像

I've been able to install and configuring redis on Moodle 3.4.1. I'd like to share how I got it working on Redhat 7.3

installed redis:
- yum install redis php-pecl-redis

(sudo) systemctl enable redis.service
(sudo) systemctl start redis.service

In /etc/opt/rh/rh-php71/php.ini I changed:
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379"

In /etc/opt/rh/rh-php71/php-fpm.d/www.conf I changed:
php_value[session.save_handler] = redis
php_value[session.save_path] = "tcp://127.0.0.1:6379"

In Moodle config.php I changed session caching to:
$CFG->session_handler_class = '\core\session\redis';
$CFG->session_redis_host = '127.0.0.1';
$CFG->session_redis_port = 6379;  // Optional.
$CFG->session_redis_database = 0;  // Optional, default is db 0.
$CFG->session_redis_auth = ''; // Optional, default is don't set one.
$CFG->session_redis_prefix = ''; // Optional, default is don't set one.
$CFG->session_redis_acquire_lock_timeout = 120;
$CFG->session_redis_lock_expire = 7200;
// Use the igbinary serializer instead of the php default one. Note that phpredis must be compiled with
// igbinary support to make the setting to work. Also, if you change the serializer you have to flush the database!
$CFG->session_redis_serializer_use_igbinary = false; // Optional, default is PHP builtin serializer.

I had to compile phpredis for php71 on my development server:

yum install rh-php71-php-devel
yum install rh-php71-php-pear
yum install gcc

I downloaded https://github.com/phpredis/phpredis/archive/master.zip and renamed the file to phpredis.zip
Uploaded to  /tmp on my development server:

export PATH=$PATH:/opt/rh/rh-php71/root/usr/include:/opt/rh/rh-php71/root/usr/bin
cd /tmp
unzip -o /tmp/phpredis.zip && mv /tmp/phpredis-* /tmp/phpredis && cd /tmp/phpredis && /opt/rh/rh-php71/root/usr/bin/phpize && ./configure && make && sudo make install

Test if redis works:

/usr/bin/redis-cli monitor
Should return OK (and what is sent on the network to the redis server)

Configure redis in Moodle Admin console, add redis-server cache with address: 127.0.0.1:6379

Tested test_redis.php script in the Moodle application directory:
/usr/local/bin/php test_redis.php --generate
/usr/local/bin/php test_redis.php --login
/usr/local/bin/php test_redis.php --delete

Also check the php-info in Admin console, redis should be loaded as a module.
I didn't look at redis-igbinary, I wasn't able to compile it for php 7.1.

Some useful links I used:

https://anton.logvinenko.name/en/blog/how-to-install-redis-and-redis-php-client.html
https://tracker.moodle.org/browse/MDL-54606
https://tracker.moodle.org/browse/MDL-48468
https://redis.io

回复Alain Raap

Re: Upgrading 3.1.5 to 3.4.1

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

I got this working on Ubuntu with rather less bother. 

I followed the following - https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04  (I was on 17.10 but it still worked fine).

The Redis php driver is available as a package, so just 'sudo apt install php-redis'.

Job done.

回复Howard Miller

Re: Upgrading 3.1.5 to 3.4.1

Alain Raap -
Particularly helpful Moodlers的头像

That didn't work for me unfortunately. Any tips on tweaking redis caching for Moodle?

I get these warnings when I start the redis service:

5976:M 05 Mar 15:47:02.308 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
5976:M 05 Mar 15:47:02.308 # Server started, Redis version 3.2.10
5976:M 05 Mar 15:47:02.308 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
5976:M 05 Mar 15:47:02.308 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

回复Alain Raap

Re: Upgrading 3.1.5 to 3.4.1

Alain Raap -
Particularly helpful Moodlers的头像

I found this message about these warnings that could be useful to solve them:

https://github.com/bitnami/bitnami-docker-redis/issues/82