- Overview
- Quick Start
- Install PTK
- Usage
- Configuration
- Config Samples
- Commands
- ptk
- ptk completion
- ptk register
- 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 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 Note
- GPTK - Graphical Deployment Tool
- Community
- Appendix: YAML Syntax
Quick Start
This document introduces two methods of quickly installing MogDB using PTK.
Note: PTK can run on multiple operating systems, such as Linux, macOS, and Windows. MogDB can be run on only Linux operating systems, and therefore make sure that a server on which MogDB is installed must run on a Linux operating system. For details about Linux OS types and versions, see [Operating Systems Supported by PTK for Installing MogDB](./overview.md#Operating Systems Supported by PTK for Installing MogDB).
PTK Download and Installation
Run the following command to install PTK.
curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh
Information similar to the following is displayed (the information varies depending on the type of Shell for running PTK).
info: downloading ptk package
Detected shell: bash
Shell profile: /root/.bash_profile
ptk has been added to PATH in /root/.bash_profile
open a new terminal or source /root/.bash_profile to active it
Installed path: /root/.ptk/bin/ptk
Run the source command or open a terminal to make PTK environment variables take effect.
If the output information is similar to the above, PTK has its path added to the PATH environment variable in the /root/.bash_profile
file.
Note: ~/.bash_profile varies depends on different operating systems. You can query the installation log to check which file needs to be activated.
For example, use bash as an example.
source $HOME/.bash_profile
Method 1 Single Server Without Being Configured for Database Test
This method supports only installation on Linux servers.
1. Run the demo Command
Before running this command, make sure that port 26000 is available. If you need to user other ports, use --port <PORT>
to specify the port.
If you use the default port, run the following command:
ptk demo
If the PTK command is run as the root
user, a random user prefixed with demo_user_
will be created on the local server as the database operation user. At the same time, the database instances and data will be stored in the /home
directory of this user.
If the PTK command is run as the common user, a sample database will be created in the /home
directory of the current user because the common user does not have the permission to create a new user.
After database is installed, PTK will install plugins supported by all databases for tests.
The following uses the common user demo
as an example to demonstrate installation:
2. Access MogDB
Take the demo
user as an example.
su - demo
gsql -r
Method 2 Database Installed Using a Configuration File
This method supports both local and remote installation.
Prepare a Configuration File
PTK installation requires a config.yaml configuration file provided by users. This configuration file can be generated by running ptk template. If local installation is required, run the following command:
ptk template --local > config.yaml
The configuration file content is as follows:
# config.yaml
global:
# cluster name (required)
cluster_name: "cluster_etalatint"
# system user for running db
user: "omm"
# system user group, same as username if not given
group: "omm"
# base directory for install MogDB server,
# if any of app_dir, data_dir, log_dir and tool_dir not config, PTK will create corresponding directory under base_dir
base_dir: "/opt/mogdb"
db_servers:
- host: "127.0.0.1" # Local IP address
# database port
db_port: 26000
If default settings are used in the configuration file, PTK will perform the following operations:
- MogDB is installed on the local server.
- The operating system user for running the database is omm, the user group name is omm, and the user does not have a default password.
- The database is installed in the /opt/mogdb directory where four directories app, data, log, and tool will be created for storing database software, data files, database logs, and database-related tools.
- The listening port of the database is 26000.
If MogDB needs to be installed on other servers or primary/standby MogDB is to be installed, more configuration information needs to be added to config.yaml. For details, see Usage.
Configuration example for one primary node and one standby node
# config.yaml
global:
cluster_name: mogdb_cluster1
user: omm
group: omm
base_dir: /opt/mogdb
db_servers:
- host: 192.168.0.1
db_port: 26000
role: primary
ssh_option:
port: 22
user: root
password: [Enter the SSH login password]
- host: 192.168.0.2
db_port: 26000
role: standby
ssh_option:
port: 22
user: root
password: [Enter the SSH login password]
Perform System Check on the Local Server
ptk checkos -f config.yaml
Make sure the check result includes OK
or Warning
.
If Abnormal
occurs, PTK will generates a shell script with the prefix of root_fix_os automatically by default. You can try to fix the abnormal check item by executing the shell script.
In most cases, it can be fixed. If it persists, you need to manually fix it based on the log.
Install MogDB
ptk install -f config.yaml
The MogDB of the latest version will be installed by default. You can check the version from the download page of the official website. During the installation, you will be prompted to enter the initial password of the database user, and make sure that you take a note of the password. After automatic installation of MogDB using PTK, the database instance will be started.
PTK supports customization of the installation package and manual downloading of the installation package. For example, run the following command to install MogDB using the installation package in the current directory:
ptk install -f config.yaml --pkg ./MogDB-3.0.0-openEuler-arm64.tar.gz
After successful installation, you can check the instance information by running the ptk ls
command.
Access MogDB
su - omm
gsql -r
Related Page
The above example provides the simplest configuration file, thereby facilitating quick experience of MogDB. For more configuration information, see Configuration.