我刚刚按照说明here在Ubuntu 16.10上安装了Postgres 9.5。
我需要在独立模式下运行Postgres以获得数据库真空。我需要运行这个命令:
postgres --single -D /full/path/to/datadir postgres
但是postgres
命令不可用:
$ postgres
No command 'postgres' found, did you mean:
Command 'postgrey' from package 'postgrey' (universe)
postgres: command not found
它在postgres
用户路径中不可用:
dbuser@pgserver:~$ sudo -i
root@pgserver:~# su postgres
postgres@pgserver:/root$ postgres
No command 'postgres' found, did you mean:
Command 'postgrey' from package 'postgrey' (universe)
postgres: command not found
此实用程序在哪里,或者我需要安装什么才能访问它?
答案 0 :(得分:0)
public interface WalkListener extends EventListener {
public void walkPerformed(int x);
}
public interface JumpListener extends EventListener {
public void jumpPerformed(int y);
}
public class Game {
private Vector<WalkListener> walkListeners;
private Vector<JumpListener> jumpListeners;
public void addWalkListener(WalkListener listener) { ... }
public void addJumpListener(JumpListener listener) { ... }
public void performWalk(int x) {
...
walkListeners.get(0).walkPerformed(x);
...
}
public void performJump(int y) {
...
jumpListeners.get(0).jumpPerformed(y);
...
}
private class Walk implements WalkListener { ... }
private class Jump implements JumpListener { ... }
}
public class GameTest {
@Test
public void finalTest() {
Game game = new Game();
WalkListener walkListener = mock(WalkListener.class)
JumpListener jumpListener = mock(JumpListener.class)
game.addWalkListener(walkListener);
game.addJumpListener(jumpListener);
game.performWalk(5);
game.performJump(2);
InOrder order = inOrder(walkListener, jumpListener);
order.verify(walkListener).walkPerformed(5);
order.verify(jumpListener).jumpPerformed(2);
}
}
命令(以及postgres
和其他命令)位于pg_ctl
。
值得注意的是,它们必须由像/usr/lib/postgresql/9.5/bin
这样的非特权用户运行。以下是我为解决问题所做的工作:
为postgres用户创建主目录:
postgres
编辑路径:
$ sudo -i
$ mkdir /home/postgres
$ chown postgres:postgres /home/postgres
$ usermod -d /home/postgres/ postgres
附加:
$ su - postgres
$ vim ~/.bash_profile
运行PATH=$PATH:/usr/lib/postgresql/9.5/bin
export PATH
以访问命令:
su - postgres