• 沒有找到結果。

As a current trend, the concept of cloud computing has grown so popular, addressing multiple issues related to processing, calculating and sharing software, or developing enterprises. A lot of companies have thought about moving their services to cloud platform.

In the technologically business world, the use of on - premise software and off – premise software has been greatly assisting business activities. The former, which is often abbreviated as on-prem software, is installed and run on computers on the premises (in the building) of the person or an organization using the software, rather than at a remote place. The latter,

off-23

premises software, is commonly known as “software as service” or

“computing in the cloud”

Until around 2005, the on-premises approach to deploying data was the most common. However, later, software running at a remote location became widely available and adopted. The use of new, alternative deployment method removed the need for the user to install any software on premises and brought about further benefits. Running software remotely can result in considerable cost savings because of reduced staffing, maintenance, power consumption, etc.

In other words, cloud computing has made it much easier to deploy data. With cloud, businesses can reduce up-front costs, management costs, pay for what they use, scale as they want, etc.

Figure 3.12: Migration from On-Premise to Off-Premise

To move a website from On-Premise to Off-Premise, we need to move Database and Web Servers.

Off-Premise On-Premise

24

3.3.1 Database Migration

Migrate Database To

Migrate Database To Amazon MySQL DB

Create Database Account

MySql Grant Permission For User

Update Web Config File

Load Execute State? Yes Load the Last Saved Migrate DB State

No

Figure 3.13: modeling database migration

* Simplified code file looks at appendix 2

25

The figure 3.7 shows the structure of doing database migration independently. When database migration starts, it asks whether the user wants to load the last saved input information or not. In situation 1, if the answer is yes, it will load the last saved information; otherwise, it will let us enter some requirement information for program running. After it gets all the requirement information, it will ask if the user wants to load the last saved program state or not. If the answer is yes, it will go to the last saved state of the program.

Why is it necessary to save the state of the program? The answer is sometimes the program is crashed while it is running, so we do not want to let the program run at the beginning. We want the program to run from the last failed position. In contrast, in situation 2, if the answer is no, it will start to create a MySQL database on Amazon Relational Database Services (RDS). If this procedure is finished successfully, it will save this state and continue with the next step. The next step is to update security group of RDS which stores the list of the IPs with allowed access to database. Afterward, the program will get an IP address for the new database server and transfer database onto it.

The program will accordingly create a new account and grand permission for that account to enable us to use the application. The last step of the program is to update web configuration file due to the change of database server IP address.

26

3.3.2 Web server Migration

Migrate Website To Amazon AWS

Connect to AWS

Launch a EC2 instance

Enter parameters for creating AWS instances

Enter parameters for moving website

No

Save information? Save

Information

Yes

Compress website directory

Upload zip file to Server

Compare MD5 of two zip files?

Not equal

Equal

Extract zip file to web directory of Server

End Load input

parameters? No

Yes

Figure 3.14: Modeling web server migration

* Simplified code file looks at appendix 3

27

The figure 3.8 shows the process of migrating web server independently. First of all, after started, the program asks the user if he/she wants to load requirement information. If the answer is no, it will call the input functions and let him or her enter requirement information. After that the program will ask another question which is whether the user wants to save the information or not. The user makes the decision and the program will proceed to the next step. In contrast, if the answer is no, the program will advance directly. In the next stage, the program will connect to AWS, launch an EC2 instance of AWS, and wait for the new instance to run until the instance’s status is available. Afterward, the program will call compress website directory function – the function to make a zipped file including our whole website directory, and insert the new database configuration file into the zip file. This zip file later is uploaded to a new instance via SFTP (SSH File Transfer Protocol) function, a function of paramiko [14] that transfers files through SSHClient of paramiko between local machine and remote machine. At this point, the program will compare the MD5 of two zip files. If it is perfectly matched, the last step can be carried out. If not, it will try to upload the zip file again. In other words, the program will go to the last step when the MD5 of local zip file and remote zip file are matched and the last step will extract the zip file of new EC2 instance to the web directory of the instance. In the end, the new EC2 instance becomes a Web Server.

Actually, this function may be used just once. Why is that? This is because when we do the auto scaling – terminate or launch several instances – there are two ways to make an EC2 instance become a Web Server. In the first way, we create an Amazon Machine Image (AMI) that includes all of our requirement software and web directory which stores our website. As a result, we just have to update database configuration file at the time a new EC2 instance is created. In the second way, we compress our web directory and

28

upload it to Amazon Simple Storage Services (Amazon S3). When a new EC2 instance is created, it will download the compressed file from Amazon S3, extract the file to web directory, and then update database configuration file.

相關文件