命令行实用程序来隧道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

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java能否使用OpenJPA将一个实体持久化到多个持久化单元?   java如何访问当前按下的键   java singleton是否意味着哈希代码总是返回相同的值?   inputstream无法在Java中同时使用STDIN和STDERR读取程序输出   java运行时有多贵。getRuntime()与获取内存度量相结合   java AndroidStudio ListView适配器更新   java小程序请求未扩展实时会话   java是设置布尔值所必需的关键部分?   java比较两个字符串,并突出显示发现的不匹配项   java带抽屉布局,无论哪个屏幕处于活动状态,如何在按下后退键时关闭应用程序?   爪哇:颜色有什么区别。黑色和彩色。黑色   Velocity模板中子类的java访问方法   java如何快速学习Drools或其他规则引擎   从Java应用程序访问时缓存数据库查询结果   java cassandra nodetool JPLISAgent。c错误   java我正在解析一个没有pubDate的RSS提要,有没有其他方法可以确定一个项目是何时发布的?