friendica/doc/Migrate.md

81 lines
2.9 KiB
Markdown
Raw Normal View History

2020-11-25 17:59:06 +01:00
Migrating to a new server
2020-11-25 15:30:04 +01:00
===============
* [Home](help)
## Preparation
2020-11-28 07:32:38 +01:00
### New server
2020-11-28 08:01:42 +01:00
Set up your new server as described [here](Install); follow the installation procedure until you have created a database.
2020-11-28 07:32:38 +01:00
2020-11-25 16:06:12 +01:00
### Head up to users
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.
You may find these addons useful for in communicating with your users prior to the migration process:
* blackout
* notifyall
2020-11-25 15:30:04 +01:00
### Storage
2020-11-28 08:01:42 +01:00
Check your storage backend with ``bin/console storage list`` in the root folder. The output should be like this:
````
Sel | Name
-----------------------
| Filesystem
* | Database
````
If you are *not* using ``Database`` run the following commands:
2020-11-25 15:30:04 +01:00
2020-11-28 08:01:42 +01:00
1. ``bin/console storage set Database`` to activate the database backend.
2. ``bin/console storage move`` to initiate moving the stored image files.
2020-11-25 15:30:04 +01:00
2020-11-28 08:01:42 +01:00
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/``.
2020-11-25 15:30:04 +01:00
### Cleaning up
2020-11-28 08:01:42 +01:00
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"
2020-11-25 15:30:04 +01:00
2020-11-28 07:32:38 +01:00
After adjusting these settings, the database cleaning up processes will be initiated according to your configured daily cron time frame.
2020-11-25 17:59:06 +01:00
To review the size of your database, log into MySQL with ``mysql -p`` run the following query:
``SELECT table_schema AS "Database", SUM(data_length + index_length) / 1024 / 1024 / 1024 AS "Size (GB)" FROM information_schema.TABLES GROUP BY table_schema;``
2020-11-28 07:32:38 +01:00
You should see an output like this:
2020-11-25 17:59:06 +01:00
````
+--------------------+----------------+
| Database | Size (GB) |
+--------------------+----------------+
2020-11-28 07:32:38 +01:00
| friendica_db | 8.054092407227 |
2020-11-25 17:59:06 +01:00
| [..........] | [...........] |
+--------------------+----------------+
````
2020-11-28 08:01:42 +01:00
Finally, you may also want to optimise your database with the following command:
2020-11-28 07:32:38 +01:00
``mysqloptimize -p friendica-db``
2020-11-25 15:30:04 +01:00
2020-11-25 16:06:12 +01:00
### Go offline
2020-11-28 07:32:38 +01:00
Take your web server offline. This will ensure consistency of your users' data.
2020-11-25 16:06:12 +01:00
2020-11-25 15:30:04 +01:00
## Dumping DB
2020-11-28 07:32:38 +01:00
Dump you database: ``mysqldump -p friendica_db > friendica_db-$(date +%Y%m%d).sql``
and possibly compress it.
2020-11-25 15:30:04 +01:00
## Transferring to new installation
2020-11-28 08:01:42 +01:00
Transfer your database and a copy of your configuration file ``config/local.config.php-copy`` to your new server.
2020-11-28 07:32:38 +01:00
## Restore your DB
2020-11-28 07:32:38 +01:00
Import your database on your new server: ``mysql -p friendica_db < your-friendica_db-file.sql``
2020-11-28 07:32:38 +01:00
## Completing installation process
Complete the installation by adjusting the configuration settings and set up the required daily cron job.