Troubleshooting
===============

Python仮想環境を再作成する
^^^^^^^^^^^^^^^^^^^^^^^^^^

場合によっては、python
venvが矛盾した状態になることがあります。その場合、最も簡単な解決策は、削除して再作成することです。
venvが壊れた場合の症状には、次のようなプロビジョニング中のエラーが含まれる場合があります。

::

   TASK [Write Vagrantfile and firstboot.sh]  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  **** **
   failed: [localhost] (item=Vagrantfile) => {"changed": false, "checksum": "bf1403a17d897b68fa8137784d298d4da36fb7f9", "item": "Vagrantfile", "msg": "Aborting, target uses selinux but python bindings (libselinux-python) arent installed!"}

新しい仮想環境を作成するには（tpaexecがデフォルトの場所にインストールされたと仮定）：

::

   [tpa]$ sudo rm -rf /opt/EDB/TPA/tpa-venv
   [tpa]$ sudo /opt/EDB/TPA/bin/tpaexec setup

認証情報に関する奇妙なAWSエラー
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

TPAサーバーの日時が正しくない場合、プロビジョニング中に次のようなAWSエラーが発生します。

::

   TASK [Register key tpa_cluster in each region]  ****  ****  ****  ****  ****  ****  ****  ****  ****  ****  **** **
   An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ClientError: An error occurred (AuthFailure) when calling the DescribeKeyPairs operation: AWS was not able to validate the provided access credentials
   failed: [localhost] (item=eu-central-1) => {"boto3_version": "1.8.8", "botocore_version": "1.11.8", "changed": false, "error": {"code": "AuthFailure", "message": "AWS was not able to validate the provided access credentials"}, "item": "eu-central-1", "msg": "error finding keypair: An error occurred (AuthFailure) when calling the DescribeKeyPairs operation: AWS was not able to validate the provided access credentials", "response_metadata": {"http_headers": {"date": "Thu, 27 Sep 2018 12:49:41 GMT", "server": "AmazonEC2", "transfer-encoding": "chunked"}, "http_status_code": 401, "request_id": "a0d905ba-188f-48fe-8e5a-c8d8799e3232", "retry_attempts": 0}}

解決策 - 時刻と日付を正しく設定します。

::

   [tpa]$ sudo ntpdate pool.ntp.org

ロギング
^^^^^^^^

デフォルトでは、すべてのtpaexecロギングはログファイル\ ``<clusterdir>/ansible.log``
に保存されます

ログファイルの場所を変更するには、環境変数\ ``ANSIBLE_LOG_PATH``
を目的の場所に設定します。

::

   export ANSIBLE_LOG_PATH=~/ansible.log

ロギングの冗長性を高めるには、 ``-v`` /``-vv`` /``-vvv`` /``-vvvv``
/``-vvvvv`` をtpaexecコマンドラインに追加するだけです。

::

   [tpa]$ tpaexec deploy <clustername> -v

   - v     shows the results of modules
   - vv    shows the files from which tasks come
   - vvv   shows what commands are being executed on the target machines
   - vvvv  enables connection debugging, what callbacks have been loaded
   - vvvvv shows some additional ssh configuration, filepath information

クラスターテスト
^^^^^^^^^^^^^^^^

既存のクラスターをスモークテストする簡単な方法は、次を実行することです。

::

   [tpa]$ tpaexec test <clustername>

これにより、クラスターコンポーネントの機能テストが行われ、pgbenchを使用してクラスターのパフォーマンステストが行われます。
pgbenchは完了するまでに時間がかかる場合があるため、次を実行してベンチマークを省略できます。

::

   [tpa]$ tpaexec test <clustername> --skip-tags pgbench

testロールのタグは\ ``repmgr,postgres,barman,pgbench`` です

複数のタグを指定するときは、スペースを入れずにコンマで区切る必要があることに注意してください。例：

::

   [tpa]$ tpaexec test <clustername> --skip-tags barman,pgbench

TPAサーバーテスト
^^^^^^^^^^^^^^^^^

TPAサーバー自分自身のインストールを確認するには、次を実行します。

::

   [tpa]$ tpaexec selftest

特定のタグをスキップまたは含める
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

障害後にtpaexec provisionまたは
deployを再実行する場合、時間の都合上、特定のタグをスキップしてタスクを逃すと役立つ場合があります。たとえば、repmgrタスクを逃すには：

::

   [tpa]$ tpaexec deploy <clustername> --skip-tags repmgr

タグを指定して特定のタスクの再実行に直接ジャンプするには、たとえば、PGDタスクをすぐに実行します（従来の理由でタグは\ ``bdr``
です）：

::

   [tpa]$ tpaexec deploy <bdr-clustername> --tags bdr

-  これは、前のタスクがすべて正常に完了したことを前提としています。

関連するアーキテクチャの役立つタグをすべて見つけるには、次を実行します。

::

   [tpa]$ grep -rs "tags:" /opt/EDB/TPA/architectures
