- About PTK
- Quick Start
- Guidance
- Preparing Configuration File
- Checking the System
- Deploy Database Cluster
- Manage Clusters
- Show Cluster List
- Show Cluster Status
- Start Database
- Stop Database
- Restart Database
- Rebuild Database
- Switchover
- Failover
- Show Plugin Information
- Install Plugins
- Upgrade Database
- Scale-out Cluster
- Scale-in Cluster
- Show Database HBA
- Set Database HBA
- Show Database Parameters
- Set Database Parameters
- Show Cluster Topology Configuration
- Show Cluster Meta Information
- Update Cluster Comment
- Update Database IP
- Role Management
- Install CM
- Uninstall CM
- Manage Cluster VIP
- Install MogHA Service
- Uninstall MogHA Service
- Rename Cluster
- Create Empty Cluster
- Throw Out A Node
- Takeover A Node
- Manage Cluster
- Uninstall Database Cluster
- Collect OS Information
- Download MogDB Installer
- Encrypt Sensitive Information
- Upgrade PTK
- PTKC
- Compatible With Higher Versions of MogDB
- Reference
- Samples of Configuration Files
- Commands
- ptk
- ptk completion
- ptk view-static-config
- ptk init-cluster
- ptk collect
- ptk rec-guc
- ptk cache
- ptk gen-ptkc
- ptk manage
- ptk demo
- ptk meta
- ptk version
- ptk self
- ptk gen-om-xml
- ptk env
- ptk gen-static-config
- ptk cluster
- ptk cluster createdb
- ptk cluster uninstall-compat-tools
- ptk cluster install-compat-tools
- ptk cluster install-mogila
- ptk cluster rename
- ptk cluster throwout
- ptk cluster takeover
- ptk cluster uninstall-cm
- ptk cluster install-cm
- ptk cluster gen-cert-files
- ptk cluster load-cm-vip
- ptk cluster del-kerberos-auth
- ptk cluster add-kerberos-auth
- ptk cluster uninstall-kerberos-server
- ptk cluster install-kerberos-server
- ptk cluster is-in-upgrade
- ptk cluster upgrade-rollback
- ptk cluster upgrade-commit
- ptk cluster upgrade
- ptk cluster demote
- ptk cluster promote
- ptk cluster refresh
- ptk cluster shell
- ptk cluster modify-comment
- ptk cluster show-config
- ptk cluster set-guc
- ptk cluster show-guc
- ptk cluster set-hba
- ptk cluster show-hba
- ptk cluster scale-out
- ptk cluster scale-in
- ptk cluster uninstall-mogha
- ptk cluster install-mogha
- ptk cluster list-plugins
- ptk cluster install-plugin
- ptk cluster inspect
- ptk cluster failover
- ptk cluster switchover
- ptk cluster build
- ptk cluster status
- ptk cluster restart
- ptk cluster stop
- ptk cluster start
- ptk uninstall
- ptk ls
- ptk install
- ptk exec
- ptk template
- ptk encrypt
- ptk checkos
- ptk download
- ptk candidate
- Troubleshooting
- FAQ
- Release Notes
- Community
- Appendix: YAML Syntax
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).
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:
- Generate configuration file: This is the starting step of the installation to ensure that the subsequent steps have an accurate basis for configuration. 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.
- 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 thenode.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 tomogha
.--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.