Submit Search
Upload
Postgresqlのbackup実装
•
2 likes
•
1,294 views
F
f-katkit
Follow
社内説明会用資料 postgresql 9.4のbackup実装状況 クラウドインフラ上でchefにてdeploy
Read less
Read more
Technology
Report
Share
Report
Share
1 of 10
Download now
Download to read offline
Recommended
バックアップことはじめ JPUG第29回しくみ+アプリケーション分科会(2014-05-31)
バックアップことはじめ JPUG第29回しくみ+アプリケーション分科会(2014-05-31)
Chika SATO
PostgreSQLバックアップの基本
PostgreSQLバックアップの基本
Uptime Technologies LLC (JP)
Redis & Redis HA design with Keepalived
Redis & Redis HA design with Keepalived
Toshiki Inami
資格の話 #3 @高専カンファレンス100 in 東京 LT
資格の話 #3 @高専カンファレンス100 in 東京 LT
kyontan
資格の話 #3.2 @Dentoo.LT #15
資格の話 #3.2 @Dentoo.LT #15
kyontan
OSC東京2013/Spring_JPUG資料
OSC東京2013/Spring_JPUG資料
Chika SATO
コンテナのユースケース考察
コンテナのユースケース考察
Shuji Yamada
OSC北海道2014_JPUG資料
OSC北海道2014_JPUG資料
Chika SATO
Recommended
バックアップことはじめ JPUG第29回しくみ+アプリケーション分科会(2014-05-31)
バックアップことはじめ JPUG第29回しくみ+アプリケーション分科会(2014-05-31)
Chika SATO
PostgreSQLバックアップの基本
PostgreSQLバックアップの基本
Uptime Technologies LLC (JP)
Redis & Redis HA design with Keepalived
Redis & Redis HA design with Keepalived
Toshiki Inami
資格の話 #3 @高専カンファレンス100 in 東京 LT
資格の話 #3 @高専カンファレンス100 in 東京 LT
kyontan
資格の話 #3.2 @Dentoo.LT #15
資格の話 #3.2 @Dentoo.LT #15
kyontan
OSC東京2013/Spring_JPUG資料
OSC東京2013/Spring_JPUG資料
Chika SATO
コンテナのユースケース考察
コンテナのユースケース考察
Shuji Yamada
OSC北海道2014_JPUG資料
OSC北海道2014_JPUG資料
Chika SATO
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
CRI Japan, Inc.
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
sn679259
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
CRI Japan, Inc.
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
WSO2
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Toru Tamaki
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Toru Tamaki
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
atsushi061452
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
More Related Content
Recently uploaded
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
CRI Japan, Inc.
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
sn679259
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
CRI Japan, Inc.
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
WSO2
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
Toru Tamaki
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
iPride Co., Ltd.
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
Toru Tamaki
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
atsushi061452
Recently uploaded
(10)
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
Featured
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Featured
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Postgresqlのbackup実装
1.
backup & restore Postgresql
9.4
2.
postgresql 9.4 のバックアップ計画 ▸
バックアップ 【 backup 】 コンピュータの記憶装置に保存されたデータを別の装置や記憶媒体へ複製 して別に保管するもので、機器の故障や破損、人為ミス、不正行為などに よってデータの消失や改変などが起こった場合に、複製した時点のデータ に復旧させることができる。 ▸ リストア 【 restore 】 ハードディスクなどの記憶装置が破損するなどしてデータが失われた際に、 以前に取っておいたデータの複製を書き戻すなどして復元することをリスト アという。 引用:IT用語辞典 e-Words http://e-words.jp/
3.
postgresql 9.4 のバックアップ計画 Backup手法の検討 ▸
コールドバックアップ データベースを一旦止めて物理的または論理的なバックアップを取得する →サービス停止があるので今回は❌ ▸ ホットバックアップ データベースの停止をせずにバックアップの取得が可能→⭕️こちらを採用 ⚠ バックアップ取得ポイントのみへのリカバリー ⚠ バックアップ手順が複雑→tool(pg_rman)で楽チン +α ポイント・イン・タイム・リカバリ(PITR) バックアップポイント後の更新をリアルタイムでアーカイブしていき、サービス停 止直前 までのリカバリを実現する。→ ⭕basebackupと組み合わせて採用
4.
postgresql 9.4 のバックアップ計画 まとめ basebackupによる定期的なホットバックアップ +PITRによるリアルタイムバックアップ pg_rmanによる定期ホットバックアップ(冗長) !障害発生!定期backup
Restore WAL 定期backup Restore!障害発生! この2段構えで!
5.
basebackup + PITRによるbackup setup ・make
a replication user #attributes default['postgresql']['custom']['replication']['username'] = 'postgres_backup' default['postgresql']['custom']['replication']['password'] = 'backup_passwd' #recipes echo “CREATE ROLE #{repl_user} WITH REPLICATION LOGIN ENCRYPTED PASSWORD ‘ ¥ #{repl_pass}’;”" | psql -p #{node[‘postgresql’][‘config’][‘port']} ・enable archive mode # attributes # postgresql configure default['postgresql']['config']['archive_mode'] = ‘on default['postgresql']['config']['archive_command'] = 'if [ ! -d #{wal_dir} ]; th en mkdir #{wal_dir}; fi; test ! -f #{wal_dir}/%f && gzip < %p > #{wal_dir}/%f’
6.
basebackup + PITRによるbackup backup
& restore ・basebackup postgres $ pg_basebackup ・restore ・stop postgresql service root # service postgresql stop ・put backup data & recovery.conf postgres # cd $pg_data postgres # tar xfvz yyyymmdd_basebackup.tar.gz # postgresdata_dir/recovery.conf gzip < <%= node['postgresql']['custom']['archive_directory'] %>%f >%p ・start postgresql service root # service postgresql start
7.
・クラウド環境では別ストレージを保存先にすることで冗長性確保が可能 basebackup + PITRによるbackup directory
structure DB server Storage A Storage B DB data Backup data cloud infra cloud infra cloud infra cloud infra cloud infra
8.
pg_rmanによるbackup setup ・github sourceからmake https://github.com/ossc-db/pg_rman ・setup path #
.bash_profile/profile.pg_rman export PATH=$PATH:#{node['pg_rman']['bin_path']} export BACKUP_PATH=#{node[‘pg_rman']['backup']} ・pg_rman init postgres $ pg_rman init -B #{node[‘pg_rman']['backup']} -A #{node['pg_rman']['arclog']} ¥ -D #{node[‘postgresql']['config']['data_directory']} ・edit pg_rman.ini # templates->pg_rmandir/pg_rman.ini ARCLOG_PATH=<%= node['pg_rman']['arclog'] %> SRVLOG_PATH=<%= node['pg_rman']['backup'] %>/pg_log PGDATA=<%= node['postgresql']['config']['data_directory'] %> COMPRESS_DATA = <%= node['pg_rman']['config']['compress'] %> KEEP_ARCLOG_FILES = <%= node['pg_rman']['config']['keep_arclog_files'] %> KEEP_ARCLOG_DAYS = <%= node['pg_rman']['config']['keep_arclog_days'] %> KEEP_DATA_GENERATIONS = <%= node['pg_rman']['config']['keep_data_generations'] %> KEEP_DATA_DAYS = <%= node['pg_rman']['config']['keep_data_days'] %> KEEP_SRVLOG_FILES = <%= node['pg_rman']['config']['keep_srvlog_files'] %> KEEP_SRVLOG_DAYS = <%= node['pg_rman']['config']['keep_srvlog_days'] %>
9.
pg_rmanによるbackup full backup &
integral backup & restore ・full backup postgres $ pg_rman backup -b full ・incremental backup postgres $ pg_rman backup -b incremental ・restore database postgres $ pg_rman restore # When you’ll set a target time # pg_rman restore --recovery-target-time '2016-01-06 15:12:00'
10.
backupスケジュール ▸ cronによる以下定時backup pg_rman 毎週日曜日 2:45にfull
backup 日曜日以外の毎日 2:45にincremental backup pg_basebackup 毎週水曜日 3:45にbasebackup ▸ archive modeにて随時walを記録
Download now