26.3. Справка по расширению BiHA #
Подавляющий объём работы BiHA происходит автоматически, лишь некоторые из параметров можно редактировать вручную.
26.3.1. Параметры конфигурации #
Полезные параметры конфигурации:
biha.can_be_leader(boolean) #Определяет возможность узла стать лидером. Значение по умолчанию —
true. Если задано значениеfalse, узел не может предлагать себя в качестве кандидата на выборах лидера.biha.can_vote(boolean) #Определяет возможность узла голосовать. Значение по умолчанию —
true. Если задать значениеfalse, узел не сможет принимать участие в голосовании, а также не сможет предлагать себя в качестве кандидата в лидеры.biha.flw_ro(boolean) #Определяет доступность последователя для операций на чтение. Если задано значение
off, чтение с этого последователя запрещено. Значение по умолчанию —on.biha.heartbeat_max_lost(integer) #Указывает максимальное число сообщений о контроле состояния, которые можно не получить до того, как узел будет считаться недоступным. Значение по умолчанию —
10.biha.heartbeat_send_period(integer) #Указывает частоту отправки сообщений о контроле состояния в миллисекундах. Значение по умолчанию —
1000.
26.3.2. Уровни протоколирования BiHA #
biha.BihaLog_log_level(enum) #Задаёт уровень протоколирования для предоставления общей информации о работе компонентов BiHA. Значение по умолчанию —
LOG.biha.BcpTransportDebug_log_level(enum) #Задаёт уровень протоколирования для предоставления отладочной информации о работе канала управления. Значение по умолчанию —
DEBUG4.biha.BcpTransportDetails_log_level(enum) #Задаёт уровень протоколирования для предоставления подробной информации о работе канала управления. Значение по умолчанию —
DEBUG4.biha.BcpTransportLog_log_level(enum) #Задаёт уровень протоколирования для предоставления общей информации о работе канала управления. Значение по умолчанию —
DEBUG4.biha.BcpTransportWarn_log_level(enum) #Задаёт уровень протоколирования для вывода предупреждений о возможных проблемах в канале управления. Значение по умолчанию —
DEBUG4.biha.NodeControllerDebug_log_level(enum) #Задаёт уровень протоколирования для предоставления отладочной информации о работе контроллера узла. Значение по умолчанию —
DEBUG4.biha.NodeControllerDetails_log_level(enum) #Задаёт уровень протоколирования для предоставления подробной информации о работе контроллера узла. Значение по умолчанию —
DEBUG4.biha.NodeControllerLog_log_level(enum) #Задаёт уровень протоколирования для предоставления общей информации о работе контроллера узла. Значение по умолчанию —
DEBUG4.biha.NodeControllerWarn_log_level(enum) #Задаёт уровень протоколирования для вывода предупреждений о возможных проблемах в контроллере узла. Значение по умолчанию —
DEBUG4.
26.3.3. Функции #
Все перечисленные ниже функции следует вызывать из базы данных biha_db:
biha.error_details () returns setof record#Возвращает описание причины, по которой узел перешёл в состояние
NODE_ERROR. Возвращаемая запись содержит тип ошибки, подробную информацию о ней, место возникновения с указаниемbegin_lsn,end_lsnи идентификаторов текущей и следующей линии времени, а такжеreplay_lsn.biha.nodes () returns setof record#Определяет представление
biha.nodes_v, подробно описанное в biha.nodes_v.biha.status () returns setof record#Определяет представление
biha.status_v, подробно описанное в biha.status_v. Если узел не отвечает при попытке показать представление, попробуйте выполнить тот же запрос на любом другом узле, чтобы узнать фактическое состояние узлов кластера.
26.3.4. Представления #
Чтобы обращаться к перечисленным ниже представлениям, необходимо подключиться к базе данных biha_db.
26.3.4.1. biha.nodes_v #
В этом представлении показывается состояние подключения узлов в кластере. Для узла, на котором выполняется запрос для представления, следующие столбцы содержат NULL: state, since_conn_start, conn_count.
Таблица 26.1. Представление biha.nodes_v
| Имя столбца | Описание |
|---|---|
id | Идентификатор узла. |
host | Адрес узла. |
port | Порт узла. |
state | Состояние подключения узла. В этом столбце может отображаться одно из следующих значений: ACTIVE, CONNECTING, IDLE или INIT. |
since_conn_start | Время, прошедшее с момента подключения узла к сети. |
conn_count | Сколько раз узел подключался к сети с момента запуска кластера. |
26.3.4.2. biha.status_v #
В этом представлении показывается состояние узлов в кластере.
Таблица 26.2. Представление biha.status_v
| Имя столбца | Описание |
|---|---|
id | Идентификатор узла (integer). |
leader_id | Идентификатор узла-лидера (integer). |
term | Поколение узла (integer). Используется при голосовании на выборах нового узла-лидера. |
online | Показывает, подключён ли узел к сети (boolean: t или f). |
state | Состояние узла (
|
last_known_state | Последнее известное состояние узла (text). |
since_last_hb | Время, прошедшее с момента получения последнего сообщения о контроле состояния (interval). |
26.3. Reference for the BiHA Extension #
The majority of BiHA specifics is done automatically, with few parameters available for manual editing.
26.3.1. Configuration Parameters #
Configuration parameters that can be useful:
biha.can_be_leader(boolean) #Determines the ability of a node to become the leader. The default value is
true. If set tofalse, the node cannot stand as a candidate in elections of the new leader.biha.can_vote(boolean) #Determines whether a node is allowed to vote. The default value is
true. If set tofalse, the node cannot vote, as well as cannot stand as a candidate in elections of the new leader.biha.flw_ro(boolean) #Determines whether a follower is available for read operations. If set to
off, reading from this follower is prohibited. The default value ison.biha.heartbeat_max_lost(integer) #Specifies the maximum number of heartbeats that can be missed before the node is considered offline. The default value is
10.biha.heartbeat_send_period(integer) #Specifies the heartbeat sending frequency, in milliseconds. The default value is
1000.
26.3.2. BiHA Logging Levels #
biha.BihaLog_log_level(enum) #Specifies the logging level to provide general information about the operation of BiHA components. The default value is
LOG.biha.BcpTransportDebug_log_level(enum) #Specifies the logging level to provide debugging information about the control channel operation. The default value is
DEBUG4.biha.BcpTransportDetails_log_level(enum) #Specifies the logging level to provide detailed information about the control channel operation. The default value is
DEBUG4.biha.BcpTransportLog_log_level(enum) #Specifies the logging level to provide general information about the control channel operation. The default value is
DEBUG4.biha.BcpTransportWarn_log_level(enum) #Specifies the logging level to provide warnings of likely problems in the control channel. The default value is
DEBUG4.biha.NodeControllerDebug_log_level(enum) #Specifies the logging level to provide debugging information about the node controller operation. The default value is
DEBUG4.biha.NodeControllerDetails_log_level(enum) #Specifies the logging level to provide detailed information about the node controller operation. The default value is
DEBUG4.biha.NodeControllerLog_log_level(enum) #Specifies the logging level to provide general information about the node controller operation. The default value is
DEBUG4.biha.NodeControllerWarn_log_level(enum) #Specifies the logging level to provide warnings of likely problems in the node controller. The default value is
DEBUG4.
26.3.3. Functions #
All functions listed below should be called from the biha_db database:
biha.error_details () returns setof record#Returns the description of why the node transferred to the
NODE_ERRORstate. The returned record contains the type of the error, its details, the place it occurred specifyingbegin_lsn,end_lsn, and identifier of the current and the next timeline, as well asreplay_lsn.biha.nodes () returns setof record#Defines the
biha.nodes_vview, which is described in detail in the biha.nodes_v section.biha.status () returns setof record#Defines the
biha.status_vview, which is described in detail in the biha.status_v section. If the node does not respond when trying to display the view, try the same request on any other node to learn the actual state of cluster nodes.
26.3.4. Views #
To query the views listed below, you must first connect to the biha_db database.
26.3.4.1. biha.nodes_v #
This view displays the connection status of nodes in the cluster. For the node that the view is queried on, the following columns contain NULL: state, since_conn_start, conn_count.
Table 26.1. The biha.nodes_v view
| Column Name | Description |
|---|---|
id | The node ID. |
host | The host of the node. |
port | The port of the node. |
state | The connection state of the node. This column may contain one of the following values: ACTIVE, CONNECTING, IDLE, or INIT. |
since_conn_start | The time since the node connection. |
conn_count | The number of times the node was connected since the start of the cluster. |
26.3.4.2. biha.status_v #
This view displays the state of nodes in the cluster.
Table 26.2. The biha.status_v View
| Column Name | Description |
|---|---|
id | The node ID (integer). |
leader_id | The leader node ID (integer). |
term | The term of the node (integer). This is used for the purposes of the leader election. |
online | Shows whether the node is online (boolean: t or f). |
state | The state of the node (
|
last_known_state | The last known state of the node (text). |
since_last_hb | The time since the last received heartbeat message (interval). |