「Moodleの移行」の版間の差分

提供:MoodleDocs
移動先:案内検索
12行目: 12行目:
* '''データディレクトリ (moodledata) のコンテンツをコピーする''' - あなたのデータディレクトリのコンテンツ (<code>$CFG->dataroot</code> の設定値を確認してください) を新しいサーバにコピーしてください。新しいデータディレクトリにおいてもファイルのパーミッションが同じになっているか確認してください。また、あなたが新しいサーバでデータディレクトリの場所を変更した場合、<code>$CFG->dataroot</code> の設定値を変更してください。
* '''データディレクトリ (moodledata) のコンテンツをコピーする''' - あなたのデータディレクトリのコンテンツ (<code>$CFG->dataroot</code> の設定値を確認してください) を新しいサーバにコピーしてください。新しいデータディレクトリにおいてもファイルのパーミッションが同じになっているか確認してください。また、あなたが新しいサーバでデータディレクトリの場所を変更した場合、<code>$CFG->dataroot</code> の設定値を変更してください。
* '''あなたのMoodle URIを変更する''' - あなたが新しいURIを使用する場合、Moodleデータベースを新しいURI用に変更する必要があります。この作業は、写真、ファイルへのリンク等、古い<code>$CFG->wwwroot</code>の設定値を参照する絶対リンクとして保存されたデータを変更するため必要です。Moodleサーバに関するMySQLバックアップダンプをそのまま読み込む場合、絶対参照リンクが壊れてしまいます。新しいURIに変更するには、2つの方法があります:
* '''あなたのMoodle URIを変更する''' - あなたが新しいURIを使用する場合、Moodleデータベースを新しいURI用に変更する必要があります。この作業は、写真、ファイルへのリンク等、古い<code>$CFG->wwwroot</code>の設定値を参照する絶対リンクとして保存されたデータを変更するため必要です。Moodleサーバに関するMySQLバックアップダンプをそのまま読み込む場合、絶対参照リンクが壊れてしまいます。新しいURIに変更するには、2つの方法があります:
:(a) 最初の方法では、Moodleデータベースをバックアップする直前、あなたのサイトが稼動している場合、Moodleスクリプト「replace.php」を使用して、Moodle URIを変更します。Point your browser to <nowiki>http://yourserver.com/admin/replace.php</nowiki>
:(a) 最初の方法では、Moodleデータベースをバックアップする直前、あなたのサイトが稼動している場合、Moodleスクリプト「replace.php」を使用して、Moodle URIを変更します。あなたのブラウザに次のURIを入力してください: <nowiki>http://yourserver.com/admin/replace.php</nowiki>


:Enter the url for your old server (<nowiki>http://oldserver.com/</nowiki>) and new server (<nowiki>http://newserver.com/</nowiki>) 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.
:Enter the url for your old server (<nowiki>http://oldserver.com/</nowiki>) and new server (<nowiki>http://newserver.com/</nowiki>) 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.

2008年10月14日 (火) 15:23時点における版

作成中です - Mitsuhiro Yoshida 2008年10月4日 (土) 11:35 (CDT)

あなたのMoodleサイトを別のサーバに移動する必要が生じる場合もあることでしょう。例えば、共有ホスティングから専用サーバに移行する場合等です - これは、あなたのMoodleサイトの移行 (migration) として知られています。よくやってしまう間違いで、気を付ける必要があるのは、あなたのMoodleの設定ファイル「config.php」の詳細を忘れずに変更することです。

完全なMoodleサイトを移行する - 方法1

ここでは、サイト全体を1台のサーバから別のサーバに移行することも含みます。あなたが新しいサーバに対して、新しいドメイン/IPアドレスを変更する場合、以下のステップを実行してください:

  • メンテナンスモード - Moodleデータベースにデータが新たに追加されることを防ぐため、あなたの現在のMoodleサイトをメンテナンスモードに変更してください。移行中は、メンテナンスモードに影響を受けない管理者をログインさせないでください。
  • あなたのMoodleデータベースをバックアップする - MySQLダンプの説明を含む、Moodleのアップグレードページのインストラクションに従ってください。
  • Moodleソフトウェアをコピーする - Moodleコード自体を新しいサーバにコピーしてください - 可能でしたら、コードを最新のものにアップグレードしてください。
  • $CFG->wwwrootを変更する - あなたの (可能であれば新しい) Moodleディレクトリ内で、「config.php」ファイルの $CFG->wwwroot 変数を新しいサーバに合わせて変更してください。
  • データディレクトリ (moodledata) のコンテンツをコピーする - あなたのデータディレクトリのコンテンツ ($CFG->dataroot の設定値を確認してください) を新しいサーバにコピーしてください。新しいデータディレクトリにおいてもファイルのパーミッションが同じになっているか確認してください。また、あなたが新しいサーバでデータディレクトリの場所を変更した場合、$CFG->dataroot の設定値を変更してください。
  • あなたのMoodle URIを変更する - あなたが新しいURIを使用する場合、Moodleデータベースを新しいURI用に変更する必要があります。この作業は、写真、ファイルへのリンク等、古い$CFG->wwwrootの設定値を参照する絶対リンクとして保存されたデータを変更するため必要です。Moodleサーバに関するMySQLバックアップダンプをそのまま読み込む場合、絶対参照リンクが壊れてしまいます。新しいURIに変更するには、2つの方法があります:
(a) 最初の方法では、Moodleデータベースをバックアップする直前、あなたのサイトが稼動している場合、Moodleスクリプト「replace.php」を使用して、Moodle URIを変更します。あなたのブラウザに次のURIを入力してください: 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
ヒント: You may want to check the mysqldump file to see how the old server was referenced.
After changing the URL, restore the mysql database
  • 移行をテストする - 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.

関連情報: Forum discussion on migrating Moodle's data directory on a Windows system.

完全なMoodleサイトを移行する - 方法2

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

It is also useful for creating snapshots or test sites.

  • Set up a new empty database on the new server.
  • Place your Moodle site into maintenance mode.
  • Login to shell on the old 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:
rsync -av -e ssh SOURCE/ USERNAME@NEW_SERVER.COM:/PATH/TO/DESTINATION/
  • 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 admin/replace.php to search and replace the old uri for the new.
  • Make sure everything is working.

Takes about 15 minutes.

When 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.

他に考慮すべきポイント

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 upgrading moodle, otherwise check if your host can upgrade for you.

サーバ間の単一コースリストア

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 $@FILEPHP@$.

For example, replace http://yourserver.com/file.php/243/ with $@FILEPHP@$

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

DNSおよびマスカレーディングの変更

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. See the masquerading docs.

内部および外部アクセス

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.

関連情報

Using Moodleフォーラムディスカッション: