Migración de Moodle

Saltar a: navegación, buscar

Nota: Esta es una traducción de una página de la documentación en idioma Inglés (Docs), que se considera particularmente importante, y que en su versión original se actualiza frecuentemente. Por ello, se le recomienda que revise la página original en idioma inglés: Moodle migration.

Esta página necesita actualizarse con la información existente en la documentación vigente/moderna/actualizada en el idioma inglés original para Moodle. Se le sugiere al lector que consulte la página original en idioma inglés cuyo enlace está al fondo de esta página. y que, por favor, actualice esta información y quite la plantilla {{Actualizar}} cuando haya terminado.     (otras páginas pendientes de actualizar)

Hay ocasiones en las que usted necesita mover su sitio Moodle de un servidor a otro. Por ejemplo, al mover un sitio Moodle desde un servidor en alojamiento compartido hacia un servidor dedicado.

Tip: Un error común en la migración es por olvidarse de actualizar los detalles en el archivo config.php del Moodle migrado

Migrando un sitio Moodle completo - método 1

This involves moving a whole site from one server to another. If you are changing the domain/IP address to the new server you need to do these steps:

  • Maintenance mode. Place your current Moodle site in maintenance mode to prevent any further additions to the Moodle database. Don't let administrators login during the migration as they are not affected by the maintenance mode setting.
  • Backup your current Moodle database. Do this by following the instructions in the actualizar Moodle or Respaldo del sitio page. This will give you a text file containing the mysql dump.
  • Copy the Moodle software. You will need to copy the Moodle code itself to the new server - upgrade the code to the latest version if you can.
  • Change
    . In your (possibly new) Moodle directory, change the
    variable in the config.php file for the new server.
  • Copy data directory contents (moodledata). Copy the contents of your data directory (check for the value in
    ) to the new server.
  • Review moodledata permissions. Check also that permissions remain the same on the new dataroot folder and change the value if you have changed its location on the new server.
  • Change your Moodle URL. If you have a new URL, you'll need to change this in the Moodle database to the new server. This is needed as links to pictures, files, etc are stored as absolute links and will reference the old
    value. So when loading a mysql backup dump of the Moodle server into mysql on another server the absolute referenced links will be broken. There are two methods of doing this:
(a) The first method changes the Moodle URL using the Moodle script replace.php while your site is currently running just before you backup the Moodle database. Point your browser to yourserver.com/admin/tool/replace/index.php or in older versions http://yourserver.com/admin/replace.php
Enter the url for your old server (http://oldserver.com/) and new server (http://newserver.com/) and it will fix the mysql tables. You will also need to clear out any cached links by restarting your webserver. Now, take another backup of the Moodle database - this one will have the correct URLs.
(b) The second method is to backup the Moodle database first, then use the search and replace feature of your text editor (or use a unix tool like sed) to replace the old URL with the new one in the mysql backup file. Here is an example sed command:
#sed -e 's/oldserver.com/newserver.com/g' oldmysqldump.sql > newmysqldump.sql
NOTE: This second method will not replace text in blocks because they are stored base64 encoded in the database, so any links in blocks will not be fixed. Therefore you should consider using the replace tool after you migrate if you use this second method.
TIP: You may want to check the mysqldump file to see how the old server was referenced.
After changing the URL, restore the mysql database
  • Test the migration. To test the new install, access Moodle using your browser and the new server's URL. When you have tested that a number of links in the courses work, take the new Moodle site out of maintenance mode.

See also: Forum discussion on migrating Moodle's data directory on a Windows system.

Migrando un sitio Moodle completo - método 2

Do you have shell access on both servers? If so, the following method is a very quick and efficient method to migrate a Unix based site.

It is also useful for creating snapshots or test sites.

  • Set up a new empty database on the new server.
  • Place your existing Moodle site into maintenance mode.
  • Login to shell on the old existing server.
  • Use rsync to copy moodledata and public_html (or whatever directory your Moodle install is in) to the new server - execute (replacing caps with your details; SOURCE = the directory you want to copy) for each directory:
  • Dump existing database and move and import into database on new server by executing:
mysqldump --allow-keywords --opt -uMySQL_USERNAME -pPASSWORD DATABASE | ssh USER@DOMAIN "mysql -uMySQL_USERNAME -pPASSWORD DATABASE"
  • On the new server, update config.php with relevant details.
  • To fix any internal Moodle links, login to your "new" Moodle install on your new server and use the Herramienta para buscar y remplazar admin tool to search and replace the old uri for the new.
  • Make sure everything is working.</code>

Takes about 15 minutes.

When you are happy all has gone well, set up redirects/make DNS changes if required, take new site out of maintenance mode and "switch off" old site.

Otros puntos a considerar

Los enlaces de URL de imágenes configurados hacia el sitio antiguo

So you built your Moodle Server with a http// address. Then you changed the URL for your site to http://OurMoodle.org/Moodle. You changed the Moodle config file so the CFGs point to the new paths, but your images still point to the old url.

One simple, quick solution is to use the Replace script in Moodle to fix this. Login as admin and enter http://OurMoodle.org/admin/tool/replace/index.php in your browser address bar (or http://OurMoodle.com/admin/replace.php in older versions). Use the two form boxes to change to http://OurMoodle.org/.

This replace function is only supported on Moodle sites that run on MySQL or Postgres databases. See MDL-26597 and MDL-35099.

Actualice Moodle

When migrating Moodle it is often a good idea to take the opportunity to upgrade Moodle to the latest version. If you manage your own server, follow the instructions in actualizar moodle, otherwise check if your host can upgrade for you.

Restaurando un sólo curso entre servidores

You may need to restore a single course from an old site to a new one, especially if you are testing the migration. When restoring a Moodle backup file to Moodle on a different server than the one used to create the backup, the absolute referenced links to files maybe broken. To fix this problem open the backup-coursename.zip file and edit the moodle.xml file replacing links with
. For example, replace http://yourserver.com/file.php/243/ with

When the file is restored it will use the correct file path for the new course.

DNS y cambios en enmascaramiento

You may have had to change the DNS entries for the new Moodle site. If you have done so, it will take some time for the changes to replicate, so be patient. If your server is located behind a firewall, you may also have to change your firewall rules to allow access to the new server. Vea Enmascaramiento.

Acceso interno y externo

If you have a set up where your Moodle site can be accessed via a network and via the internet, ensure you check that the new site can be accessed internally and externally.

Vea también

Discusiones en foros sobre uso de Moodle: