如何在不影响主机的情况下将 postgres 9.3 从机转换为读写
How do I convert a postgres 9.3 Slave to read-write without Impacting the Master
我在 Ubuntu 上设置了 Postgres 9.3 主从流复制设置。
我想通过中断复制将 Slave 转换为读写。但是,我不希望 Master 受到任何影响,因为它是一个关键的 Production。我只想要一个Master的分身,这样我就可以测试pg_upgrade.
我可以只运行一个"pg_ctl promote"在slave上,并为read/writes打开Slave吗? 运行在Slave上"pg_ctl promote"对Master有影响吗?
非常感谢。
来自 docs:
To trigger failover of a log-shipping standby server, run pg_ctl
promote or create a trigger file with the file name and path specified
by the trigger_file setting in recovery.conf. If you're planning to
use pg_ctl promote to fail over, trigger_file is not required.
所以 pg_ctl promote -D data_dir
和 touch trigger_file
都平等地提升奴隶。在发件人停止发送的意义上,Master 受到 slave 提升的影响。从 master 流出的其他 slaves 也会受到同样的影响。推广是标准动作。
唯一的具体案例would be cascaded replication:
If an upstream standby server is promoted to become new master,
downstream servers will continue to stream from the new master if
recovery_target_timeline is set to 'latest'.
没有下游"subslaves",鼓起勇气推广。
我在 Ubuntu 上设置了 Postgres 9.3 主从流复制设置。
我想通过中断复制将 Slave 转换为读写。但是,我不希望 Master 受到任何影响,因为它是一个关键的 Production。我只想要一个Master的分身,这样我就可以测试pg_upgrade.
我可以只运行一个"pg_ctl promote"在slave上,并为read/writes打开Slave吗? 运行在Slave上"pg_ctl promote"对Master有影响吗?
非常感谢。
来自 docs:
To trigger failover of a log-shipping standby server, run pg_ctl promote or create a trigger file with the file name and path specified by the trigger_file setting in recovery.conf. If you're planning to use pg_ctl promote to fail over, trigger_file is not required.
所以 pg_ctl promote -D data_dir
和 touch trigger_file
都平等地提升奴隶。在发件人停止发送的意义上,Master 受到 slave 提升的影响。从 master 流出的其他 slaves 也会受到同样的影响。推广是标准动作。
唯一的具体案例would be cascaded replication:
If an upstream standby server is promoted to become new master, downstream servers will continue to stream from the new master if recovery_target_timeline is set to 'latest'.
没有下游"subslaves",鼓起勇气推广。