postgresql数据库怎么重启
启动一个postgres最简单的方法是使用postgres命令(执行前请确认data目录已经被初始化完成)
服务器必须由PostgreSQL用户帐户运行,而不是由root用户或任何其他用户运行,所以先确认切换为postgres用户
推荐:postgrsql教程
postgres@me:/usr/local/pgsql$./bin/postgres-D./data
这个命令使得数据库在前台运行,为了使得运维数据库更加方便,包装程序pg_ctl将简化一些操作,先看看pg_ctl的帮助信息:
postgres@me:/usr/local/pgsql$./bin/pg_ctl--help pg_ctlisautilitytoinitialize,start,stop,orcontrolaPostgreSQLserver. Usage: pg_ctlinit[db][-DDATADIR][-s][-oOPTIONS] pg_ctlstart[-DDATADIR][-lFILENAME][-W][-tSECS][-s] [-oOPTIONS][-pPATH][-c] pg_ctlstop[-DDATADIR][-mSHUTDOWN-MODE][-W][-tSECS][-s] pg_ctlrestart[-DDATADIR][-mSHUTDOWN-MODE][-W][-tSECS][-s] [-oOPTIONS][-c] pg_ctlreload[-DDATADIR][-s] pg_ctlstatus[-DDATADIR] pg_ctlpromote[-DDATADIR][-W][-tSECS][-s] pg_ctlkillSIGNALNAMEPID Commonoptions: -D,--pgdata=DATADIRlocationofthedatabasestoragearea -s,--silentonlyprinterrors,noinformationalmessages -t,--timeout=SECSsecondstowaitwhenusing-woption -V,--versionoutputversioninformation,thenexit -w,--waitwaituntiloperationcompletes(default) -W,--no-waitdonotwaituntiloperationcompletes -?,--helpshowthishelp,thenexit Ifthe-Doptionisomitted,theenvironmentvariablePGDATAisused. Optionsforstartorrestart: -c,--core-filesallowpostgrestoproducecorefiles -l,--log=FILENAMEwrite(orappend)serverlogtoFILENAME -o,--options=OPTIONScommandlineoptionstopasstopostgres (PostgreSQLserverexecutable)orinitdb -pPATH-TO-POSTGRESnormallynotnecessary Optionsforstoporrestart: -m,--mode=MODEMODEcanbe"smart","fast",or"immediate" Shutdownmodesare: smartquitafterallclientshavedisconnected fastquitdirectly,withpropershutdown(default) immediatequitwithoutcompleteshutdown;willleadtorecoveryonrestart Allowedsignalnamesforkill: ABRTHUPINTQUITTERMUSR1USR2
一句话描述:pg_ctl是一个集初始化,启动,停止,或者控制PostgreSQL服务器于一体的实用程序。
更多技术请关注Python视频教程。
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.