0% found this document useful (0 votes)
4 views9 pages

5 RDS1

The document discusses Amazon RDS (Relational Database Service), highlighting its automation of DBA tasks such as installation, backup, and storage management. It explains the importance of high availability (HA) for databases, detailing features like Multi-AZ for synchronous replicas and read replicas for asynchronous operations. Additionally, it covers backup strategies, terminology like RTO and RPO, and the significance of using DNS names for database connections instead of IP addresses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views9 pages

5 RDS1

The document discusses Amazon RDS (Relational Database Service), highlighting its automation of DBA tasks such as installation, backup, and storage management. It explains the importance of high availability (HA) for databases, detailing features like Multi-AZ for synchronous replicas and read replicas for asynchronous operations. Additionally, it covers backup strategies, terminology like RTO and RPO, and the significance of using DNS names for database connections instead of IP addresses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

RDS --> Relational database service some people call it as DBAAS data

base as a service

All DBA related tasks are automated in RDS, what r the


responsibilities or tasks of DBA daily

1. DB installation
2. DB backup
3. DB storage management
4. HA of DB as DB is accessed from multiple applications

which are 4 common tasks of DBA but if u want to install u must be


perfect with OS either winodws or linux or ubuntu

amazon is giving database as a platform , you no need to worry abt


installation of OS or server which is taken care by AWS
all database related patching everything taken care by aws

--> On premises instance--> server u need to purchase, install OS,


install DB

--> ec2 instance---> here only db installation u need to taken care

If u are using RDS --> ec instance+OS+DB installation maintained by aws

2.Backups are automated in RDS, by default automatic backup are enabled

it has manual and automatic backup(taken care by aws


manual u need to take db snapshot like volume snapshots

storage management--> at the time of rDS installation there is some


option called storage autoscaling if u select this
at time of installatio: 100 GB then if it increase to 200 G
automatically storage added

How to achieve HA for ur DB, app HA and DB HA is completely different,


App HA means front end and DB HA means backend

Lets take ur bank acct u will access via netbanking, atm, mobile app etc

all these apps are connectiong to same database


any wayu connect to see bank detauls it gets connected to DB
NB(S1)
ATM(S2)
MB(S3) ----> DB (S5)

all S1,S2,S3 access S5

If one app not working u can access via other method but if DB server
is failed all front apps are of no use
so DB HA is very very important

Interview how u are achieving HA in DB, never say via ASG and ELB,
because those are only for application HA

How to achieve DB HA, aws given one option called Multi AZ which is
completely aws feature

Purpose of multiaz is to acheive HA in DB, if u enable that option u


can achieve, but what is multi az

Technical definition: synchronous replica will be created in other AZ


not in other region

say I created

DB in singapore(AZ1,AZ2,AZ3,AZ4)

Primary DB server(AZ1)

Secondary /standby DB server)(AZ3)

u have option to selkect primary AZ not secondary AZ , aws will create


it in best availabilityzone

Both servers will have same data, aws will take care of replication

PS1 --> AZ1


SS1---> AZ3
aslong as primary works entire load handled by Primary

if u are updating, inserting data same will be done on secondary also

if primary fails, then it will switch to secondary, then secondary


becaomes primary and primary becomes secondary
but who is going to recover, aws will take care
failure can be network issue, server issue etc.

If both fails nothing we can do we cannot create replicas across


region

rds is regionspecific service

synchronous server will be created


both have different ip addresses then how the applications know

which ip address to access, somewhere in application code u give ip


address
but what ip address u give
say application developed in python

How to overcome this problem

Sec --> 10.0.2.26


Pri---> 10.0.0.45

developer will take care

mysql.connector.connect(host=""hostname or ip address
database = databasename
user = root
password=

say if primary Ip/host I give and it goes down then traffic redirected
to secondary then who is going to update
my code to secondary Ip/host

aws doesnt know which language or ip address u are using to connect

aws suggests dont use ip address to connect to server


whenever u create DB aws is giving something known as DNS name

Like whenever u create ELB it gives DNS name in same way when u create
RDS it gives DNS name

dont use this as dns name, use word called DB endpoint--> endpoint
means dns name

DB endpoint
---->test1db.ap-south-1.aws.amazon.common
this domain name pointing to primary db ip address, so in all
applications code use dns name

if primary goes down then it will switch ip address of dns name i.e db
end point ip address will be changed automatically

======================================================================

2 more terminology related to backup

1. Retention period
2. RTO
3. RPO

How to stop automatic backups, if retention period =2 then automatic


backup taken care backup will be there for 2 days
if I put retention=0 automatic backups are disabled and u need to take
backup manually
How to disable automatic backups interview question--> by putting
retention period =0

2. RTO --> Recovery time objective

Purpose of backup is restore data if datasbase is crashed

lets take for ur application u are taking backup every 1hr, who is
going to take decision on this, its a business call
business req, as a technical person

Currently banking app need every 10mins backup is required because


each and every tn is very very important

DB1--->
1st backup ---> 10:00 AM --> B1
2nd ----------> 10:15 AM --> B2
3rd ----> 10:30 AM ---> B3

suddenly DB corrupted at 10:40 AM

yes backup available till 10:30 data will be available in B3 , 10mins


of data is lost

say it corrupted at 10:45, then 15mins data is lost

if backup is taken server performance/ db performance is impacted

RTO means upto 10:30 database data need to be available and working
condition

say 10:40 DB crashed, through backup u need to bring back system into
running condition, so how much time it takes to recover
i.e RTO

google.com --> type RTO

How far back recovery point and how much time it takes to recover is
RTO

RDS ---> PAAS


or Database platform as a service

what is ur role when everything aws is taking care


u need to select version , flavor

ex: oracle, mysql, microsoft sql server, amazon arora


interview --> which database u are using dont say RDS, RDS is general
terminology

widely used oracle is 12c

latest version we need to check in google

if mysql which version u need to remember

next they will ask which port number db is running

mysql --> 3306


Oracle --> 1521

database also has SG

what is size of ur database?

Their intention is Prod database--> just say around 3TB approximately,


dont say exact value

1. sw, 2. version, 3. port no

Technical keywords:

1. MultiAZ
2. End-Point
3. Retention Period
4. Subnet group means group of subnets , will xplain in last
5. Read Replica
6. RTO
7. RPO

Diff between MultAZ and Read replica

Both are replicas only, multiaz means syncronous replica means other
server will created i.e secondary
Multi az - at a time connect to one DB

read replica --> means asynchronous replica, here also 2 servers


primary and secondary server we call them as master and replica server

at a time we can connect to both dbs,

replica is only for readonly, its not possible to write operation on


replica server

there might be delay in asynchronous


Purpose of read replica
have a database server , lot of applications are connected

DB1 --> amount debited means some amt will be deducted means update,
insert happening on database server, millions of read and write
operations
happening. so DB1 shlould be in good performance

Other requirement: -- every 3 hrs i want to check how many Tn or how


much business happens, I just want to read it from database
i want to generate report from entire existing Tn means we need read
intense operations

For ex: I waant ATM wide transactions, here you are doing intense read
operations on server, not writing anything
which ATM is very bisy, which ATM is less busy

for this we need to perform read operation on entire data, if I


perform this on master server, it will impact performance of server
so I create replica databse asynchronous replica or read replica

whatevery happening in master will be updated to replica also , taken


care by aws but it will be done asynchronously which will have some
delay

To create read replica there is one condition i.e automatic backup


need to be enabled other wise u cant create read replica
=================

DB snapshot -- complete backup of ur database

How to access database u need to know

u need to know basic database language i.e SQL stryctured query


language , it can be mysql SQL or microsoft sql server sql

tomorrow we will speak

======================================================================

Subnet Groups:

Meaning -- Group of subnets

whenever u create RDS it asks to choose subnet groups

as per ur understanding, inside subnet only u create ec2 instance, in


which subnet u want to create subnet

If use multiaz it creates replica db in other availability zone


Lets take

VPC
-->
SN1---> AZ1
SN2---> AZ2
SN3---> AZ3
SN4---> AZ4

I created a group

SNG1 ---> SN1 SN2 SN4---


SNG2 ---> SN2 SN3 SN4---

If I select SNG1 ur database will be created under AZ1, AZ2,AZ4


otherwise u can use existing subnet grpup which contains default VPC

we dont have access to login to AWS RDS OS, they only give database
connectivity

internally its considered as ec2 instance only

Database also have ---> SG ---> SN1


as database also connected with subnet you also need to check on
NACL

How data stored inside database

whenever u run query fastest way it need to retrieve

Business req: There are lot of ways u get data into database for
our intelliq it,
phone, email, sms

so u need to have idea what type of data u need to capture

If student enquire, those details I need to put in database in table


format

SNO
SNAME
MobileNo
Course
Date of enquiry
Preferrable Time
email id
source of enquiry
I need to upload joined student details, as JSTUD table

SNO
SNAME
Course
DOJ
Fees
DOP
Batch Timings

developer will create, all databases uses language called SQL

sql have some commands

create table

SNO --> Number


SNAME --> Alphanumeric
DOJ --> Date format

each and every column u need datatype

string means varchar

CREATE TABLE EMP(EMPNO INT, ENAME VARCHAR(100), DOJ DATE, SAL


NUMBER)--> NOT REQUIRED BUT SOMEONE ASKS U NEED BASIC UNDERTSANDING

IF U WANT TO RETRIEVE DATA

later on I want to add one more column

ALTER TABLE
DROP TABLE --> ENTIRELY U ARE DELETING STRUCTURE
TRUNCATE --> DELETE ALL DATA OR COLUMNS

DDL COMMAND MEANS DATA DEFINITION LANGUAGE

DML MOST WIDELY USED, DATA MANIPULATION LANGUAGE

GIVE SOME VALUES IN EXCEL SHEET

IF ONE MORE PERSON JOINS NEW RECORD WILL BE ADDED

INSERT-- INSERT NEW JOINEE RECORD


UPDATE - INCREASE SALARY
DELETE - DELETE SOME RECORD

IN EXISTING DATA IF U ARE DOING ANY CHANGES , ITS NOTHING BUT


TRANSCATION

ONCE U DO tN U NEED TO SAVE OR ROLLBACK


TCL - TRANSACTION CONTROL LANGUAGE
COMMIT
ROLLBACK

HOW TO READ DATA FROM DATABASE, HOW MANY STUDENTS JOINED FROM LAST
1MONTH

SELECT COMMAND READS DATA FROM TABLE

lets say 60.90.90.90 ip address of ec2 where i installed oracle

from my machine I want to connect to above

for this u need client s/w to be installed on ur machine

like putty / git bash for ssh


browser for port 80

if u are using oracle, oracle client need to be installed, if u are


using mysql, mysql client need to be installed

which client s/w u are using interview question--

Try creating mysql database in ec2 and connect from my machine

===============================================================

You might also like