命令行实用程序来隧道PostgreSQL连接
gotthard的Python项目详细描述
===
gotthard
=
=
gotthard是一个命令行工具,用于简化通过堡垒主机与postgresql实例的连接。
此工具是在zalando-stups的上下文中创建的,但是它可以在没有它的情况下使用。
内容:
:本地:
:深度:2
安装
==
…代码块::bash
$sudo pip3 install--upgrade gotthard
配置
==
gotthard没有自己的配置。它使用“piu配置”文件。
用法
=
gotthard可以提供有关命令本身的帮助:
……代码块::bash
$gotthard--help
gotthard可以在两种基本模式下运行:在前台和后台。
代码块::bash
$gotthard shipping.logistics.db.example.com
如果需要向命令传递选项,则必须添加“`--`”,以表示gotthard不应解释以下选项。
代码块::bash
$gotthard shipping.logistics.db.example.com psql
$gotthard shipping.logistics.db.example.com--psql-u myusername
stups:使用偶数和奇数时请求访问奇数只有当您被授予访问尝试连接的奇数主机的权限时,该命令才会成功。您可以手动请求访问,但也可以让gotthard来处理这个问题。当指定原因时,gotthard将为您实际执行“piu请求访问”。
代码块::bash
$gotthard shipping.logistics.db.example.com--reason=“investiging incident-123”psql
您可以使用
要连接的spilo设备的名称。
但这需要您登录到您的aws帐户,因为我们需要查询您的帐户。
代码块::bash
$gotthard shippinglogistics psql
它的任务完成了:它将报告隧道的详细信息。
在foregroed中运行时,gotthard将把postgresql相关的“环境变量”导出到需要运行的进程中。大多数postgresql客户端工具将使用这些环境变量进行连接,大多数python或perl脚本也应该遵循这些变量。代码块::bash
$gotthard shippinglogistics env grep pg
pguser=username
pghost=localhost
pg database=postgres
pgport=52296
pgsslmode=require
代码块::bash
$gotthard shipping.logistics.db.example.com--reason=“feature-123”--pg廑dump-d fancydb-fc-f fancydb.dump
代码块::bash
$query=“选择pg_数据库大小(当前目录)”
$gotthard example.us-west-2.rds.amazonaws.com--psql-u rds_admin-d featuredb-c“$query”
将spilo数据库复制到计算机上特权。
…代码块::bash
$gotthard shippinglogistics——pg_basebackuP-D/Postgres/我的数据
…_堡垒:https://en.wikipedia.org/wiki/bastion_host
…_扎兰多木塔:https://github.com/zalando stups
…_ PIU配置:http://stups.readthedocs.io/en/latest/components/piu.html;如何配置
…_ spilo:https://github.com/zalando/spilo
。_环境变量:https://www.postgresql.org/docs/current/static/libpq envars.html
gotthard
=
=
gotthard是一个命令行工具,用于简化通过堡垒主机与postgresql实例的连接。
此工具是在zalando-stups的上下文中创建的,但是它可以在没有它的情况下使用。
内容:
:本地:
:深度:2
安装
==
…代码块::bash
$sudo pip3 install--upgrade gotthard
配置
==
gotthard没有自己的配置。它使用“piu配置”文件。
用法
=
gotthard可以提供有关命令本身的帮助:
……代码块::bash
$gotthard--help
gotthard可以在两种基本模式下运行:在前台和后台。
代码块::bash
$gotthard shipping.logistics.db.example.com
如果需要向命令传递选项,则必须添加“`--`”,以表示gotthard不应解释以下选项。
代码块::bash
$gotthard shipping.logistics.db.example.com psql
$gotthard shipping.logistics.db.example.com--psql-u myusername
stups:使用偶数和奇数时请求访问奇数只有当您被授予访问尝试连接的奇数主机的权限时,该命令才会成功。您可以手动请求访问,但也可以让gotthard来处理这个问题。当指定原因时,gotthard将为您实际执行“piu请求访问”。
代码块::bash
$gotthard shipping.logistics.db.example.com--reason=“investiging incident-123”psql
您可以使用
要连接的spilo设备的名称。
但这需要您登录到您的aws帐户,因为我们需要查询您的帐户。
代码块::bash
$gotthard shippinglogistics psql
它的任务完成了:它将报告隧道的详细信息。
在foregroed中运行时,gotthard将把postgresql相关的“环境变量”导出到需要运行的进程中。大多数postgresql客户端工具将使用这些环境变量进行连接,大多数python或perl脚本也应该遵循这些变量。代码块::bash
$gotthard shippinglogistics env grep pg
pguser=username
pghost=localhost
pg database=postgres
pgport=52296
pgsslmode=require
代码块::bash
$gotthard shipping.logistics.db.example.com--reason=“feature-123”--pg廑dump-d fancydb-fc-f fancydb.dump
代码块::bash
$query=“选择pg_数据库大小(当前目录)”
$gotthard example.us-west-2.rds.amazonaws.com--psql-u rds_admin-d featuredb-c“$query”
将spilo数据库复制到计算机上特权。
…代码块::bash
$gotthard shippinglogistics——pg_basebackuP-D/Postgres/我的数据
…_堡垒:https://en.wikipedia.org/wiki/bastion_host
…_扎兰多木塔:https://github.com/zalando stups
…_ PIU配置:http://stups.readthedocs.io/en/latest/components/piu.html;如何配置
…_ spilo:https://github.com/zalando/spilo
。_环境变量:https://www.postgresql.org/docs/current/static/libpq envars.html