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

提供:MoodleDocs
移動先:案内検索
32行目: 32行目:
*あなたのMoodleサイトをメンテナンスモードに変更してください。
*あなたのMoodleサイトをメンテナンスモードに変更してください。
*'''古い'''サーバのシェルにログインしてください。
*'''古い'''サーバのシェルにログインしてください。
*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:
*Use rsync to copy '''moodledata''' および '''public_html''' (または、あなたのMoodleがインストールされているディレクトリ) を新しいサーバにコピーするには、rsyncを使用してください - execute (replacing caps with your details; SOURCE = the directory you want to copy) for each directory:
::<code>rsync -av -e ssh SOURCE/ USERNAME@NEW_SERVER.COM:/PATH/TO/DESTINATION/</code>
::<code>rsync -av -e ssh SOURCE/ USERNAME@NEW_SERVER.COM:/PATH/TO/DESTINATION/</code>
*Dump existing database and move and import into database on new server by executing:
*Dump existing database and move and import into database on new server by executing:

2008年10月19日 (日) 16:09時点における版

作成中です - 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
あなたの古いサーバのURI (http://oldserver.com/) および新しいサーバのURI (http://newserver.com/) を入力した後、「Yes, do it now」ボタンをクリックしてください。MySQLテーブルが修正されます。また、ウェブサーバを再起動することで、キャッシュされているリンクをクリアしてください。次に、もう一度Moodleデータベースをバックアップします - このバックアップには、正しいURIが含まれています。
(b) 2番目の方法では、最初のMoodleデータベースをバックアップします。次に、あなたのテキストエディタの検索および置換機能 (または、sedのようなUnixnツール) を使用して、MySQLバックアップファイル内の古いURIを新しいURIに入れ替えます。以下、sedコマンドの例です:
#sed -e 's/oldserver.com/newserver.com/g' oldmysqldump.sql > newmysqldump.sql
ヒント: mysqldumpファイルで古いサーバがどのように参照されているのか確認しても良いでしょう。:URIの変更後、MySQLデータベースをリストアしてください。
  • 移行をテストする - 新しいインストールをテストするには、ブラウザを使用して、新しいサーバのMoodleのURIにアクセスしてください。あなたが多数のコースワーク内のリンクを確認できた場合、新しいMoodleサイトのメンテナンスモードを解除してください。

関連情報: フォーラムディスカッション (英語) Windowsシステム内のMoodleデータの移行

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

あなたは、両方のサーバでシェルアクセスできますか? もしそうでしたら、以下の方法は、*nixベースのサイトでMoodleを移行するための、非常に素早い効率的な方法です。

また、スナップショットまたはテストサイトの作成も有用です。

  • 新しい空のデータベースを新しいサーバにセットアップしてください。
  • あなたのMoodleサイトをメンテナンスモードに変更してください。
  • 古いサーバのシェルにログインしてください。
  • Use rsync to copy moodledata および public_html (または、あなたのMoodleがインストールされているディレクトリ) を新しいサーバにコピーするには、rsyncを使用してください - 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フォーラムディスカッション: