AWS

 

 

AWS RDS

 

RDS는 Relational Database Service의 약자로 관계형 데이터베이스를 서비스로서 제공하는 제품입니다. MySQL, MariaDB, PostgreSQL, SQL Server, ORACLE 등을 직접 운영하지 않고 AWS에 대행할 수 있습니다. 

하위 수업에서 RDS를 사용하는 방법을 알아봅니다. 

 

RDS 소개

 

 

 

 

 

 

 

 

RDS 백업 & 복원

 

 

 

 

RDS Scale up & out

 

 

 

 

PHP를 위한 RDS

 

 

 

개발준비

PHP와 MySQL(MariaDB) 연동

Read Replication

 

예제

db.php

 

<?php
$write = mysqli_connect('', '', '', 'o2');
$read = mysqli_connect('', '', '', 'o2');

 

 

rds.php

<!DOCTYPE>
<html>
    <head><meta charset="utf-8"></head>
    <body>
        <form action="rds_receiver.php" method="post">
            <p>
                제목 :
                <input type="text" name="title">
            </p>
            <p>
                본문 :
                <textarea name="description">
                </textarea>
            </p>
            <p><input type="submit"></p>
        </form>
        <ul>
<?php
include('db.php');
$result = mysqli_query($read, "SELECT * FROM topic");
while($row = mysqli_fetch_assoc($result)){
    $title = mysqli_real_escape_string($read, $row['title']);
    print("<li>{$title}</li>");
}
?>
        </ul>
    </body>
</html>

 

 

rds_receiver.php

<?php
include('db.php');
$title = mysqli_real_escape_string($write, $_POST['title']);
$description = mysqli_real_escape_string($write, $_POST['description']);
$sql = "INSERT INTO topic (title, description, author, created) VALUES('{$title}', '{$description}', 'egoing', NOW())";
mysqli_query($write, $sql);
header('Location: rds.php');
?>

 

 

 

 

 

 

 

 

about author

PHRASE

Level 60  라이트

비극은 그 자체로서 진지하고 장엄하며 완전함이 있는 행동의 모방이다. 비극은 연민과 공포를 불러일으키고 그것을 통해서 정서를 정화시켜 준다. -아리스토텔레스 [시학]

댓글 ( 4)

댓글 남기기

작성