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
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
PPTX
できる!サーバレスアーキテクチャ
PDF
位置情報を使ったサービス「スマポ」をPostgreSQLで作ってみた db tech showcase 2013 Tokyo
PDF
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
PDF
PostgreSQLのトラブルシューティング@第5回中国地方DB勉強会
PDF
並列クエリを実行するPostgreSQLのアーキテクチャ
PDF
AWSのデータベースサービス全体像
PPTX
Windows Azure Storage:Best Practices and Internals
PDF
Jjugccc2017spring-postgres-ccc_m1
PDF
「今そこにある危機」を捉える ~ pg_stat_statements revisited
PDF
20210511_PGStrom_GpuCache
PDF
Azure Arc Jumpstart - Azure ArcBox を使った Azure Arc 対応 SQL MI 学習環境の構築
PDF
いまさら聞けないPostgreSQL運用管理
PPTX
MySQLメインの人がPostgreSQLのベンチマークをしてみた話
PDF
PostgreSQLレプリケーション(pgcon17j_t4)
PDF
あなたの知らないPostgreSQL監視の世界
PPTX
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
PPTX
俺とKubernetes
PPTX
Azure Database for MySQL PostgreSQLを使って運用の手間を省きませんか?
PDF
PySpark Intro Part.2 with SQL Graph
PostgreSQLアーキテクチャ入門(PostgreSQL Conference 2012)
できる!サーバレスアーキテクチャ
位置情報を使ったサービス「スマポ」をPostgreSQLで作ってみた db tech showcase 2013 Tokyo
Spring Boot の Web アプリケーションを Docker に載せて AWS ECS で動かしている話
PostgreSQLのトラブルシューティング@第5回中国地方DB勉強会
並列クエリを実行するPostgreSQLのアーキテクチャ
AWSのデータベースサービス全体像
Windows Azure Storage:Best Practices and Internals
Jjugccc2017spring-postgres-ccc_m1
「今そこにある危機」を捉える ~ pg_stat_statements revisited
20210511_PGStrom_GpuCache
Azure Arc Jumpstart - Azure ArcBox を使った Azure Arc 対応 SQL MI 学習環境の構築
いまさら聞けないPostgreSQL運用管理
MySQLメインの人がPostgreSQLのベンチマークをしてみた話
PostgreSQLレプリケーション(pgcon17j_t4)
あなたの知らないPostgreSQL監視の世界
CloudNativePGを動かしてみた! ~PostgreSQL on Kubernetes~(第34回PostgreSQLアンカンファレンス@オンライ...
俺とKubernetes
Azure Database for MySQL PostgreSQLを使って運用の手間を省きませんか?
PySpark Intro Part.2 with SQL Graph

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で簡易クラスタ管理