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)
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
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.
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