MOGDB单节点安装体验
1、下载ptk软件
PTK (Provisioning Toolkit)软件是mogdb的安装运维工具,大大简便了安装过程。
工具下载地址: https://www.mogdb.io/downloads/ptk/all 选择合适的版本下载
复制
2、安装ptk软件
上传下载好的软件,解压并配置环境变量即可。
[root@db01:/soft]# ll ptk_1.6.3_linux_x86_64.tar.gz -rw-r--r-- 1 root root 21117570 Aug 27 11:10 ptk_1.6.3_linux_x86_64.tar.gz [root@db01:/soft]# mkdir -p $HOME/.ptk/bin [root@db01:/soft]# tar -xvf ptk_1.6.3_linux_x86_64.tar.gz -C $HOME/.ptk/bin CHANGELOG/.gitkeep README.md ptk [root@db01:/soft]# echo "export PATH=$HOME/.ptk/bin:$PATH" >> $HOME/.bashrc [root@db01:/soft]# source $HOME/.bashrc [root@db01:/soft]# ptk --help ptk is a command-line management tool that can help you to deploy or manage MogDB clusters. Usage: ptk [flags] <command> [args...] Available Commands: env Print ptk loaded environment values gen-om-xml Generate an XML file for gs_om self Self operations about ptk version Print version of ptk meta Manage ptk metadata demo Install MogDB demo quickly manage Manage an exist cluster gen-ptkc Generate ptkc binary cache List the cache files rec-guc Display the list of optimising guc parameters collect Collect system and cluster information for analysis init-cluster Generate a new empty cluster completion Generate the autocompletion script for the specified shell Pre Install Commands: candidate Print software version list which PTK supported download Download MogDB package online checkos Check cluster servers os dependencies encrypt Provides a convenient way to encrypt your text/password template Generate template of configuration exec Execute shell command or script Install Commands: install Install a MogDB or Uqbar database cluster Post Install Commands: ls List MogDB clusters uninstall Uninstall a database cluster cluster Manage clusters gen-static-config Generate and distribute a new cluster_static_config with specified YAML config Experimental Commands: Flags: --disable-color Force disabling colors --disable-debug-log Do not write debug log file --disable-progressbar Disable show progress bar globally -h, --help Print help information --log-file string Specify a log output file --log-format string Specify the log message format. Options: [text, json] (default "text") --log-level string Specify the log level. Options: [debug, info, warning, error, panic] (default "info") --silence Do not print logs to stdout --skip-fix-ssh Skip fix ssh connection by interaction -v, --version Print version of ptk Use "ptk [command] --help" for more information about a command.
复制
3、生成config.yaml文件
[root@db01:/soft]# ptk template --local > config.yaml [root@db01:/soft]# cat config.yaml global: # cluster name (required) cluster_name: newton # system user for running database user: omm # system user group group: omm # base directory for installing database server base_dir: /opt/mogdb db_servers: - host: 127.0.0.1 # database port db_port: 26000 可以根据实际需要进行修改,修改名称,用户和属组,目录,端口号等 global: # cluster name (required) cluster_name: mogdb_cluster # system user for running database user: omm # system user group group: omm # base directory for installing database server base_dir: /opt/mogdb db_servers: - host: 127.0.0.1 # database port db_port: 26000 检查 [root@db01:/soft]# ptk checkos -f config.yaml INFO[2024-08-27T11:18:58.134] prechecking dependent tools... ERRO[2024-08-27T11:18:58.239] [192.168.155.160][omm] not found tool: bzip2 ERRO[2024-08-27T11:18:58.239] please install the above missing packages first before do other operations INFO[2024-08-27T11:18:58.239] write fix os script to root_fix_os.0827.111858.sh success INFO[2024-08-27T11:18:58.239] time elapsed: 0s [PTK-4010] system does not satisfy checkos requirement 根据提示解决检查出来的问题,我这边显示没有bzip2工具,安装后重新做安装前检查 [root@db01:/soft]# yum install bzip2 [root@db01:/soft]# ptk checkos -f config.yaml # Check Results Item | Level ------------------------------------+----------- A1.Check_OS_Version | OK A2.Check_Kernel_Version | OK A3.Check_Unicode | OK A4.Check_TimeZone | OK A5.Check_Swap_Memory_Configure | Warning A6.Check_SysCtl_Parameter | Abnormal A7.Check_FileSystem_Configure | OK A8.Check_Disk_Configure | OK A9.Check_Logical_Block | OK A9.Check_BlockDev_Configure | Warning A10.Check_IO_Configure | OK A10.Check_NR_Request | Warning A10.Check_Asynchronous_IO_Request | OK A11.Check_Network_Configure | OK A12.Check_Time_Consistency | OK A13.Check_Firewall_Status | OK A14.Check_THP_Status | OK A15.Check_Dependent_Package | Warning A16.Check_CPU_Instruction_Set | OK A17.Check_Port | OK A18.Check_Selinux | OK A19.Check_User_Ulimit | OK A20.Check_Directory | OK Total count 23, abnormal count 1, warning count 4 Failed to check os, can’t perform installation unless fix all the abnormal items. You can use 'ptk checkos -i ITEM --detail' to get detail message Please check root_fix_os.0827.112023.sh for commands to resolve. 提示有abnormal的检查项目,根据提示运行root_fix_os.0827.112023.sh脚本来解决 [root@db01:/soft]# sh root_fix_os.0827.112023.sh 确保检查结果没有Abnormal或ExecuteError [root@db01:/soft]# ptk checkos -f config.yaml # Check Results Item | Level ------------------------------------+---------- A1.Check_OS_Version | OK A2.Check_Kernel_Version | OK A3.Check_Unicode | OK A4.Check_TimeZone | OK A5.Check_Swap_Memory_Configure | Warning A6.Check_SysCtl_Parameter | Warning A7.Check_FileSystem_Configure | OK A8.Check_Disk_Configure | OK A9.Check_Logical_Block | OK A9.Check_BlockDev_Configure | Warning A10.Check_IO_Configure | OK A10.Check_NR_Request | Warning A10.Check_Asynchronous_IO_Request | OK A11.Check_Network_Configure | OK A12.Check_Time_Consistency | OK A13.Check_Firewall_Status | OK A14.Check_THP_Status | OK A15.Check_Dependent_Package | Warning A16.Check_CPU_Instruction_Set | OK A17.Check_Port | OK A18.Check_Selinux | OK A19.Check_User_Ulimit | OK A20.Check_Directory | OK Total count 23, abnormal count 0, warning count 5
复制
4、安装
介质下载地址:https://www.mogdb.io/downloads/mogdb
[root@db01:/soft]#yum install python3 [root@db01:/soft]# ptk install -f config.yaml --pkg ./MogDB-5.0.8-CentOS-x86_64-all.tar.gz 中途提示输入密码:mogdb123! cluste_name | host | user | port | status | message --------------+-----------------+------+-------+---------------+---------- mogdb_cluster | 192.168.155.160 | omm | 26000 | start_success | success [root@db01:/soft]# su - omm [omm@db01 ~]$ gsql -r gsql ((MogDB 5.0.8 build 41aa0432) compiled at 2024-07-26 12:43:48 commit 0 last mr 1804 ) Non-SSL connection (SSL connection is recommended when requiring high-security) Type "help" for help. MogDB=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges | Compatibility -----------+-------+----------+---------+-------+-------------------+--------------- postgres | omm | UTF8 | C | C | | A template0 | omm | UTF8 | C | C | =c/omm +| A | | | | | omm=CTc/omm | template1 | omm | UTF8 | C | C | =c/omm +| A | | | | | omm=CTc/omm | (3 rows)
复制
5、卸载
[omm@db01 ~]$ gs_ctl stop [root@db01:/soft]# ptk uninstall -n mogdb_cluster INFO[2024-08-27T11:37:39.468] PTK Version: 1.6.3 release Cluster Name: "mogdb_cluster" +--------------+-----------------+-------------+-------+---------+-----------------+----------+ | az(priority) | ip | user(group) | port | role | data dir | upstream | +--------------+-----------------+-------------+-------+---------+-----------------+----------+ | AZ1(1) | 192.168.155.160 | omm(omm) | 26000 | primary | /opt/mogdb/data | - | +--------------+-----------------+-------------+-------+---------+-----------------+----------+ ✔ Do you really want to uninstall this cluster? Please confirm carefully (default=n) [y/n]: y ✔ Do you want to delete db data (default=n) [y/n]: y ✔ Do you want to delete os user (default=n) [y/n]: y INFO[2024-08-27T11:37:45.271] [192.168.155.160][omm] check db dirs owner INFO[2024-08-27T11:37:45.377] [192.168.155.160][omm] check db process status INFO[2024-08-27T11:37:45.396] [192.168.155.160][omm] remove files: /opt/mogdb/app,/opt/mogdb/tool,/opt/mogdb/tmp,/opt/mogdb/data,/opt/mogdb/log INFO[2024-08-27T11:37:45.568] [192.168.155.160][omm] kill user "omm" processes if exist: [krb5kdc] INFO[2024-08-27T11:37:45.605] [192.168.155.160][omm] remove user "omm" from cron.allow INFO[2024-08-27T11:37:45.608] [192.168.155.160][omm] remove user "omm" ulimits INFO[2024-08-27T11:37:45.612] [192.168.155.160][omm] remove dir "/opt/mogdb" if empty WARN[2024-08-27T11:37:45.622] [192.168.155.160][omm] unable to delete, because %!s(MISSING)/opt/mogdbdir "/opt/mogdb" contains other files: -rw------- 1 omm omm 0 Aug 27 11:30 pg_ctl.lock INFO[2024-08-27T11:37:45.622] [192.168.155.160][omm] kill user "omm" all processes INFO[2024-08-27T11:37:45.656] [192.168.155.160][omm] delete user "omm" INFO[2024-08-27T11:37:46.053] uninstall successfully
复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。