# PolarDBX部署文档 **Repository Path**: mrssai/polardbx-deployment-document ## Basic Information - **Project Name**: PolarDBX部署文档 - **Description**: 阿里云PolarDB-X使用pdx部署分布式数据库 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-12-02 - **Last Updated**: 2024-12-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PolarDBX部署文档 ### 介绍 阿里云PolarDB-X使用pdx部署分布式数据库,所有机器(ops、部署机器)均需要联网 ### 安装教程 **必要条件** [] Centos8 [ ] Python3 [ ] ansible [ ] 机器可联网 #### 安装Centos8 安装过程中 install source填写:mirrors.huaweicloud.com/centos/8-stream/BaseOS/x86_64/os/ #### OPS机器上 ops机器上安装Python3 使用pip3 安装ansible ##### 配置服务器列表 ``` vi $HOME/all.ini ``` ``` [all] 192.168.3.101 # ops [cn] 192.168.3.190 192.168.3.192 192.168.3.193 [dn] 192.168.3.194 192.168.3.195 192.168.3.196 ``` 为简便使用,推荐把配置文件路径放入环境变量: ``` export ini_file=$HOME/all.ini ``` ##### 服务器免密 打通所有机器免密登录 ``` # 生成 ssh 密钥 ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<> /etc/ssh/ssh_config # 打通 ssh 免密, ini_file 指定上述服务器列表 ansible -i ${ini_file} all -m authorized_key -a " user=root key=\"{{ lookup('file', '/root/.ssh/id_rsa.pub') }} \" " -u root --become-method=sudo --ask-become-pass --become -k ``` ##### 更新yum源 ``` ansible -i ${ini_file} all -m shell -a " mv /etc/yum.repos.d /etc/yum.repos.d.bak " ansible -i ${ini_file} all -m copy -a " src=$HOME/yum.repos.d dest=/etc " ansible -i ${ini_file} all -m shell -a " yum clean all && yum makecache " ``` ##### 安装docker ``` ansible -i ${ini_file} all -m shell -a " yum remove docker \ docker-common \ docker-selinux \ docker-engine " ansible -i ${ini_file} all -m shell -a "yum install -y yum-utils device-mapper-persistent-data lvm2" ansible -i ${ini_file} all -m shell -a "yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo" ansible -i ${ini_file} all -m shell -a "yum install -y docker-ce" ``` ##### 允许docker远程登录 ``` ansible -i ${ini_file} all -m copy -a "src=$HOME/docker dest=/etc/default/docker" ansible -i ${ini_file} all -m shell -a "systemctl daemon-reload && systemctl restart docker" ``` ##### 关闭防火墙 ``` ansible -i ${ini_file} all -m shell -a " systemctl disable firewalld " ansible -i ${ini_file} all -m shell -a " systemctl stop firewalld " ``` ##### 创建数据目录 ``` ansible -i ${ini_file} all -m shell -a "mkdir -p \$HOME/.pxd/data " ``` ##### 启动 ``` pxd create -f polarx_pxd.yaml -repo="polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/" ``` ### 使用说明 启动成功后,会在终端输出数据库连接方式,请牢记。使用MySQL-Client等连接工具即可登录数据库。