๐Ÿ’พ Archived View for gemlog.blue โ€บ users โ€บ sunwoo1524 โ€บ 1707042901.gmi captured on 2024-02-05 at 17:20:08. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Docker๋กœ ์„ค์น˜๋œ PostgreSQL ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋ฐฑ์—…ํ•˜๊ณ  ๋ณต์›ํ•˜๊ธฐ

๋ฐฑ์—…ํ•  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค, ๋ณต์›ํ•  ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์‚ฌ์šฉ์ž ์ด๋ฆ„์€ username, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ด๋ฆ„์€ database, ์ปจํ…Œ์ด๋„ˆ ID๋Š” abc123์ด๋ผ๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค.

๋ฐฑ์—…

1. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ backup.dump๋ผ๋Š” ์ด๋ฆ„์˜ ๋คํ”„ ํŒŒ์ผ๋กœ ๋‚ด๋ณด๋ƒ…๋‹ˆ๋‹ค.

docker exec abc123 pg_dump -U username database > backup.dump

๋ณต์›

1. ๋คํ”„ ํŒŒ์ผ์„ ์ปจํ…Œ์ด๋„ˆ ์•ˆ์œผ๋กœ ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค.

docker cp backup.dump abc123:/

2. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ปจํ…Œ์ด๋„ˆ๋กœ ์ ‘์†ํ•ฉ๋‹ˆ๋‹ค.

docker exec -it abc123 bash

3. ์ปจํ…Œ์ด๋„ˆ ์•ˆ์œผ๋กœ ๋ณต์ œํ•œ ๋คํ”„ ํŒŒ์ผ๋กœ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค.

psql -U username database < backup.dump