Greenplum连接登录测试
本文章记录Greenplum数据库的登录测试,主要利用的psql客户端工具
1、psql的帮助信息
psql -help
[gpadmin@mdw bin]$ psql --help
This is psql 8.3.23, the PostgreSQL interactive terminal (Greenplum version).
Usage:
psql [OPTION]... [DBNAME [USERNAME]]
General options:
-c, --command=COMMAND run only single command (SQL or internal) and exit
-d, --dbname=DBNAME database name to connect to (default: "archdata")
-f, --file=FILENAME execute commands from file, then exit
-l, --list list available databases, then exit
-v, --set=, --variable=NAME=VALUE
set psql variable NAME to VALUE
-X, --no-psqlrc do not read startup file (~/.psqlrc)
-1 ("one"), --single-transaction
execute command file as a single transaction
--help show this help, then exit
--version output version information, then exit
Input and output options:
-a, --echo-all echo all input from script
-e, --echo-queries echo commands sent to server
-E, --echo-hidden display queries that internal commands generate
-L, --log-file=FILENAME send session log to file
-n, --no-readline disable enhanced command line editing (readline)
-o, --output=FILENAME send query results to file (or |pipe)
-q, --quiet run quietly (no messages, only query output)
-s, --single-step single-step mode (confirm each query)
-S, --single-line single-line mode (end of line terminates SQL command)
Output format options:
-A, --no-align unaligned table output mode
-F, --field-separator=STRING
set field separator (default: "|")
-H, --html HTML table output mode
-P, --pset=VAR[=ARG] set printing option VAR to ARG (see \pset command)
-R, --record-separator=STRING
set record separator (default: newline)
-t, --tuples-only print rows only
-T, --table-attr=TEXT set HTML table tag attributes (e.g., width, border)
-x, --expanded turn on expanded table output
Connection options:
-h, --host=HOSTNAME database server host or socket directory (default: "local socket")
-p, --port=PORT database server port (default: "5432")
-U, --username=USERNAME database user name (default: "gpadmin")
-w, --no-password never prompt for password
-W, --password force password prompt (should happen automatically)
For more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within psql, or consult the psql section in the PostgreSQL
documentation.
主要常用的参数有:
-d,指定要连接的数据库,基本每次登录GreenPlum数据库都需要使用这个参数。
-l,列出可用的所有数据库,如果忘记了要登录数据库的名字,可以使用这个参数查看。
-h,指定要连接的数据库服务器的IP地址,默认是本机(localhost)。
-p,指定数据库的端口号,默认是5432.
-U,连接数据库的用户名,默认是gpadmin。
例如:
$ psql -d gpdatabase -h master_host -p 5432 -U gpadmin
检查一下GP当前有多少个databse
[gpadmin@mdw ~]$ more .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH export MASTER_DATA_DIRECTORY=/greenplum/gpdata/maste

本文详细介绍了如何使用psql客户端工具进行Greenplum数据库的登录测试,包括连接参数的使用、远程登录的配置调整及常见错误解决,适合Greenplum初学者和运维人员参考。
最低0.47元/天 解锁文章
708

被折叠的 条评论
为什么被折叠?



