SlideShare a Scribd company logo
Bgworkerで簡易クラスタ管理
澤田 雅彦

!
!

@PostgreSQL アンカンファレンス
自己紹介
•

名前
•

澤田雅彦 (twitter @sawada_masahiko)
Bgworker(Background Worker Processes)って?
•

PostgreSQL 9.3で入った新機能の一つ

•

BgWorkerは、ユーザが独自にバックグラウンドプロ

セスを定義できる機能
•

複数プロセスを立ち上げることも可能

•

詳しくは、src/backend/postmaster/bgworker.c
Bgworkerの特徴
•

柔軟な機能実装が可能
•

サーバプロセスのように振る舞うことも可能。内部的にサーバに
接続することもできる

•

libpqを使用して、クライアントとしてPostgreSQLに接続すること
も可能

•

プロセス起動のタイミングが選べる
•

Postmasterプロセス起動時にプロセス起動、参照/更新クエリを受
け取った時にプロセス起動など、選ぶことができる
Bgwoker機能を使って、
簡易クラスタ管理モジュール
を作りました
pg_promoter概要
Master

Replication

Slave
postgres

postgres

wal receiver

wal sender

checkpointer

checkpointer

:
:
bgworker
(pg__promoter)

:
:
pg_promoter概要
Master

Replication

Slave
postgres

postgres
wal receiver
shared_preload_libraries = ‘pg_promoter’
pg_promoter.keepalive = 5
wal sender
checkpointer
pg_promoter.primary_conninfo = ‘host=192.168.1.100’
checkpointer
:
:

:
:
bgworker
(pg__promoter)
pg_promoter概要
Master

Replication

Slave
postgres

postgres

wal receiver

wal sender

checkpointer

checkpointer

:
:
bgworker
(pg__promoter)

:
:
pg_promoter概要
Master

Replication

Slave
postgres

postgres

wal receiver

wal sender

checkpointer

checkpointer

:
:
bgworker
(pg__promoter)

:
:

Monitering
pg_promoter概要

☓
Master

Replication

Slave
postgres

postgres

wal receiver

wal sender

checkpointer

checkpointer

:
:
bgworker
(pg__promoter)

:
:

Monitering
pg_promoter概要

☓
Master

Slave→Master
postgres

postgres

wal receiver

wal sender

checkpointer
Promoting
:
:
bgworker
(pg__promoter)

checkpointer
:
:
pg_promoter概要

☓
Master

postgres

wal sender

checkpointer
:
:

Master
postgres
checkpointer
:
:
demo
最後に
•

githubで公開してます!
•

•

https://github.com/Masahiko-Sawada/pg_promoter

bgwokerで自作モジュールを作ってみよう!
ご静聴ありがとうございました

More Related Content

PPTX
PostgreSQL共有バッファと関連ツール
PDF
PostgreSQL UPDATEs 2016年5月 - OSC群馬
PDF
RとSQLiteで気軽にデータベース作成
PDF
R以外の研究ツール
PPTX
Redis速習会@Wantedly
KEY
データベースのお話
PDF
Redisととあるシステム
PDF
Fluentd casual
PostgreSQL共有バッファと関連ツール
PostgreSQL UPDATEs 2016年5月 - OSC群馬
RとSQLiteで気軽にデータベース作成
R以外の研究ツール
Redis速習会@Wantedly
データベースのお話
Redisととあるシステム
Fluentd casual

What's hot (20)

KEY
Apache 2.4 ChangeLog at 闇Webサーバ勉強会#5
PPTX
Ctb57 with god7
KEY
ソーシャルゲームログ解析基盤のMongoDB活用事例
PPTX
Next-L Enju ワークショップ #86
PDF
Postgres Toolkitのご紹介
PDF
丸の内MongoDB勉強会#20LT 2.8のストレージエンジン動かしてみました
PDF
CouchDB JP & BigCouch
PDF
Ubuntuとコンテナ技術 What is LXD? and Why? 2015-12-08
PDF
第8回KPF発表資料
PDF
“bcache”を使ってSSDの速さと HDDの大容量のいいとこどり 2015-12-12
PDF
Website build exercise_opsguide_japanese
PDF
カウチなやつら CouchDB in the room
PDF
New configurationoferogamescaperev3
PPTX
Seastar:高スループットなサーバアプリケーションの為の新しいフレームワーク
PDF
新生Lagopus2017(仮称)
PDF
PostgreSQLのパラレル化に向けた取り組み@第30回(仮名)PostgreSQL勉強会
PPTX
HUで6000万pvのトラフィックを捌くまでに起ったことをありのままに話すぜ
PDF
Yapcasia2012 ltthon
PDF
PostgreSQLではじめるOSS開発@OSC 2014 Hiroshima
PDF
Couch DB in 15minutes
Apache 2.4 ChangeLog at 闇Webサーバ勉強会#5
Ctb57 with god7
ソーシャルゲームログ解析基盤のMongoDB活用事例
Next-L Enju ワークショップ #86
Postgres Toolkitのご紹介
丸の内MongoDB勉強会#20LT 2.8のストレージエンジン動かしてみました
CouchDB JP & BigCouch
Ubuntuとコンテナ技術 What is LXD? and Why? 2015-12-08
第8回KPF発表資料
“bcache”を使ってSSDの速さと HDDの大容量のいいとこどり 2015-12-12
Website build exercise_opsguide_japanese
カウチなやつら CouchDB in the room
New configurationoferogamescaperev3
Seastar:高スループットなサーバアプリケーションの為の新しいフレームワーク
新生Lagopus2017(仮称)
PostgreSQLのパラレル化に向けた取り組み@第30回(仮名)PostgreSQL勉強会
HUで6000万pvのトラフィックを捌くまでに起ったことをありのままに話すぜ
Yapcasia2012 ltthon
PostgreSQLではじめるOSS開発@OSC 2014 Hiroshima
Couch DB in 15minutes
Ad

Viewers also liked (19)

PDF
FEL Flyer F12
PPTX
Kghmi default slide
PPT
U.S. History Ch. !2
PPT
Qualificação (Curta) Julho 2009
PDF
Innovative Integrationsmöglichkeit von Aufzeichnungen und Livestreaming für H...
PPT
Emerging Trends in LIS
DOC
Resume - Mr. Patil Sujay Prabhakar 2016
PDF
Programa de rastreo espia para celular
PDF
Relatвrio
PPTX
Cornwall Life magazine analysis
PDF
Bygg din egen merkevare på nett
PDF
fuente 10
PPS
Aperitivo
PPTX
Imagen Global
PDF
Discovery of BMS-955176, a Second Generation HIV‑1 Maturation Inhibitor with ...
DOCX
Conjuntos de entidades débiles
PPT
Presentatie aan studenten universiteit van Twente
PPTX
Arte egipcio
FEL Flyer F12
Kghmi default slide
U.S. History Ch. !2
Qualificação (Curta) Julho 2009
Innovative Integrationsmöglichkeit von Aufzeichnungen und Livestreaming für H...
Emerging Trends in LIS
Resume - Mr. Patil Sujay Prabhakar 2016
Programa de rastreo espia para celular
Relatвrio
Cornwall Life magazine analysis
Bygg din egen merkevare på nett
fuente 10
Aperitivo
Imagen Global
Discovery of BMS-955176, a Second Generation HIV‑1 Maturation Inhibitor with ...
Conjuntos de entidades débiles
Presentatie aan studenten universiteit van Twente
Arte egipcio
Ad

Similar to Bgworkerで簡易クラスタ管理 (20)

PDF
Kof2016 postgresql-9.6
PDF
PostgreSQL運用管理入門
PDF
[C31] OSS-DB Exam Silver 技術解説セミナー by Ryota Watabe
PDF
PostgreSQLのトラブルシューティング@第5回中国地方DB勉強会
PDF
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
PDF
pgbenchのスレッドとクライアント (第51回 PostgreSQLアンカンファレンス@オンライン 発表資料)
PDF
OSS-DB Gold技術解説セミナー@db tech showcase 東京 2014
PDF
Hackers Champloo 2016 postgresql-9.6
PDF
並列クエリを実行するPostgreSQLのアーキテクチャ
PDF
Chugoku db 17th-postgresql-9.6
PDF
あなたの知らないPostgreSQL監視の世界
PDF
[db tech showcase Tokyo 2014] C31: PostgreSQLをエンタープライズシステムで利用しよう by PostgreS...
PDF
20221116_DBTS_PGStrom_History
PDF
PostgreSQL 10 新機能 @OSC 2017 Fukuoka
PDF
PostgreSQLのリカバリ超入門(もしくはWAL、CHECKPOINT、オンラインバックアップの仕組み)
PDF
PGOを用いたPostgreSQL on Kubernetes入門(PostgreSQL Conference Japan 2022 発表資料)
PDF
いまさら聞けないPostgreSQL運用管理
PDF
OSC沖縄2014_JPUG資料
PDF
PostgreSQL 10 新機能 @オープンセミナー香川 2017
PDF
[db tech showcase Tokyo 2014] B26: PostgreSQLを拡張してみよう by SRA OSS, Inc. 日本支社 高塚遥
Kof2016 postgresql-9.6
PostgreSQL運用管理入門
[C31] OSS-DB Exam Silver 技術解説セミナー by Ryota Watabe
PostgreSQLのトラブルシューティング@第5回中国地方DB勉強会
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
pgbenchのスレッドとクライアント (第51回 PostgreSQLアンカンファレンス@オンライン 発表資料)
OSS-DB Gold技術解説セミナー@db tech showcase 東京 2014
Hackers Champloo 2016 postgresql-9.6
並列クエリを実行するPostgreSQLのアーキテクチャ
Chugoku db 17th-postgresql-9.6
あなたの知らないPostgreSQL監視の世界
[db tech showcase Tokyo 2014] C31: PostgreSQLをエンタープライズシステムで利用しよう by PostgreS...
20221116_DBTS_PGStrom_History
PostgreSQL 10 新機能 @OSC 2017 Fukuoka
PostgreSQLのリカバリ超入門(もしくはWAL、CHECKPOINT、オンラインバックアップの仕組み)
PGOを用いたPostgreSQL on Kubernetes入門(PostgreSQL Conference Japan 2022 発表資料)
いまさら聞けないPostgreSQL運用管理
OSC沖縄2014_JPUG資料
PostgreSQL 10 新機能 @オープンセミナー香川 2017
[db tech showcase Tokyo 2014] B26: PostgreSQLを拡張してみよう by SRA OSS, Inc. 日本支社 高塚遥

More from Masahiko Sawada (20)

PDF
PostgreSQL 15の新機能を徹底解説
PDF
行ロックと「LOG: process 12345 still waiting for ShareLock on transaction 710 afte...
PDF
PostgreSQL 15 開発最新情報
PDF
Vacuum徹底解説
PDF
Transparent Data Encryption in PostgreSQL
PDF
PostgreSQL 12の話
PDF
OSS活動のやりがいとそれから得たもの - PostgreSQLコミュニティにて -
PDF
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
PDF
Bloat and Fragmentation in PostgreSQL
PDF
Database Encryption and Key Management for PostgreSQL - Principles and Consid...
PDF
今秋リリース予定のPostgreSQL11を徹底解説
PDF
Vacuum more efficient than ever
PDF
Vacuumとzheap
PDF
アーキテクチャから理解するPostgreSQLのレプリケーション
PDF
Parallel Vacuum
PDF
PostgreSQLでスケールアウト
PDF
OSS 開発ってどうやっているの? ~ PostgreSQL の現場から~
PDF
PostgreSQL10徹底解説
PDF
FDW-based Sharding Update and Future
PDF
What’s new in 9.6, by PostgreSQL contributor
PostgreSQL 15の新機能を徹底解説
行ロックと「LOG: process 12345 still waiting for ShareLock on transaction 710 afte...
PostgreSQL 15 開発最新情報
Vacuum徹底解説
Transparent Data Encryption in PostgreSQL
PostgreSQL 12の話
OSS活動のやりがいとそれから得たもの - PostgreSQLコミュニティにて -
Transparent Data Encryption in PostgreSQL and Integration with Key Management...
Bloat and Fragmentation in PostgreSQL
Database Encryption and Key Management for PostgreSQL - Principles and Consid...
今秋リリース予定のPostgreSQL11を徹底解説
Vacuum more efficient than ever
Vacuumとzheap
アーキテクチャから理解するPostgreSQLのレプリケーション
Parallel Vacuum
PostgreSQLでスケールアウト
OSS 開発ってどうやっているの? ~ PostgreSQL の現場から~
PostgreSQL10徹底解説
FDW-based Sharding Update and Future
What’s new in 9.6, by PostgreSQL contributor

Bgworkerで簡易クラスタ管理