当我停止仍然连接到某些会话的HAWQ实例时,它无法以“hawq stop -a”停止。
$ hawq stop cluster -a
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-Prepare to do 'hawq stop'
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-You can find log in:
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-/Users/wangchunling/hawqAdminLogs/hawq_stop_20160701.log
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-GPHOME is set to:
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-/usr/local/hawq
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-Stop hawq with args: ['stop', 'cluster']
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-No standby host configured
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-Stop hawq cluster
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[INFO]:-There are 1 connections to the database
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[WARNING]:-There are other connections to this instance, shutdown mode smart aborted
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[WARNING]:-Either remove connections, or use 'hawq stop master -M fast' or 'hawq stop master -M immediate'
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[WARNING]:-See hawq stop --help for all options
20160701:10:02:09:032804 hawq_stop:ChunlingdeMacBook-Pro:wangchunling-[ERROR]:-Active connections. Aborting shutdown...
那么“hawq stop -M immediate”和“hawq stop -M fast”之间的区别是什么?
答案 0 :(得分:1)
-M fast
快速关闭。正在进行的任何事务都会被中断并回滚。
-M immediate
立即关闭。正在进行的任何交易都将中止。此模式会终止所有postgres进程,而不允许数据库服务器完成事务处理或清除任何临时或进程内工作文件。
以下是HAWQ文档的链接:http://hdb.docs.pivotal.io/20/reference/cli/admin_utilities/hawqrestart.html
答案 1 :(得分:1)
不建议立即关机。因为在某些情况下,它可能导致数据库损坏,需要手动恢复。您可以参考@Wen Lin提到的链接http://hdb.docs.pivotal.io/20/reference/cli/admin_utilities/hawqrestart.html中的文档。
作为替代方案,建议使用" hawq stop cluster -a -M fast"或者使用" pg_cancel_backend()"然后做" hawq停止集群-a"。
答案 2 :(得分:1)
在内部,stop只是向postgres进程发送信号。不同的停止模式意味着不同的信
智能模式:SIGTERM
快速模式:SIGINT
立即模式:SIGQUIT