HomeMogDBMogDB StackUqbar
v2.0

Documentation:v2.0

Supported Versions:

Other Versions:

Install MogHA Service

MogHA

MogHA is a highly available system based on MogDB database replication flow technology. Its core goal is to minimize the RTO time under the premise of strongly guaranteeing RPO, so as to provide continuous and stable operation guarantee for upper-tier applications. (Applicable to openGauss database and MogDB database).

=> Detailed Documentation

Install MogHA with PTK

PTK provides a convenient way for us to efficiently install MogHA services for clusters, the following is the specific operation procedure:

  1. Generate configuration file: This is the starting step of the installation to ensure that the subsequent steps have an accurate basis for configuration. 2.
  2. Edit the required fields in the configuration file: Make necessary additions and improvements to the generated configuration file to make it meet the actual requirements.
  3. Execute the Install MogHA command: the key part of the installation that actually begins.

Prerequisites

Be sure to prepare the arbitration node IP (or gateway if the cluster is on the same subnet) ahead of time, as this is the basis for the entire installation process to run smoothly.

Generate MogHA Configuration File

A configuration file can be created by executing the following command:

ptk template mogha -n <CLUSTER_NAME> [--prot 8081] > node.conf

In this command, port is an optional parameter that defaults to 8081 if left out.

The -o parameter is also provided, which allows us to specify a filename to output for better management and saving of configuration files.

Example of node.conf configuration:

# docs: https://docs.mogdb.io/en/mogha/latest/overview

[ config ]
db_port=23419
db_user=mog
db_datadir=/opt/mogdb/data
primary_info=/opt/mogdb/mogha/primary_info
standby_info=/opt/mogdb/mogha/standby_info
lite_mode=true
agent_port=8081
http_req_timeout=3
heartbeat_interval=3
primary_lost_timeout=10
primary_lonely_timeout=10
double_primary_timeout=10
meta_file_type=json
logger_format=%(asctime)s %(levelname)s [%(filename)s:%(lineno)d]: %(message)s
log_dir=/opt/mogdb/mogha
log_max_size=512MB
log_backup_count=10
allow_ips=
handle_down_primary=true
handle_down_standby=true
primary_down_handle_method=restart
restart_strategy=10/3
debug_mode=false


[ host1 ]
ip=<IP>
heartbeat_ips=
[ host2 ]
ip=<IP>
heartbeat_ips=
[ host3 ]
ip=<IP>
heartbeat_ips=

[ zone1 ]
vip=
hosts=host1,host2,host3
ping_list=<仲裁IP>
cascades=
arping=

You can modify the field information in the configuration file according to your needs.

Install MogHA

The deployment of MogHA can be automated by executing the following command:

ptk cluster -n <CLUSTER_NAME> install-mogha -c node.conf [-y] [-p <MOGHA_PACKAGE>] [-d <INSTALL_DIR>] [--service-name mogha] [--mogha-version 2.4.17]

In the command install-mogha:

  • -c needs to be followed by the node.conf you created.
  • -y is used to skip some interactive steps.
  • -p is to specify the MogHA installer.
  • -d is to specify the specific directory where MogHA will be installed.
  • --service-name is the name of the service for the corresponding systemctl operation when MogHA starts, defaulting to mogha.
  • --mogha-version Specifies the specific version of MogHA to be installed.

In addition, the command provides a number of other options, such as:

  • --skip-check: If you add this option, it means that you can skip the checking session of the configuration file and the target machine where it needs to be installed.
  • --skip-rollback: if you add this option, you can skip the rollback operation when the installation fails.
  • --skip-start: If you add this option, the MogHA service will not be started automatically after the installation is completed, so you can choose the start time flexibly according to the actual situation.
  • --sync-standby: This option allows users to customize the standby node to be used for the installation, which increases the flexibility of the installation.
Copyright © 2011-2024 www.enmotech.com All rights reserved.