1.16. PostgreSQL データベースにアクセスしてトラブルシューティング


1.16.1. 症状: Multicluster Global Hub のエラー

Multicluster Global Hub ではさまざまなエラーが発生する可能性があります。プロビジョニングされた PostgreSQL データベースにアクセスして、Multicluster Global Hub の問題のトラブルシューティングに役立つメッセージを表示できます。

1.16.2. 問題の解決: PostgresSQL データベースへのアクセス

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"
  • LoadBalancer

    • デフォルトでプロビジョニングされた LoadBalancer にサービスタイプを公開します。

      cat <<EOF | oc apply -f -
      apiVersion: v1
      kind: Service
      metadata:
        name: multicluster-global-hub-postgres-lb
        namespace: multicluster-global-hub
      spec:
        ports:
        - name: postgres
          port: 5432
          protocol: TCP
          targetPort: 5432
        selector:
          name: multicluster-global-hub-postgres
        type: LoadBalancer
      EOF

      認証情報を取得するには、次のコマンドを実行します。

      # 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}}'
    • Crunchy Operator によってプロビジョニングされた LoadBalancer にサービスタイプを公開します。

      oc patch postgrescluster postgres -n multicluster-global-hub -p '{"spec":{"service":{"type":"LoadBalancer"}}}'  --type merge

      認証情報を取得するには、次のコマンドを実行します。

      # Host
      oc get svc -n multicluster-global-hub postgres-ha -ojsonpath='{.status.loadBalancer.ingress[0].hostname}'
      
      # Username
      oc get secrets -n multicluster-global-hub postgres-pguser-postgres -o go-template='{{index (.data) "user" | base64decode}}'
      
      # Password
      oc get secrets -n multicluster-global-hub postgres-pguser-postgres -o go-template='{{index (.data) "password" | base64decode}}'
      
      # Database
      oc get secrets -n multicluster-global-hub postgres-pguser-postgres -o go-template='{{index (.data) "dbname" | base64decode}}'
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

Red Hat ドキュメントについて

Red Hat をお使いのお客様が、信頼できるコンテンツが含まれている製品やサービスを活用することで、イノベーションを行い、目標を達成できるようにします。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

© 2024 Red Hat, Inc.