|
| 1 | +--- |
| 2 | +title: "CLI Usage" |
| 3 | +description: Overview of the pig cli tool |
| 4 | +icon: SquareTerminal |
| 5 | +weight: 600 |
| 6 | +--- |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +```bash |
| 11 | +pig - the Linux Package Manager for PostgreSQL and CLI tool for Pigsty |
| 12 | + |
| 13 | +Usage: |
| 14 | + pig [command] |
| 15 | + |
| 16 | +Examples: |
| 17 | + |
| 18 | + # get started: check https://github.com/pgsty/pig for details |
| 19 | + pig repo add -ru # overwrite existing repo & update cache |
| 20 | + pig ext add pg17 # install optional postgresql 17 package |
| 21 | + pig ext add pg_duckdb # install certain postgresql extension |
| 22 | + |
| 23 | + pig repo : add rm update list info status create boot cache |
| 24 | + pig ext : add rm update list info status import link build |
| 25 | + pig sty : init boot conf install get list |
| 26 | + |
| 27 | + |
| 28 | +PostgreSQL Extension Manager |
| 29 | + ext Manage PostgreSQL Extensions (pgext) |
| 30 | + repo Manage Linux Software Repo (apt/dnf) |
| 31 | + |
| 32 | +Pigsty Management Commands |
| 33 | + sty Manage Pigsty Installation |
| 34 | + |
| 35 | +Additional Commands: |
| 36 | + build Build Postgres Extension |
| 37 | + completion Generate the autocompletion script for the specified shell |
| 38 | + help Help about any command |
| 39 | + status Show Environment Status |
| 40 | + update Upgrade pig itself |
| 41 | + version Show pig version info |
| 42 | + |
| 43 | +Flags: |
| 44 | + --debug enable debug mode |
| 45 | + -h, --help help for pig |
| 46 | + -i, --inventory string config inventory path |
| 47 | + --log-level string log level: debug, info, warn, error, fatal, panic (default "info") |
| 48 | + --log-path string log file path, terminal by default |
| 49 | + -t, --toggle Help message for toggle |
| 50 | + |
| 51 | +Use "pig [command] --help" for more information about a command. |
| 52 | +``` |
| 53 | + |
| 54 | +------ |
| 55 | + |
| 56 | +## Examples |
| 57 | + |
| 58 | +### Environment Status |
| 59 | + |
| 60 | +```bash |
| 61 | +pig status # show os & pg & pig status |
| 62 | +pig repo status # show upstream repo status |
| 63 | +pig ext status # show pg extensions status |
| 64 | +``` |
| 65 | + |
| 66 | +### Extension Management |
| 67 | + |
| 68 | +Check [`pig ext`](/cmd/ext/) for details. |
| 69 | + |
| 70 | +```bash |
| 71 | +pig ext list [query] # list & search extension |
| 72 | +pig ext info [ext...] # get information of a specific extension |
| 73 | +pig ext status [-v] # show installed extension and pg status |
| 74 | +pig ext add [ext...] # install extension for current pg version |
| 75 | +pig ext rm [ext...] # remove extension for current pg version |
| 76 | +pig ext update [ext...] # update extension to the latest version |
| 77 | +pig ext import [ext...] # download extension to local repo |
| 78 | +pig ext link [ext...] # link postgres installation to path |
| 79 | +pig ext upgrade # fetch the latest extension catalog |
| 80 | +``` |
| 81 | + |
| 82 | +### Repo Management |
| 83 | + |
| 84 | +Check [`pig repo`](/cmd/repo/) for details. |
| 85 | + |
| 86 | +```bash |
| 87 | +pig repo list # available repo list |
| 88 | +pig repo info [repo|module...] # show repo info |
| 89 | +pig repo status # show current repo status |
| 90 | +pig repo add [repo|module...] # add repo and modules |
| 91 | +pig repo rm [repo|module...] # remove repo & modules |
| 92 | +pig repo update # update repo pkg cache |
| 93 | +pig repo create # create repo on current system |
| 94 | +pig repo boot # boot repo from offline package |
| 95 | +pig repo cache # cache repo as offline package |
| 96 | +``` |
| 97 | + |
| 98 | +### Pigsty Management |
| 99 | + |
| 100 | +Check [`pig sty`](/cmd/sty/) for details. |
| 101 | + |
| 102 | +The pig can also be used as a cli tool for Pigsty — the battery-include free PostgreSQL RDS. |
| 103 | +Which brings HA, PITR, Monitoring, IaC, and all the extensions to your PostgreSQL cluster. |
| 104 | + |
| 105 | +```bash |
| 106 | +pig sty init # install pigsty to ~/pigsty |
| 107 | +pig sty boot # install ansible and other pre-deps |
| 108 | +pig sty conf # auto-generate pigsty.yml config file |
| 109 | +pig sty install # run the install.yml playbook |
| 110 | +``` |
| 111 | + |
| 112 | +You can use the `pig sty` subcommand to bootstrap pigsty on current node. |
0 commit comments