Migrating SMF forum to a new server.

Started by kitz, June 27, 2024, 11:43:10 AM

Previous topic - Next topic

kitz

I'm hoping that this may be a quick question as Im not really getting any help from my webhosts.
They are shutting off my server and have moved everything to a new server, but the data for the forum is old as members have posted on the old forum as DNS has not yet been oved over.

I've exported the database and I now have an sql file that I would like to import that will update everything on the new server. 

I'm not really 100% sure what I should be doing on how to update the info on the new forum - for example will I end up with duplicate posts?   I cant seem to find anything that explains how to update a forum database, it all seems to be about importing into a fresh new database.

So how do I use the sql file I have from taking an export on the old database to update the new server with posts for the past few weeks.

kitz

Just to clarify:
Old server has forum posts up until today
New server has copy of posts only up until several weeks ago.

I need to copy across the database from old server so it will add in any posts made on the old server made in the past month, so that it will update the database on the new server and add the new posts.

I cant seem to find instructions anywhere how to update the new server that already has posts up to a month ago using the exported file.


kitz

Thank you but the doesnt appear to cover what I am asking.

The hosts migrated over a copy of the forum which is functional...  but its at a date about a month ago, so I have many weeks of posts that are missing in the database on the new server. Im wanting to update it. 

I have an export file from the old file that will have duplicate data
The exported file contains years of forum posts, its quite a large file (350MB).

I dont know how to UPDATE the new forum with the exported file from the old forum.  I fear that using import may not work and it could cause duplicate posts.   Ive not done this type of restore before.

Kindred

You would not need the whole thing that Illori posted....


You would
1- remove the contents of the database on the NEW server
2- import the contents of the database backup into the NEW server's database (the one that you just emptied)
3- upload and run repair_settings.php to change the paths, urls, etc for the data which is stored in your database and would be pointing to the OLD site.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Doug Heffernan

Quote from: kitz on June 27, 2024, 02:21:25 PMdont know how to UPDATE the new forum with the exported file from the old forum. 

If you restore a backup to an existing forum, all content of the existing forum will be gone and replaced with that of the backup file. If you don't mind that then you can go ahead and restore the backup. Since the file is a big one, phpmyadmin most likely will result in a time out and therefore incomplete restoration. It would be best to use a third party tool, like bigdump for example.

If you want to keep the conent of the new forum instead and add the content from the backup file, you will need a merge rather than a restoration.

Kindred

No. Do not "merge"

Always replace.   Unless you are extremely technical, and know what you are doing,  a merge is always a poor choice.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Illori

also you may need to move over attachments if you have any new [including avatars changed]

Doug Heffernan

Quote from: Kindred on June 27, 2024, 04:42:41 PMAlways replace. 

Yes, that would be the best option. But if the OP wants to add the content of the backup file to an already existing forum, merging is the only option. It was a bit unclear to me what they are trying to accomplish. The way I read it. they want a merge rather than a straight dataabse restoration.

Kindred

Merging is really ready hard....  and no the OP does not need to do that.

The current "new" site has a week old snapshot of the old site.  The OP needs to replace that with a current snapshot
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

kitz

Thanks guys.

Old Server has an SMF forum with posts from 2005 and is still accruing posts.
New server has an SMF forum that they took a snapshot of in May so the database is nearly 2 months old. To clarify the posts on the new server are 2005 to May 2024.

I want to take a new export from Old server (2005 to 28th June) and somehow use that to update the new server with missing posts for the last month.   SMF looks ok on the new server except for the missing posts May to now.

Im not sure if Im using the correct words, but I think the correct SQL is update.  The new server needs to be updated with May and June posts to date.

Kindred

#11
1- shut down the old forum.  Put it in maintenance mode... otherwise you're going to have the same problem again.

2- Do what I said above. Download the old forum - export sql and then REPLACE the new database with that and run repair_settings.php
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Doug Heffernan

Quote from: Kindred on June 27, 2024, 07:00:40 PMMerging is really ready hard....  and no the OP does not need to do that.

Looking at their last reply it looks like to me that they don't want a straight full databaase restoration either, but a partial restore.

Quote from: kitz on June 27, 2024, 09:14:33 PMI want to take a new export from Old server (2005 to 28th June) and somehow use that to update the new server with missing posts for the last month.   SMF looks ok on the new server except for the missing posts May to now.

@kitz, readding/restoring only a portion of the posts and topics from a dataabse backup it  will be extremly diffucult. I think you are better off restoring the backup as a whole as adviced above.

kitz

I think some are misunderstanding what Im trying to do. I'm not sure how I can explain it better :(  but I'll try again to clarify what I need.

  • OLD SERVER. All the forum posts and data are currently on the old server.  This old server currently has posts from 2005 up until today's date. I can export this data to a text sql file.

  • The NEW SERVER has an SMF forum that my hosts copied across,  BUT it only has posts up until May.
This new server is missing recent posts from May up to todays date. atm no-one can reach this new site as the DNS hasn't yet been changed. 
 
  • I want the new server to have ALL the data to date, not just May.  I need to somehow replace the database so that it has an exact copy of the data on the old server.

If I switch over DNS as things currently are, then the new server forum will be missing posts between May and now.

Yes I need to put the old server into maintenance mode and stop and more posts being made, BUT theres not much point shutting the forum down just yet if I dont know how to update the forum on the new server.

I want to be able to directly replace the data in the new forum with data from the old. I'm sorry but Im not sure how the IMPORT works. Because the new forum has data I cant use the exported file if it is going to do the equivalent of INSERT as that could cause duplicates. I think I need it to only UPDATE the new forum only if its not already there.  This means just inseting the posts between May and now.

In a way yes starting with an empty database and then adding everything in the sql exported file.   Can I somehow dump all the posts in the new forum and replace everything with the exported file.

Doug Heffernan

Quote from: kitz on June 28, 2024, 11:20:51 AMI want the new server to have ALL the data to date, not just May.  I need to somehow replace the database so that it has an exact copy of the data on the old server.

It looks like I read it wrong. Anyways, you will need to restore the backup from the old server to the new one. Basically it would be like a server/host move.

Quote from: kitz on June 28, 2024, 11:20:51 AMI want to be able to directly replace the data in the new forum with data from the old. I'm sorry but Im not sure how the IMPORT works.

When you import the data backup file in the database, the database will be populated with the content from that file.

On how to do that, have a look at the previous posts and links posted here.

kitz

Quote from: Kindred on June 28, 2024, 04:40:53 AM1- shut down the old forum.  Put it in maintenance mode... otherwise you're going to have the dance problem again.

2- Dib what I said above. Download the old forum export sql and then REPLACE the new database with that and run repair_settings.php

Yes this is what I am trying to do. REPLACING the new database with the sql file that I have from the old server. Sorry if I confused things by saying UPDATE?

I was waiting until I knew how I was going to replace the new forum database with the old before turning off everything on the old server and changing the DNS to point to the new server.

Quote1- remove the contents of the database on the NEW server
2- import the contents of the database backup into the NEW server's database (the one that you just emptied)
3- upload and run repair_settings.php to change the paths, urls, etc for the data which is stored in your database and would be pointing to the OLD site.

Thank you.  I had thought there may have been a way I could just use the backup file to update rather than having to empty it. eg it would only add the missing posts.  But thats fine if thats what I have to do .

Hopefully there shouldnt be any new paths or urls to worry about.  I will need to change DNS so that it points to the new server rather than the old. 

Once I know how to do things and change DNS, then I will put the old server into maintenance mode and replace the data on the new server.  The new forum is currently in maintenance mode so that no-one posts on there just in case DNS propagates before Ive had change to replace the database.    I didn't want to shut everything down for longer than necessary.

From what I have seen whilst trying to find a solution too this, is that I may well have problems with the 350MB file size and php.  That should be fun because I dont have a clue if I cant use phpmyadmin.  Im not even sure if I have ssh access. :/

kitz

@Doug Heffernan  Thank you for your input, appreciated.  I'm really slow typing today and our posts crossed.  I'll go back and re-read some of the stuff I read yesterday.  Not happy having been pushed into a host initiated move mid flare when my brain refuses to take in anything more than 2 secs ago. :/

Illori

Quote from: Kindred on June 28, 2024, 04:40:53 AM1- shut down the old forum.  Put it in maintenance mode... otherwise you're going to have the dance problem again.

2- Dib what I said above. Download the old forum export sql and then REPLACE the new database with that and run repair_settings.php

you need to follow this, assuming you have no new attachments uploaded or avatars changed.

Kindred

Drop all tables in the current "new" database.

Then import the old forum export
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

kitz

Thank you very much everyone that tried to help. It was very much appreciated.

My next issue was that I couldnt seem to import the database into the new forum probably due to the file size.  In the end after much hardwork and stress, my hosts actually dealt with the migration like they should have and copied everything across like they promised, even though they messed up my DNS so I vanished off the Internet.  Its not been a pleasant few weeks and I still have lots of things to sort (not SMF). 

Advertisement: