我正在尝试通过以下Bitnami图表在AKS上部署PostgreSQL:https://github.com/bitnami/charts/tree/master/upstreamed/postgresql/#installing-the-chart
在部署过程中,我被邀请使用以下命令(一旦安装),以确保我能够访问集群外部的postgres(例如某些本地DBMS)
kubectl port-forward --namespace default svc/dozing-coral-postgresql 5432:5432 & PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -p 5432
结果导致语法错误:
At line:1 char:80
+ ... d --namespace default svc/dozing-coral-postgresql 5432:5432 & PGPASSW
...
+ ~
The ampersand (&) character is not allowed. The & operator is reserved for
future use; wrap an ampersand in double quotation marks ("&") to pass it as
part of a string.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmpersandNotAllowed
取消端口时钟的正确命令是什么?
答案 0 :(得分:2)
您应该看到的输出类似
SELECT EmpID, VALUE1, VALUE2,
SUM(VALUE1) OVER (PARTITION BY EmpID) AS total_Value1,
SUM(VALUE2) OVER (PARTITION BY EmpID) AS total_Value2
FROM TableName
有两个不同的命令。第一个是转发端口,最后一个To connect to your database from outside the cluster execute the following commands:
kubectl port-forward --namespace default svc/jolly-raccoon-postgresql 5432:5432 &
PGPASSWORD="$POSTGRES_PASSWORD" psql --host 127.0.0.1 -U postgres -p 5432
是将此命令发送到后台,以便您可以继续使用shell
&
第二个命令使您可以使用从安装了$ kubectl port-forward --namespace default svc/jolly-raccoon-postgresql 5432:5432 &
[1] 62447
Forwarding from 127.0.0.1:5432 -> 5432
客户端的另一台主机上转发的端口连接到数据库
psql