Moodle: Copy Database
A Moodle system comprises three parts:
- The data stored in the database (For example, a MySQL database)
- The uploaded files (For example, site and course files uploaded via Moodle located in moodledata)
- The Moodle code (For example, everything in server/htdocs/moodle)
You can confirm where all these things are located in a Moodle installation by checking the config.php file.
- $CFG->dbname shows the database name
- $CFG->prefix shows the the database table name prefix
- $CFG->dataroot controls where the uploaded files are stored; and
- $CFG->wwwroot points to where the code is stored.
Tip
Generally speaking, the database ("dbname and prefix") and the uploaded files (dataroot) are the two most important to copy on a regular basis. These contain information that will change most often.
The Moodle code (wwwroot) is less important as a frequent backup, since it will only change when the the actual code is changed through upgrades, addins and code tweaks. You can always get a copy of the standard Moodle code from http://download.moodle.org so you only have to backup the parts you added or changed yourself.
menggunakan moodle_backup.php
- Download dari
http://cvs.moodle.org/contrib/tools/moodle_backup/moodle_backup.php http://cvs.moodle.org/contrib/tools/moodle_backup/moodle_backup.php?view=co
- buat script
cd /usr/local/bin vi moodle_backup.php
menggunakan mysqldump
WARNING: Entah kenapa password user jadi beda / berubah, kayanya karena hash
- Install Moodle Kosong di mesin mirror
- di mesin asal
/usr/bin/mysqldump -u root -p123456 moodle -c | /bin/gzip -9 > moodle.sql.gz scp moodle.sql.gz stkip@10.150.5.249:
- di mesin mirror
cd ~ gunzip moodle.sql.gz sudo mysqladmin --user=root --password=123456 --force drop moodle sudo mysqladmin --user=root --password=123456 create moodle sudo mysql -u moodle -pmoodle moodle < ~/moodle.sql
scp database
WARNING: Cara ini akan menimbulkan error karena banyak yang kurang lengkap
mysql -u root -p123456 create database moodle; ALTER DATABASE moodle charset=utf8; grant ALL on root.* to moodle@localhost; grant ALL on moodle.* to moodle@localhost identified by "moodle"; grant ALL on moodle.* to moodle identified by "moodle"; exit
scp -r root@10.150.5.250:/var/lib/mysql/moodle /var/lib/mysql scp -r root@10.150.5.250:/var/moodledata /var scp -r root@10.150.5.250:/var/www/moodle /var/www chmod -Rf 777 /var/moodledata/lang/ chown -Rf www-data.www-data /var/moodledata/lang/ chown -Rf www-data.www-data /var/moodledata/ chmod -Rf 777 /var/www/moodle chown -Rf www-data.www-data /var/www/moodle chown -Rf mysql.mysql /var/lib/mysql/moodle
config.php:$CFG->wwwroot = 'http://10.150.5.250/moodle'; vi /var/www/moodle/config.php
Referensi
- http://www.edugeek.net/forums/virtual-learning-platforms/37174-moodle-linux-backup-script.html
- http://docs.moodle.org/22/en/Site_restore
- http://docs.moodle.org/22/en/Site_backup
- http://cvs.moodle.org/contrib/tools/moodle_backup/moodle_backup.php?view=log&pathrev=MOODLE_22_STABLE
Pranala Menarik
- Moodle
- Instalasi Moodle
- Moodle: Mengubah Hostname atau wwwroot
- Moodle: Konfigurasi CMS
- Moodle: Administrasi User
- SchoolOnffLine: Moodle Upload User
- Moodle: Administrasi Kuliah
- Moodle: Install Dragmath
- Moodle: Penggunaan Dragmath
- Moodle: Aktifasi Latex
- Moodle: Authentikasi LDAP
- Moodle: Copy Database
- Linux Howto