建议备份php站点和mysql db

时间:2022-10-28 21:50:19

do you have any good suggestions how to backup remote php site and mysql, and upload it to another remote ftp? I do have shell access and it is linux system.

你有什么好的建议如何备份远程php站点和mysql,并将其上传到另一个远程ftp?我有shell访问权限,它是linux系统。

Kind of lame question when I post it like that, but I assume some script would have to be run on remote server with site, that would do this.

当我像这样发布它时,有点蹩脚的问题,但我认为某些脚本必须在具有站点的远程服务器上运行,这样做。

If you don't mind sharing your ideas, I would appreciate it.

如果您不介意分享您的想法,我将不胜感激。

Best, Zeljko

4 个解决方案

#1


Depends on the capabilities of your shell and the size of your site, but the first step could be very trivial: Use mysqldump and zip it together with your webpage. For uploading your archive you can maybe use wput or simply fall back to ftp which should be available on most shells.

取决于shell的功能和站点的大小,但第一步可能非常简单:使用mysqldump并将其与您的网页一起压缩。要上传您的存档,您可以使用wput或简单地回退到大多数shell应该可用的ftp。

#2


Use mysqldump do dump the DB into a "data" directory within the site.
An alternative would be SELECT INTO OUTFILE if you already have the SQL scheme stored somewhere.

使用mysqldump将数据库转储到站点内的“数据”目录中。如果已经将SQL方案存储在某处,则可以选择SELECT INTO OUTFILE。

Use tar to pack up the website contents.

使用tar打包网站内容。

tar -xvf site.tar

Use FTP, SCP, SFTP, etc to transfer that to the new location, unpack, then depending on how the DB was dumped restore the DB and give it a whirl.

使用FTP,SCP,SFTP等将其传输到新位置,解压缩,然后根据数据库的转储方式恢复数据库并给它一个旋转。

#3


Have you tried rsync?

你试过rsync吗?

Take a look at the documentation and examples.

看一下文档和示例。

Otherwise, I think you should ask this on serverfault.

否则,我认为你应该在serverfault上问这个问题。

#4


I second rsync but with a helping of mysqldump to dump your databases to a plain text file (assuming the DB is not too large).

我是第二个rsync但是帮助mysqldump将数据库转储到纯文本文件(假设数据库不是太大)。

#1


Depends on the capabilities of your shell and the size of your site, but the first step could be very trivial: Use mysqldump and zip it together with your webpage. For uploading your archive you can maybe use wput or simply fall back to ftp which should be available on most shells.

取决于shell的功能和站点的大小,但第一步可能非常简单:使用mysqldump并将其与您的网页一起压缩。要上传您的存档,您可以使用wput或简单地回退到大多数shell应该可用的ftp。

#2


Use mysqldump do dump the DB into a "data" directory within the site.
An alternative would be SELECT INTO OUTFILE if you already have the SQL scheme stored somewhere.

使用mysqldump将数据库转储到站点内的“数据”目录中。如果已经将SQL方案存储在某处,则可以选择SELECT INTO OUTFILE。

Use tar to pack up the website contents.

使用tar打包网站内容。

tar -xvf site.tar

Use FTP, SCP, SFTP, etc to transfer that to the new location, unpack, then depending on how the DB was dumped restore the DB and give it a whirl.

使用FTP,SCP,SFTP等将其传输到新位置,解压缩,然后根据数据库的转储方式恢复数据库并给它一个旋转。

#3


Have you tried rsync?

你试过rsync吗?

Take a look at the documentation and examples.

看一下文档和示例。

Otherwise, I think you should ask this on serverfault.

否则,我认为你应该在serverfault上问这个问题。

#4


I second rsync but with a helping of mysqldump to dump your databases to a plain text file (assuming the DB is not too large).

我是第二个rsync但是帮助mysqldump将数据库转储到纯文本文件(假设数据库不是太大)。