简体   繁体   English

将数据从一台服务器迁移到另一台

[英]Migrate data from one server to another

I bought a new server and I want to move all the data (directories, sub directories, users, passwords, ..etc) from my old server to it. 我买了一台新服务器,我想将所有数据(目录,子目录,用户,密码,.. etc)从旧服务器移到该服务器上。

Is there a way to do that? 有没有办法做到这一点?

Thanks, 谢谢,

for the directories and files, use a FTP client from your server, if it allows you to, if not, just download all the content to your computer and upload it to the new server. 对于目录和文件,请使用服务器上的FTP客户端,如果允许,则将所有内容下载到计算机上,然后将其上载到新服务器。

For the users and passwords, i guess they are in a Database, connect to the database using SSH, telnet, or MysqlAdmin or any RMDB client system and export a dump file, then log in to the new server's SQL system and import that dump file. 对于用户和密码,我想他们位于数据库中,使用SSH,telnet或MysqlAdmin或任何RMDB客户端系统连接到数据库并导出转储文件,然后登录到新服务器的SQL系统并导入该转储文件。

Anyway you should give more details of both servers anyway so we can help you, for example, are they Shared hosting or dedicated machine? 无论如何,无论如何,您都应该提供这两个服务器的更多详细信息,以便我们为您提供帮助,例如,它们是共享主机还是专用计算机? and what kind of access do you have to them, also, their operative system would help people to reply you accurately 以及您对他们的访问方式如何,他们的手术系统将帮助人们准确地回复您

In principle, yes. 原则上可以。

If the hardware is similar (= just more RAM, disk space but same CPU architecture and no special graphics card drivers), you might be able to copy every file and then install the boot loader once more (the boot loader config usually changes when the hard disk size changes). 如果硬件相似(=只是更多的RAM,磁盘空间,但相同的CPU体系结构且没有特殊的图形卡驱动程序),则您可以复制每个文件,然后再次安装引导加载程序(引导加载程序配置通常在硬盘大小更改)。

Or you can create a list of all services that you use, determine which config files each one uses and then just copy those. 或者,您可以创建所有使用服务的列表,确定每个服务使用的配置文件,然后仅复制这些配置文件。 Ideally, you shouldn't copy them but compare the old and the new versions and merge them. 理想情况下,您不应复制它们,而应将新旧版本进行比较并合并。

The most work intensive way is to use a tool like puppet . 最繁重的工作方式是使用puppet之类的工具。 In a nutshell, puppet allows to create install scripts for services (along with all the configuration that you need). 简而言之,puppet允许创建服务的安装脚本(以及所需的所有配置)。 So if you need to install a service again (new hardware, second server), you just tell puppet to do it. 因此,如果您需要再次安装服务(新硬件,第二台服务器),只需告诉puppet即可。 On the plus side, your whole installation will be documented, too. 从好的方面来说,整个安装过程也将被记录在案。 If you ever wonder why something is the way it is, you can look into the puppet files. 如果您想知道为什么是这样,可以查看the文件。

Of course, this approach takes a lot of time and discipline, so it might not be worth it in your case. 当然,这种方法需要大量时间和纪律,因此对于您而言,这可能不值得。 Apply common sense. 应用常识。

Do you have physical access to both servers? 您可以同时访问两台服务器吗? If so you can use the dd command to make a clone of the disk from the old server to the disk that is going into the new server. 如果是这样,则可以使用dd命令将磁盘从旧服务器克隆到将要进入新服务器的磁盘。

In order to do this though, both hard drives have to be installed in one of the servers. 为了做到这一点,必须将两个硬盘驱动器都安装在其中一台服务器中。

You can also use netcat and dd to clone a disk over a network. 您还可以使用netcatdd通过网络克隆磁盘。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM