Difference between revisions of "Template:VALT Server Migration"

From IVS Wiki
Jump to: navigation, search
(On the Old Server)
 
(22 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Note: Change IP's in the below commands to match the IP's of the new and old server'''
+
__TOC__
 +
<div class="floating_card"><b>Note: Change IP's in the below commands to match the IP's of the new and old server</b></div>
  
 
=On the Old Server=
 
=On the Old Server=
  '''Note: ''It is beneficial to stop the apache service on the old server to prevent further recording of videos on it'''''
 
  
# Type in the following, then press Enter: <pre>sudo chmod 777 -R /usr/local/WowzaStreamingEngine/content/</pre>
+
<div class="section">
# Type in the following, then press Enter: <pre>mysqldump -uivsadmin -p valt > valt.sql</pre>
+
# Disable the Apache web service to prevent further recordings:
#Enter mysql password
+
#: <code>sudo service apache2 stop</code>
#:{{img | file = VALT_Migration_MySQLdump.png}}
+
# Disable the restart Wowza cronjob:
# Type in the following, then press Enter: <pre>scp valt.sql ivsadmin@NewServerIP:/home/ivsadmin/</pre>
+
#: - Type in the following command:
# Enter password for ivsadmin.
+
#:  <code>crontab -e</code>
#:{{img | file = SCP_MySQLdump.png}}
+
#: - Press {{Keyboard | key = 1}} to continue
 +
</div>
 +
 
 +
: {{img | file = Edit_Cronjobs_Command.png}}<br>
 +
 
 +
<div class="section">
 +
<ol start="3">
 +
<li>Comment out the following job:</li>
 +
<code>0 3 * * * /usr/local/valt/bin/restartwowza</code><br>
 +
<li>Press {{Keyboard | key = CTRL}} + {{Keyboard | key = X}} to exit</li>
 +
<li>Press {{Keyboard | key = Y}} to save</li>
 +
</ol>
 +
</div>
 +
 
 +
:{{img | file = Disable_Restart_Wowza_Cronjob.png}}<br>
 +
 
 +
<div class="section">
 +
<ol start="6">
 +
<li>Type in the following, then press {{Keyboard | key = Enter}}:</li>
 +
<code>sudo chmod 777 -R /usr/local/WowzaStreamingEngine/content/</code>
 +
<li>Type in the following, then press {{Keyboard | key = Enter}}:</li>
 +
<code>mysqldump -uivsadmin -p valt > valt.sql</code>
 +
<li>Enter in the MySQL password and press {{Keyboard | key = Enter}}:</li>
 +
</ol>
 +
</div>
 +
 
 +
: {{img | file = VALT_Migration_MySQLdump.png}}<br>
 +
 
 +
<div class="section">
 +
<ol start="9">
 +
<li>Copy over the database file to the new server</li>
 +
<code>scp valt.sql ivsadmin@'''NewServerIP''':/home/ivsadmin/</code>
 +
<li>Enter password for '''ivsadmin''' and press {{Keyboard | key = Enter}}:</li>
 +
</ol>
 +
</div>
 +
: {{img | file = SCP_MySQLdump.png}}
  
 
=On the New Server=
 
=On the New Server=
# Type in the following, then press Enter: <pre>mysql -uivsadmin -p valt</pre>
 
# Type in the password to MySQL.
 
#:{{img | file = MySQL_Login.png}}
 
# Type: <pre>DROP database valt;</pre>
 
#:{{img | file = Database_DROP.png}}
 
# Type:<pre>CREATE database valt;</pre>
 
#:{{img | file = Database_CREATE.png}}
 
# Type in the following, then press Enter: <pre>exit </pre>
 
# Type in the following, then press Enter: <pre>mysql -uivsadmin -p valt < valt.sql</pre>
 
# Enter the password for MySQL.
 
#: {{img | file = Database_IMPORT.png}}
 
# Type in the following, then press Enter: <pre>mysql -uivsadmin -p valt -e "UPDATE wowza SET address = 'NewServerIP'"</pre>
 
# Enter the password for MySQL.
 
#: {{img | file = MySQL_Wowza_Update_Address.png}}
 
  
=Copy the recordings folder to the new server=
+
<div class="section">
{{:Copy the Recordings Folder to a New Server}}
+
# Type in the following and press {{Keyboard | key = Enter}}:
 +
#: <code>mysql -uivsadmin -p valt</code>
 +
# Enter in the MySQL password and press {{Keyboard | key = Enter}}:
 +
</div>
 +
: {{img | file = MySQL_Login.png}}
 +
 
 +
<div class="section">
 +
<ol start="3">
 +
<li>Type in the following and press {{Keyboard | key = Enter}}:</li>
 +
<code>DROP database valt;</code>
 +
</ol>
 +
</div>
 +
 
 +
: :{{img | file = Database_DROP.png}}
 +
 
 +
<div class="section">
 +
<ol start="4">
 +
<li>Type in the following and press {{Keyboard | key = Enter}}:</li>
 +
<code>CREATE database valt;</code>
 +
</ol>
 +
</div>
 +
 
 +
: :{{img | file = Database_CREATE.png}}
 +
 
 +
<div class="section">
 +
<ol start="5">
 +
<li>Type in the following and press {{Keyboard | key = Enter}}:</li>
 +
<code>exit</code>
 +
<li>Type in the following and press {{Keyboard | key = Enter}}:</li>
 +
<code>mysql -uivsadmin -p valt < valt.sql</code>
 +
<li>Enter in the MySQL password and press {{Keyboard | key = Enter}}:</li>
 +
</ol>
 +
</div>
 +
 
 +
: {{img | file = Database_IMPORT.png}}
 +
 
 +
<div class="section">
 +
<ol start="8">
 +
<li>Type in the following and press {{Keyboard | key = Enter}}:</li>
 +
<code>mysql -uivsadmin -p valt -e "UPDATE wowza SET address = '<b>NewServerIP</b>'"</code>
 +
<li>Enter in the MySQL password and press {{Keyboard | key = Enter}}:</li>
 +
</ol>
 +
</div>
 +
 
 +
: {{img | file = MySQL_Wowza_Update_Address.png}}
 +
 
 +
<div class="section">
 +
<ol start="10">
 +
{{Aside | content = It can be useful to run the migration in a screen. Use {{Code Block - Mini | text = screen -S video_migration}} to start a named session.}}
 +
<li>Type in the following, then press {{Keyboard | key = Enter}}:</li>
 +
<div class="codeText">sudo rsync -av --progress ivsadmin@<b>OldServerIP</b>:/usr/local/WowzaStreamingEngine/content/valt_recordings/* /usr/local/WowzaStreamingEngine/content/valt_recordings/</div>
 +
<li>When prompted, type <b>yes</b> to continue connecting to the server:</li>
 +
<li>Type in the <b>ivsadmin</b> password and press {{Keyboard | key = Enter}}:</li>
 +
</ol>
 +
</div>
 +
 
 +
: {{img | file = Rsync_Recordings.png}}
 +
 
 +
<div class="section">
 +
<ol start="13">
 +
<li>The video files will begin copying over to the new server and will look like this:</li>
 +
</ol>
 +
</div>
 +
 
 +
: {{img | file = Video_Copy 1.PNG | width = }}
 +
 
 +
: {{img | file = Video_Copy 2.PNG | width = }}
 +
 
 +
<div class="floating_card">
 +
<b>Things to note:</b>
 +
<ul>
 +
<li>Depending on the amount of video files, it may take some time for all of the files to transfer</li>
 +
<li>Assuming the copy is running at a full 1GB link, it will take about 2.8 hours per 1 TB of data</li>
 +
</ul>
 +
</div>
 +
 
 +
<div class="section">
 +
<ol start="14">
 +
<li>After the video files are done copying over, you will see a confirmation message similar to the one below:</li>
 +
</ol>
 +
</div>
 +
 
 +
: {{ img | file = Rsync_Confirmation.png}}
 +
 
 +
<div class="floating_card">After the files have been copied over, navigate to the VALT webpage on the new server and verify that all of the files are there.</div>
 +
 
 +
[[Category:rsync]]

Latest revision as of 08:23, 1 March 2024

Note: Change IP's in the below commands to match the IP's of the new and old server

On the Old Server

  1. Disable the Apache web service to prevent further recordings:
    sudo service apache2 stop
  2. Disable the restart Wowza cronjob:
    - Type in the following command:
    crontab -e
    - Press 1 to continue
Edit Cronjobs Command.png
  1. Comment out the following job:
  2. 0 3 * * * /usr/local/valt/bin/restartwowza

  3. Press CTRL + X to exit
  4. Press Y to save
Disable Restart Wowza Cronjob.png
  1. Type in the following, then press Enter:
  2. sudo chmod 777 -R /usr/local/WowzaStreamingEngine/content/

  3. Type in the following, then press Enter:
  4. mysqldump -uivsadmin -p valt > valt.sql

  5. Enter in the MySQL password and press Enter:
VALT Migration MySQLdump.png
  1. Copy over the database file to the new server
  2. scp valt.sql ivsadmin@NewServerIP:/home/ivsadmin/

  3. Enter password for ivsadmin and press Enter:
SCP MySQLdump.png

On the New Server

  1. Type in the following and press Enter:
    mysql -uivsadmin -p valt
  2. Enter in the MySQL password and press Enter:
MySQL Login.png
  1. Type in the following and press Enter:
  2. DROP database valt;

 :Database DROP.png
  1. Type in the following and press Enter:
  2. CREATE database valt;

 :Database CREATE.png
  1. Type in the following and press Enter:
  2. exit

  3. Type in the following and press Enter:
  4. mysql -uivsadmin -p valt < valt.sql

  5. Enter in the MySQL password and press Enter:
Database IMPORT.png
  1. Type in the following and press Enter:
  2. mysql -uivsadmin -p valt -e "UPDATE wowza SET address = 'NewServerIP'"

  3. Enter in the MySQL password and press Enter:
MySQL Wowza Update Address.png

    It can be useful to run the migration in a screen. Use screen -S video_migration to start a named session.

  1. Type in the following, then press Enter:
  2. sudo rsync -av --progress ivsadmin@OldServerIP:/usr/local/WowzaStreamingEngine/content/valt_recordings/* /usr/local/WowzaStreamingEngine/content/valt_recordings/
  3. When prompted, type yes to continue connecting to the server:
  4. Type in the ivsadmin password and press Enter:
Rsync Recordings.png
  1. The video files will begin copying over to the new server and will look like this:
Video Copy 1.PNG
Video Copy 2.PNG

Things to note:

  • Depending on the amount of video files, it may take some time for all of the files to transfer
  • Assuming the copy is running at a full 1GB link, it will take about 2.8 hours per 1 TB of data
  1. After the video files are done copying over, you will see a confirmation message similar to the one below:
Rsync Confirmation.png
After the files have been copied over, navigate to the VALT webpage on the new server and verify that all of the files are there.