1.18. 通过访问 PostgreSQL 数据库进行故障排除
1.18.1. 症状:带有多集群全局 hub 的错误 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
您可能会遇到多集群全局 hub 的各种错误。您可以访问置备的 PostgreSQL 数据库来查看对多集群全局 hub 问题进行故障排除的信息。
1.18.2. 解决问题: 访问 PostgresSQL 数据库 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
There are two ways to access the provisioned PostgreSQL database.
There are two ways to access the provisioned PostgreSQL database.
使用
ClusterIP
服务oc exec -it multicluster-global-hub-postgres-0 -c multicluster-global-hub-postgres -n multicluster-global-hub -- psql -U postgres -d hoh # Or access the database installed by crunchy operator oc exec -it $(kubectl get pods -n multicluster-global-hub -l postgres-operator.crunchydata.com/role=master -o jsonpath='{.items..metadata.name}') -c database -n multicluster-global-hub -- psql -U postgres -d hoh -c "SELECT 1"
oc exec -it multicluster-global-hub-postgres-0 -c multicluster-global-hub-postgres -n multicluster-global-hub -- psql -U postgres -d hoh # Or access the database installed by crunchy operator oc exec -it $(kubectl get pods -n multicluster-global-hub -l postgres-operator.crunchydata.com/role=master -o jsonpath='{.items..metadata.name}') -c database -n multicluster-global-hub -- psql -U postgres -d hoh -c "SELECT 1"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow LoadBalancer
将服务类型公开给默认置备的
LoadBalancer
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令来获取凭证:
Host Password
# Host oc get svc postgres-ha -ojsonpath='{.status.loadBalancer.ingress[0].hostname}' # Password oc get secrets -n multicluster-global-hub postgres-pguser-postgres -o go-template='{{index (.data) "password" | base64decode}}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将服务类型公开给 crunchy operator 置备的
LoadBalancer
:oc patch postgrescluster postgres -n multicluster-global-hub -p '{"spec":{"service":{"type":"LoadBalancer"}}}' --type merge
oc patch postgrescluster postgres -n multicluster-global-hub -p '{"spec":{"service":{"type":"LoadBalancer"}}}' --type merge
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 运行以下命令来获取凭证:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow