Copied a server with an ERPNext instance, Mysql not working

Hello everyone

In my company, we tried to copy a whole server with ERPNext v.10 as a means of having a testing ground for when we update to V12.

We successfully copied it and changed the DNS to another address. Now mysql doesn’t really want to play along. The service seems to be running, but I can not get into the database at all.

The error: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

Is there anything we forgot to change?

Regards,
Val

How did you copy it?

  • For example, if you manually copied the DB file (normally something like /var/lib/mysql/*) WHILE the mysql was up, then the database files would not have copied correctly.
  • Have you checked that the mysql, nginx etc processes are running?
    • ps -ef | grep -i listen #check what ports are active

Basically, we copied an entire server.

We decided not to stop the DB during that process, as it was currently in use by a production system.
Do you know what needs fixing in that db file?.

also your suggested command returns
frappe 15022 32585 0 12:27 pts/1 00:00:00 grep --color=auto -i listen

I will check this with the current ports

As far as I know, it is not possible to copy a “live” DB without stopping the mysql instance, unless you used an sqldump or export of some description

1 Like

I have been copying v10 servers for a long time now. I guess it all depends on how you define “copy”.

In my case I make an image copy of the server and restore the image to a fresh server. Then I perform the steps in this post:

Once that is done I restore a copy of the latest backup to the newly restored server and everything works just fine.

So, If by “copy” you mean that you are making a server image, then this may help.

However, if by “copy” you mean that you are just moving all of the directory structure to a different server, then I would not expect to get a functioning server. The reason for this is the install process of erpnext is extremely dependent on the status of many other supporting programs such as pip, mariadb, python, etc. (there are far to many to name here).

Every install is potentially different even if the versions indicate they are the same simply because of the lack of control you have over the status of the supporting programs. Some of the support programs may be changing daily. This is exactly why I only use complete server images. It is not possible to know what has changed and that means that any two servers are going to be different unless you make a complete server image.

Hope this helps.

BKM

You can also look at this…

Everyone, thank you for your detailed responses.
Skimming through your provided resources, I’m assuming that files were simply copied, leading to the broken database and that means that even changing the configs and a re-setup of nginx are not going to help.

Originally, the goal was it to have a 1:1 copy of the live server (instead of backup and restore) so we could have the same ERPNext 10 version to have an accurate testing ground for the upgrade to V12.

Our provider, where the server is hosted, said it’s too complicated to just clone the server, so we had to do it ourselves, leading to this mess. I’m probably going to set up an entirely new ERPNext instance, restore a backup of the live system, although our expert warned us that there might be crucial database differences, if we do it that way.

Regards,
Val

Edit: I could get some more info.
Apparently, it was indeed a full server backup, that we restored in a virtual machine. So from what has been posted so far, this should be the correct approach, just that we should stop the database before copying