暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

ptk安装mogdb

由迪 2023-12-21
179

原作者:.

  • PTK 简介
  • 硬件要求
  • PTK安装mogdb
    • 获取PTK
    • 配置文件
    • 本机检查系统
    • 安装MogDB
    • python3 安装

mogdb:https://docs.mogdb.io/zh/mogdb/v3.0/
ptk:https://docs.mogdb.io/zh/ptk/v0.4/overview

PTK 简介

PTK (Provisioning Toolkit)是一款针对 MogDB 数据库开发的软件安装和运维工具,旨在帮助用户更便捷地安装部署MogDB数据库。

如果用户想要运行 MogDB 或者 MogDB 的相关组件时,仅需要执行一行命令即可实现。

硬件要求

image.png

PTK安装mogdb

获取PTK

下载并安装 PTK,执行以下命令在线安装:

[root@mogdbptk opt]# curl --proto '=https' --tlsv1.2 -sSf https://cdn-mogdb.enmotech.com/ptk/install.sh | sh
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
[root@mogdbptk bin]# source $HOME/.bash_profile
[root@mogdbptk bin]# ptk --version
PTK Version: v0.4.7
Go Version: go1.17.1
Build Date: 2022-10-24T07:35:12Z
Git Hash: f3222aa
复制

配置文件

[root@mogdbptk bin]# ptk template --local > config.yaml

[root@mogdbptk bin]# cat config.yaml
global:
  # # cluster name (required)
  cluster_name: "cluster_coplaying"
  # # 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"
    # # database port
    db_port: 26000

## 根据需求更改目录、ip等信息
[root@mogdbptk bin]# vim config.yaml 
复制

本机检查系统

[root@mogdbptk bin]# ptk checkos -f config.yaml
INFO[2022-11-03T15:06:24.296] prechecking dependent tools...               
INFO[2022-11-03T15:06:24.316] platform: centos_7_64bit                      host=192.168.80.15
INFO[2022-11-03T15:06:24.319] kernel version: 3.10.0-957.el7.x86_64         host=192.168.80.15
INFO[2022-11-03T15:06:24.334] locale: LANG=en_US.UTF-8                      host=192.168.80.15
INFO[2022-11-03T15:06:24.342] timezone: +0800                               host=192.168.80.15
INFO[2022-11-03T15:06:24.348] swap memory 3145724kB, total memory 3861516kB  host=192.168.80.15
WARN[2022-11-03T15:06:24.370] net.core.somaxconn=128, expect 65535          host=192.168.80.15
WARN[2022-11-03T15:06:24.382] net.core.rmem_max=212992, expect 21299200     host=192.168.80.15
WARN[2022-11-03T15:06:24.399] net.ipv4.tcp_wmem=4096	16384	4194304, expect 8192 250000 16777216  host=192.168.80.15
WARN[2022-11-03T15:06:24.410] kernel.sem=250	32000	32	128, expect 250 6400000 1000 25600  host=192.168.80.15
WARN[2022-11-03T15:06:24.416] net.ipv4.tcp_retries1=3, expect 5             host=192.168.80.15
WARN[2022-11-03T15:06:24.421] net.ipv4.tcp_retries2=15, expect 12           host=192.168.80.15
WARN[2022-11-03T15:06:24.429] net.ipv4.tcp_syn_retries=6, expect 5          host=192.168.80.15
WARN[2022-11-03T15:06:24.448] vm.min_free_kbytes=67584, expect 193075       host=192.168.80.15
WARN[2022-11-03T15:06:24.463] net.ipv4.tcp_tw_reuse=0, expect 1             host=192.168.80.15
WARN[2022-11-03T15:06:24.475] net.ipv4.tcp_keepalive_intvl=75, expect 30    host=192.168.80.15
WARN[2022-11-03T15:06:24.486] net.ipv4.tcp_keepalive_time=7200, expect 30   host=192.168.80.15
WARN[2022-11-03T15:06:24.491] net.ipv4.tcp_rmem=4096	87380	6291456, expect 8192 250000 16777216  host=192.168.80.15
WARN[2022-11-03T15:06:24.496] net.ipv4.tcp_max_syn_backlog=128, expect 65535  host=192.168.80.15
WARN[2022-11-03T15:06:24.513] net.core.netdev_max_backlog=1000, expect 65535  host=192.168.80.15
WARN[2022-11-03T15:06:24.520] net.core.rmem_default=212992, expect 21299200  host=192.168.80.15
WARN[2022-11-03T15:06:24.527] net.ipv4.tcp_tw_recycle=0, expect 1           host=192.168.80.15
WARN[2022-11-03T15:06:24.537] net.core.wmem_default=212992, expect 21299200  host=192.168.80.15
WARN[2022-11-03T15:06:24.553] net.core.wmem_max=212992, expect 21299200     host=192.168.80.15
INFO[2022-11-03T15:06:24.568] check kernel.core_pattern                     host=192.168.80.15
INFO[2022-11-03T15:06:24.581] check removeIPC value                         host=192.168.80.15
WARN[2022-11-03T15:06:24.705] device(/dev/sda) readahead value=8192, expect 16384.  host=192.168.80.15
WARN[2022-11-03T15:06:24.752] device(dm-0) 'IO Request'=128, expect 256     host=192.168.80.15
WARN[2022-11-03T15:06:24.752] device(dm-1) 'IO Request'=128, expect 256     host=192.168.80.15
WARN[2022-11-03T15:06:24.752] device(sda) 'IO Request'=128, expect 256      host=192.168.80.15
WARN[2022-11-03T15:06:24.752] device(sr0) 'IO Request'=128, expect 256      host=192.168.80.15
ERRO[2022-11-03T15:06:24.848] firewall status='enabled', expect 'disabled'.  host=192.168.80.15
ERRO[2022-11-03T15:06:24.855] transparent_hugepage status is 'always', expect 'never'  host=192.168.80.15
[host 192.168.80.15]: not found package: numactl
INFO[2022-11-03T15:06:32.787] check port 26000                              host=192.168.80.15
INFO[2022-11-03T15:06:32.954] port 26000 is free                            host=192.168.80.15
INFO[2022-11-03T15:06:32.955] write fix os script to root_fix_os.2022.1103.150624.sh successfully 
INFO[2022-11-03T15:06:32.955] all checkers finished                        
# 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    | OK        
  A6.Check_SysCtl_Parameter         | Abnormal  
  A7.Check_FileSystem_Configure     | OK        
  A8.Check_Disk_Configure           | OK        
  A9.Check_BlockDev_Configure       | Warning   
  A9.Check_Logical_Block            | OK        
  A10.Check_IO_Request              | Warning   
  A10.Check_Asynchronous_IO_Request | OK        
  A10.Check_IO_Configure            | OK        
  A11.Check_Network_Configure       | OK        
  A12.Check_Time_Consistency        | OK        
  A13.Check_Firewall_Service        | Abnormal  
  A14.Check_THP_Service             | Abnormal  
  A15.Check_Dependent_Package       | Abnormal  
  A16.Check_CPU_Instruction_Set     | OK        
  A17.Check_Port                    | OK        
Total count 20, abnormal count 4, warning count 2

Failed to check os, can’t perform installation unless fix all the abnormal items
You can use 'ptk checkos -i ITEM --detail' to see detail message
Please check root_fix_os.[TIMESTAMP].sh for commands to resolve.
复制

确保输出的检查结果均为 OK 或者 Warning 。

如果有 Abnormal 的检查项出现,PTK默认会自动生成一个 root_fix_os 前缀的 Shell 脚本,您可以通过执行该 Shell 脚本来尝试自动修复异常的检查项。

大部分情况下都是可以自动修复的,如果出现特殊情况,PTK 没有兼容到,需您根据日志提示手动修正。

## PTK 会自动生成一个修复脚本,尽可能的帮助用户自动化修复
[root@mogdbptk bin]# ls -al 
总用量 13476
drwxr-xr-x. 2 root root        92 11月  3 15:06 .
drwxr-xr-x. 4 root root        49 11月  3 14:58 ..
-rw-r--r--. 1 root root       467 11月  3 15:03 config.yaml
-rwxr-xr-x. 1  501 games 13787136 10月 24 15:35 ptk
-rw-r--r--. 1  501 games      294 9月   1 15:56 README.md
-rwxr--r--. 1 root root       745 11月  3 15:06 root_fix_os.2022.1103.150624.sh

[root@mogdbptk bin]# bash root_fix_os.2022.1103.150624.sh 
kernel.core_pattern = /var/log/coredump/%e.%p.%u.%t.core
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
never
已加载插件:fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.ustc.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
base                                                                                     | 3.6 kB  00:00:00     
extras                                                                                   | 2.9 kB  00:00:00     
updates                                                                                  | 2.9 kB  00:00:00     
(1/4): extras/7/x86_64/primary_db                                                        | 249 kB  00:00:00     
(2/4): base/7/x86_64/group_gz                                                            | 153 kB  00:00:00     
(3/4): updates/7/x86_64/primary_db                                                       |  17 MB  00:00:03     
(4/4): base/7/x86_64/primary_db                                                          | 6.1 MB  00:00:10     
正在解决依赖关系
--> 正在检查事务
---> 软件包 numactl.x86_64.0.2.0.12-5.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================================================
 Package                   架构                     版本                           源                      大小
================================================================================================================
正在安装:
 numactl                   x86_64                   2.0.12-5.el7                   base                    66 k

事务概要
================================================================================================================
安装  1 软件包

总下载量:66 k
安装大小:141 k
Downloading packages:
警告:/var/cache/yum/x86_64/7/base/packages/numactl-2.0.12-5.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
numactl-2.0.12-5.el7.x86_64.rpm 的公钥尚未安装
numactl-2.0.12-5.el7.x86_64.rpm                                                          |  66 kB  00:00:00     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 软件包     : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : numactl-2.0.12-5.el7.x86_64                                                                 1/1 
  验证中      : numactl-2.0.12-5.el7.x86_64                                                                 1/1 

已安装:
  numactl.x86_64 0:2.0.12-5.el7                                                                                 

完毕!

##再次检查
[root@mogdbptk bin]# ptk checkos -f config.yaml
INFO[2022-11-03T15:10:56.761] prechecking dependent tools...               
INFO[2022-11-03T15:10:56.790] platform: centos_7_64bit                      host=192.168.80.15
INFO[2022-11-03T15:10:56.796] kernel version: 3.10.0-957.el7.x86_64         host=192.168.80.15
INFO[2022-11-03T15:10:56.823] locale: LANG=en_US.UTF-8                      host=192.168.80.15
INFO[2022-11-03T15:10:56.831] timezone: +0800                               host=192.168.80.15
INFO[2022-11-03T15:10:56.839] swap memory 3145724kB, total memory 3861516kB  host=192.168.80.15
WARN[2022-11-03T15:10:56.849] net.ipv4.tcp_tw_recycle=0, expect 1           host=192.168.80.15
WARN[2022-11-03T15:10:56.858] net.ipv4.tcp_wmem=4096	16384	4194304, expect 8192 250000 16777216  host=192.168.80.15
WARN[2022-11-03T15:10:56.863] net.ipv4.tcp_rmem=4096	87380	6291456, expect 8192 250000 16777216  host=192.168.80.15
WARN[2022-11-03T15:10:56.871] net.core.wmem_default=212992, expect 21299200  host=192.168.80.15
WARN[2022-11-03T15:10:56.887] net.ipv4.tcp_keepalive_intvl=75, expect 30    host=192.168.80.15
WARN[2022-11-03T15:10:56.892] net.ipv4.tcp_retries1=3, expect 5             host=192.168.80.15
WARN[2022-11-03T15:10:56.896] net.ipv4.tcp_retries2=15, expect 12           host=192.168.80.15
WARN[2022-11-03T15:10:56.913] net.ipv4.tcp_syn_retries=6, expect 5          host=192.168.80.15
WARN[2022-11-03T15:10:56.916] net.core.rmem_max=212992, expect 21299200     host=192.168.80.15
WARN[2022-11-03T15:10:56.920] net.ipv4.tcp_tw_reuse=0, expect 1             host=192.168.80.15
WARN[2022-11-03T15:10:56.924] net.core.netdev_max_backlog=1000, expect 65535  host=192.168.80.15
WARN[2022-11-03T15:10:56.934] net.ipv4.tcp_keepalive_time=7200, expect 30   host=192.168.80.15
WARN[2022-11-03T15:10:56.938] net.core.rmem_default=212992, expect 21299200  host=192.168.80.15
WARN[2022-11-03T15:10:56.941] net.ipv4.tcp_max_syn_backlog=128, expect 65535  host=192.168.80.15
WARN[2022-11-03T15:10:56.951] net.core.somaxconn=128, expect 65535          host=192.168.80.15
WARN[2022-11-03T15:10:56.954] net.core.wmem_max=212992, expect 21299200     host=192.168.80.15
WARN[2022-11-03T15:10:56.966] vm.min_free_kbytes=67584, expect 193075       host=192.168.80.15
WARN[2022-11-03T15:10:56.969] kernel.sem=250	32000	32	128, expect 250 6400000 1000 25600  host=192.168.80.15
INFO[2022-11-03T15:10:56.975] check kernel.core_pattern                     host=192.168.80.15
INFO[2022-11-03T15:10:56.993] check removeIPC value                         host=192.168.80.15
WARN[2022-11-03T15:10:57.115] device(/dev/sda) readahead value=8192, expect 16384.  host=192.168.80.15
WARN[2022-11-03T15:10:57.151] device(dm-0) 'IO Request'=128, expect 256     host=192.168.80.15
WARN[2022-11-03T15:10:57.152] device(dm-1) 'IO Request'=128, expect 256     host=192.168.80.15
WARN[2022-11-03T15:10:57.152] device(sda) 'IO Request'=128, expect 256      host=192.168.80.15
WARN[2022-11-03T15:10:57.152] device(sr0) 'IO Request'=128, expect 256      host=192.168.80.15
INFO[2022-11-03T15:11:07.091] check port 26000                              host=192.168.80.15
INFO[2022-11-03T15:11:07.274] port 26000 is free                            host=192.168.80.15
INFO[2022-11-03T15:11:07.274] all checkers finished                        
# 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    | OK       
  A6.Check_SysCtl_Parameter         | Warning  
  A7.Check_FileSystem_Configure     | OK       
  A8.Check_Disk_Configure           | OK       
  A9.Check_BlockDev_Configure       | Warning  
  A9.Check_Logical_Block            | OK       
  A10.Check_IO_Request              | Warning  
  A10.Check_Asynchronous_IO_Request | OK       
  A10.Check_IO_Configure            | OK       
  A11.Check_Network_Configure       | OK       
  A12.Check_Time_Consistency        | OK       
  A13.Check_Firewall_Service        | OK       
  A14.Check_THP_Service             | OK       
  A15.Check_Dependent_Package       | Warning  
  A16.Check_CPU_Instruction_Set     | OK       
  A17.Check_Port                    | OK       
Total count 20, abnormal count 0, warning count 4

## 同时可以检查确实哪些依赖包,进行安装
ptk checkos -i A...
复制

安装MogDB

[root@mogdbptk bin]# ptk install -f config.yaml -y
复制

image.png

python3 安装

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
mkdir -p /usr/local/python3
tar -zxvf Python-3.6.5.tgz
cd Python-3.6.5
./configure --prefix=/usr/local/python3 --enable-shared CFLAGS=-fPIC && make && make install
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
[root@mogdbptk Python-3.6.5]# python3 -V
python3: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
[root@mogdbptk lib]# cp  libpython3.6m.so.1.0 /usr/lib64
[root@mogdbptk lib]# python3 -V
Python 3.6.5
复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论