Skip to content

Commit 82a2f3d

Browse files
authored
Update README.md
1 parent c101e59 commit 82a2f3d

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

README.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,59 @@
11
# PostgresDBA
22
Useful tools for Postgres DBA
33

4+
## Requirements
5+
46
## Installation
57
Clone, go to the directory and run psql (version 10 is required):
68
```bash
79
git clone git@github.com:NikolayS/PostgresDBA.git
810
cd PostgresDBA
9-
psql
1011
```
1112

12-
In psql, type:
13+
That's it. Nothing is really needed to be installed.
14+
15+
## Usage
16+
17+
### Locally
18+
If you are running psql and Postgres server on the same machine, just launch psql:
19+
```bash
20+
psql -U <username> <dbname>
21+
```
22+
23+
And type (assuming that you are sitting in the `PostgresDBA` directory):
1324
```
14-
\i start.psql
25+
\i ./start.psql
1526
```
1627

1728
– it will open interactive menu.
1829

30+
### Remotely
31+
What to do if you need to connect to a remote Postgres server? Usually, Postgres is behind firewall and/or doesn't listen to a public netowork interface. So you need to be able to connect to the sever using SSH. If you can do it, then just create SSH tunnel (assuming that Postgres listens to default port 5432 on that server:
32+
33+
```bash
34+
ssh -rNTML 9432:localhost:5432 you-server.com
35+
```
36+
37+
Then, just launch psql, connecting to port 9432 at localhost:
38+
```bash
39+
psql -h localhost -p 9432 -U <username> <dbname>
40+
```
41+
42+
Then you are ready to use it (again, assuming you were sitting in the project directory when launching psql; otherwise, use absolute path):
43+
```
44+
\i ./start.psql
45+
```
46+
47+
### Heroku
48+
Sitting in the `PostgresDBA` directory on your local machine, run, as usual:
49+
```bash
50+
heroku pg:psql -a <your_project_name>
51+
```
52+
53+
And then, in psql:
54+
```
55+
\i ./start.psql
56+
```
57+
58+
## Uninstallation
59+
No steps are needed, just delete PostgresDBA directory.

0 commit comments

Comments
 (0)