]> git.mxchange.org Git - friendica.git/blob - doc/Migrate.md
modified: doc/Migrate.md
[friendica.git] / doc / Migrate.md
1 Migrating to a new server
2 ===============
3
4 * [Home](help)
5
6 ## Preparation
7
8 ### New server
9 Set up your new server as described [here](Install); follow the installation procedure until you have created a database.
10
11 ### Head up to users
12
13 Inform your users of an upcoming interruption to your service. To ensure no loss of data, your server needs to be offline during some part of the migration processes.
14
15 You may find these addons useful for in communicating with your users prior to the migration process:
16
17 * blackout
18 * notifyall
19
20
21 ### Storage
22 Check your storage backend with ``bin/console storage list`` in the root folder. The output should be like this:
23 ````
24 Sel | Name                
25 -----------------------
26      | Filesystem          
27  *   | Database  
28 ````
29
30 If you are *not* using ``Database`` run the following commands:
31
32 1.  ``bin/console storage set Database`` to activate the database backend.
33 2.  ``bin/console storage move`` to initiate moving the stored image files.
34
35 This process may take a long time depending on the size of your storage and your server's capacity. Prior to initiating this process, you may want to check the number of files in the storage with the following command: ``tree -if -I index.html /path/to/storage/``.
36
37 ### Cleaning up
38
39 Before transferring your database, you may want to clean it up by ensuring the expiration of items is set to reasonable values in the administrator panel. *Admin* > *Site* > *Performance* > Enable "Clean up database" 
40
41 After adjusting these settings, the database cleaning up processes will be initiated according to your configured daily cron time frame.
42
43 To review the size of your database, log into MySQL with ``mysql -p`` run the following query: 
44 ``SELECT table_schema AS "Database", SUM(data_length + index_length) / 1024 / 1024 / 1024 AS "Size (GB)" FROM information_schema.TABLES GROUP BY table_schema;``
45
46 You should see an output like this:
47 ````
48 +--------------------+----------------+
49 | Database           | Size (GB)      |
50 +--------------------+----------------+
51 | friendica_db       | 8.054092407227 |
52 | [..........]       | [...........]  |
53 +--------------------+----------------+
54 ````
55
56 Finally, you may also want to optimise your database with the following command:
57 ``mysqloptimize -p friendica-db``
58
59 ### Go offline 
60 Take your web server offline. This will ensure consistency of your users' data.
61
62 ## Dumping DB
63
64 Dump you database: ``mysqldump  -p friendica_db > friendica_db-$(date +%Y%m%d).sql``
65 and possibly compress it. 
66
67 ## Transferring to new installation 
68
69 Transfer your database and a copy of your configuration file ``config/local.config.php-copy`` to your new server.
70
71 ## Restore your DB
72
73 Import your database on your new server: ``mysql -p friendica_db < your-friendica_db-file.sql``
74
75 ## Completing installation process
76
77 Ensure your DNS settings point to your new server.
78
79 Complete the installation by adjusting the configuration settings and set up the required daily cron job.
80
81
82
83
84