psql连接单机部署的Greenplum5会报错:
psql: FATAL: System was started in master-only utility mode - only utility mode connections are allowed
命令可以使用
PGOPTIONS='-c gp_session_role=utility' psql -d postgres
但是程序、客户端都不行,
看看gpstart -help 那些启动参数,也都无关,
那就从源码上下功夫吧
./src/backend/utils/init/postinit.c
/*
* MPP: If we were started in utility mode then we only want to allow
* incoming sessions that specify gp_session_role=utility as well. This
* lets the bash scripts start the QD in utility mode and connect in but
* protect ourselves from normal clients who might be trying to connect to
* the system while we startup.
*/
if ((Gp_role == GP_ROLE_UTILITY) && (Gp_session_role != GP_ROLE_UTILITY))
{
ereport(FATAL,
(errcode(ERRCODE_CANNOT_CONNECT_NOW),
errmsg("System was started in master-only utility mode - only utility mode connections are allowed")));
}
注释掉后
重新编译
然后在编译好后的目录/usr/local/gpdb
中执行
find . | xargs grep -ri 'postinit.c'
找到使用的程序
Binary file ./bin/postgres matches
Binary file ./bin/postmaster matches
运行环境gpstop -a
对这两个程序进行替换
cd /usr/local/gpdb/bin
scp postgres root@10.0.197.198:/usr/local/gpdb/bin
scp postmaster root@10.0.197.198:/usr/local/gpdb/bin
运行环境gpstart -a
再次使用客户端连接即正常。