一 问题描述
单机上安装Greenplum,初始化gpinitsystem -c initgp_config时报错:
20201118:11:13:10:005064 gpstart:pc205:gpadmin-[CRITICAL]:-Error occurred: non-zero rc: 1
Command was: 'env GPSESSID=0000000000 GPERA=ade1c97359a87184_201118111308 $GPHOME/bin/pg_ctl -D /data/greenplum/data/master/gpseg-1 -l /data/greenplum/data/master/gpseg-1/pg_log/startup.log -w -t 600 -o " -p 5432 -E " start'
rc=1, stdout='waiting for server to start.... stopped waiting
', stderr='pg_ctl: could not start server
master进程未起来。
查看上面提到的日志/data/greenplum/data/master/gpseg-1/pg_log/startup.log,发现有如下报错:
FATAL","XX000","could not map anonymous shared memory: Cannot allocate memory",,"This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 234474364 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.",,,,,,"CreateAnonymousSegment","pg_shmem.c",587,1 0xbe84ec postgres errstart (elog.c:557)
二 出错原因
内存不足
三 解决办法
① vi /etc/sysctl.conf,添加:
vm.overcommit_memory = 2
#使修改生效
sysctl -p
② 给服务器多分配些内存
如果是自己虚拟机的话,可以杀掉服务器上比较占内存的进程