DinoStore Build

Dino-Store Lab; 2 Using RDS with ASP.NET Applications

We need to create an online database, for this, we will Launch a new DB instance in RDS.

Here are the Specifications for the Database;

  • · Micro instance
  • · Multi-AZ deployment
  • · Storage type = general purpose (SSD)
  • · 5GB storage
  • · DB Instance Identifier = AmbersDinoStoreInstance
  • · Master username = Admin
  • · Master password = **********************
  • · Use default VPC
  • · Security group = create the new security group
  • · Database name = AmbersDinoStoreDB
  • · Enabled automatic backups by selecting a period of days (N.B.: 0 = disabled)

The instance is being created, this will take awhile.

Creating the instance; 1

This takes about 15 mins and then you have an instance that is up and running. Grab the end point this is shown below.

Instane End point ; 2

The end point is  listed as;

ambersdinostoreinstance.cgju8mwibnj7.us-west-2.rds.amazonaws.com

Vpc ;

vpc-fa98df9d

We must go into EC2 and change the inbound rules for the security group that has just been created. I suggest changing this from what the lab states, to being completely open, so you are not tied to one IP address.

Changing the IP address ; 3

Now I need to go into MySQL and create a new Connection,  we will add in the details from the end point and the administrator account as stated before. This should be correct and connect as shown below.

Connection test; 4

Now to log into that Instance, we need to get out of our login and go into the AWS log in, after this, we need to Copy the original data from the previous database over to the new one.

Ok, now I’m going to write this out in detail because this took me hours of working out to figure out.

  • In the Original data folder, you need to find the create table code, this was something I found one moment and lost the next, and now I have no clue where it is.
    • COde; 5
  • open this in your new connection AWS as shown above so now press the Lightning button above, and that will create tables.
  • After this, you need to go back to your original database and export the data, in this you need to run the Selected * ….. as shown below, and then go into the Import/ Export section and Click Export, and find somewhere to Export it to.
    • How to migrate the data over from the Oginigol
  • After this you need to go into the coneected database and the tables that have been created as showen below, once you hover over them you have a button that pops up for importing.
    • How to migrate data over
  • From here you import it, and it imports into the database.

The next step is to Create a read-replica of the DB instance, this will be stored somewhere else other than where i have created the instance.

Creating a Database instance, ; 6

After this, we need to create another connection to Mysql to the replica database. In this, we put the end point to the replica, but because its a replica the Acounts user and password is still the same. This has been tested and it connected as showen below. AFter this was created i had a look around and everything was the same as the previous one.

Creating the connection; 6, b

AFter this we need to go into my sql and change some of the code inside of the web.config file, in this we need to change the Server source from the local host to the AWS read-replica of the database. We will do this for both this line and the next. Making sure we change the account and password to the databases, We also need to copy the bottom code and paste below then we need to change the name from “StoreSqlDb” to “StoreSqlDbReplica” as shown below.

Changing the code; 7

AFter this we need to go into the  Default.aspx.cs’s code and change the code where it says “//connectstring for MySQL”  in this we will be changing the Connection string from the “StoreSqlDb” to “StoreSqlDbReplica” as showen below.

Chaning the code; 8

Now we need to Open the new connection to see if they work, and as showen below they were up and running.

Connection coorrect; 9

Now after this we need to create a User account, in this we will go into the a Account tab and then into the Create Account tab, we will go throught creating a user as showen below.

After creating a user we can then see that its logged on and then this infomation will populate the dinostorememebershipdb table as showen below.

This slideshow requires JavaScript.

Now we need to cheak that the website is backed up correctly, this is done with Rebooting the RDS server. While this was happing the website still was up there. thats because this is backed up from the replica. And this is the end of the lab.

Rebooting with fail over ; 14

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s