Mal*_*umi 6 postgresql ubuntu debian
PostgreSQL 9.4.8 Ubuntu 16.04 64 位
我只想解释一下这里发生的事情。为什么找不到这个命令?没有其他的。
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$ pg_ctl stop -m fast
pg_ctl: command not found
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$ sudo pg_ctl stop -m fast
[sudo] password for malikarumi:
sudo: pg_ctl: command not found
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$ ls
clusterdb initdb pg_ctl pg_restore postmaster
createdb oid2name pg_dump pg_standby psql
createlang pg_archivecleanup pg_dumpall pg_test_fsync reindexdb
createuser pg_basebackup pg_isready pg_test_timing vacuumdb
dropdb pgbench pg_receivexlog pg_upgrade vacuumlo
droplang pg_config pg_recvlogical pg_xlogdump
dropuser pg_controldata pg_resetxlog postgres
malikarumi@Tetuoan2:/usr/lib/postgresql/9.4/bin$
Run Code Online (Sandbox Code Playgroud)
Eva*_*oll 16
pg_ctl by design isn't in the path of the version of PostgreSQL Debian (and therefore Ubuntu) distributes. PostgreSQL is installed as a service in Debian/Ubuntu
sudo service postgresql {start|stop|restart|reload|force-reload|status} [version ..]
Run Code Online (Sandbox Code Playgroud)
That command calls an init.d script which wraps around pg_ctlcluster. You can see that by opening /etc/init.d/postgresql. You can call pg_ctlcluster if you must. pg_ctrlcluster is a perl script that wraps around pg_ctl which isn't exposed (in the path) by design.
pg_ctrlcluster: multiversion/cluster aware pg_ctl wrapper; this also supplies the correct configuration parameters to 'start', and makes sure that postgres really stops on 'stop'.
pg_ctl is technically distributed, but there is no reason to ever call it directly. To find it run
find /usr/lib/postgresql/ -name pg_ctl
Run Code Online (Sandbox Code Playgroud)
You can call pg_ctl explicitly with the full path, however don't.
Also, going above and beyond and teaching you how to fish, you can always use apropos if you have these kind of questions later.
$ apropos pg_ctl
pg_ctl (1) - initialize, start, stop, or control a PostgreSQL server
pg_ctlcluster (1) - start/stop/restart/reload a PostgreSQL cluster
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20259 次 |
| 最近记录: |