PXD 部署 阿里云 PolarDB-X 集群(企业版、标准版)教程

简介: 本文详细演示了使用PXD在Ubuntu 24.04上部署PolarDB-X企业版和标准版集群的完整流程,涵盖环境准备、Docker与Python配置、PXD安装、集群创建、连接测试及销毁等步骤,并附多篇主流操作系统安装指南,助力快速搭建分布式数据库环境。

install polardb-x by pxd

好习惯,附上之前 9 篇


参考

1. env

这里拿 1 台机器来测试,多台机器同理

  • basic env
root@iZbp1b2hnsd51fdnun2vwzZ:~# cat /etc/issue
Ubuntu 24.04.3 LTS \n \l

root@iZbp1b2hnsd51fdnun2vwzZ:~# free -h
               total        used        free      shared  buff/cache   available
Mem:           7.5Gi       766Mi       4.4Gi       1.9Mi       2.6Gi       6.7Gi
Swap:          4.0Gi        67Mi       3.9Gi
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# lscpu |grep "^CPU(s):"
CPU(s):                               4
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# nproc
4
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# uname -a
Linux iZbp1b2hnsd51fdnun2vwzZ 6.8.0-88-generic #89-Ubuntu SMP PREEMPT_DYNAMIC Sat Oct 11 01:02:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# hostnamectl
 Static hostname: iZbp1b2hnsd51fdnun2vwzZ
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: 288205f3ac2746c996481c00e4b807a0
         Boot ID: bbaa83d0b0de4c8180d1a1d0d51cf923
  Virtualization: kvm
Operating System: Ubuntu 24.04.3 LTS
          Kernel: Linux 6.8.0-88-generic
    Architecture: x86-64
 Hardware Vendor: Alibaba Cloud
  Hardware Model: Alibaba Cloud ECS
Firmware Version: 2.0.0
   Firmware Date: Tue 2024-04-23
    Firmware Age: 1y 8month 4w 1d
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# hostname -i
172.16.0.2
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# hostname -f
iZbp1b2hnsd51fdnun2vwzZ
root@iZbp1b2hnsd51fdnun2vwzZ:~# cat  /etc/hosts
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

172.16.0.2 iZbp1b2hnsd51fdnun2vwzZ

root@iZbp1b2hnsd51fdnun2vwzZ:~#
  • install docker

集群模式下,docker engine 版本需要大于等于 18.04,小于等于 28.x

目前还不能安装 docker 最新 29.x 版本,因为 docker 从29.x 版本开始,docker api 版本升级为 1.52 不再支持 返回 IPAddress,刚好 pxd 0.7.1 版本及以下版本 需要这个字段

aly dz 大佬说 pxd 要再发个版本 适配 最新版 docker 了

root@iZbp1b2hnsd51fdnun2vwzZ:~# cat /etc/apt/sources.list.d/docker.list
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu   questing stable
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# cat install_docker_v28.sh
apt install docker-ce=5:28.5.2-1~ubuntu.25.10~questing docker-ce-cli=5:28.5.2-1~ubuntu.25.10~questing
root@iZbp1b2hnsd51fdnun2vwzZ:~#
root@iZbp1b2hnsd51fdnun2vwzZ:~# sh install_docker_v28.sh
root@iZbp1b2hnsd51fdnun2vwzZ:~# docker version
Client: Docker Engine - Community
 Version:           28.5.2
 API version:       1.51
 Go version:        go1.25.3
 Git commit:        ecc6942
 Built:             Wed Nov  5 14:43:19 2025
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          28.5.2
  API version:      1.51 (minimum version 1.24)
  Go version:       go1.25.3
  Git commit:       89c5e8f
  Built:            Wed Nov  5 14:43:19 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.2.1
  GitCommit:        dea7da592f5d1d2b7755e3a161be07f43fad8f75
 runc:
  Version:          1.3.4
  GitCommit:        v1.3.4-0-gd6d73eb8
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
root@iZbp1b2hnsd51fdnun2vwzZ:~#
  • install python3.7
root@iZbp1b2hnsd51fdnun2vwzZ:~# apt install -y vim wget gcc make zip zlib* libffi-dev
root@iZbp1b2hnsd51fdnun2vwzZ:~# wget https://repo.huaweicloud.com/python/3.7.3/Python-3.7.3.tgz
root@iZbp1b2hnsd51fdnun2vwzZ:~# mkdir /usr/local/python37
root@iZbp1b2hnsd51fdnun2vwzZ:~# tar -zxf Python-3.7.3.tgz
root@iZbp1b2hnsd51fdnun2vwzZ:~# cd Python-3.7.3/
root@iZbp1b2hnsd51fdnun2vwzZ:~# ./configure --prefix=/usr/local/python37 --enable-optimizations --with-openssl=/usr --with-system-ffi --enable-loadable-sqlite-extensions
root@iZbp1b2hnsd51fdnun2vwzZ:~# make -j4
root@iZbp1b2hnsd51fdnun2vwzZ:~# make install -j4
root@iZbp1b2hnsd51fdnun2vwzZ:~# /usr/local/python37/bin/python3.7 -V
root@iZbp1b2hnsd51fdnun2vwzZ:~# /usr/local/python37/bin/pip3.7 -V
qc@iZbp1b2hnsd51fdnun2vwzZ:~$ cat <<EOF>> ~/.bashrc

alias python37="/usr/local/python37/bin/python3.7"
alias pip37="/usr/local/python37/bin/pip3.7"
EOF
qc@iZbp1b2hnsd51fdnun2vwzZ:~$ source ~/.bashrc

qc@iZbp1b2hnsd51fdnun2vwzZ:~$ python37 -V
Python 3.7.3
qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pip37 -V
pip 19.0.3 from /usr/local/python37/lib/python3.7/site-packages/pip (python 3.7)
qc@iZbp1b2hnsd51fdnun2vwzZ:~$
  • config ssh remote

因为只有本地一台机器,所以免密自己

su - qc
ssh-keygen -t rsa
ssh-copy-id qc@172.16.0.2
  • before install pxd
qc@iZbp1b2hnsd51fdnun2vwzZ:~$ python37 -m venv venv
qc@iZbp1b2hnsd51fdnun2vwzZ:~$ source venv/bin/activate
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ python -V
Python 3.7.3
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pip -V
pip 19.0.3 from /usr/local/python37/lib/python3.7/site-packages/pip (python 3.7)
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ mkdir ~/.pip
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ cat ~/.pip/pip.conf
[global]
index-url=http://mirrors.cloud.aliyuncs.com/pypi/simple/

[install]
trusted-host=mirrors.cloud.aliyuncs.com

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pip install --upgrade pip
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pip -V
pip 24.0 from /home/qc/venv/lib/python3.7/site-packages/pip (python 3.7)
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$
  • install pxd
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pip install pxd
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pip list
Package            Version
------------------ ---------
asttokens          2.4.1
bcrypt             4.2.1
certifi            2021.5.30
cffi               1.15.1
charset-normalizer 2.0.4
click              8.0.1
colorama           0.4.4
cryptography       45.0.7
docker             5.0.0
humanfriendly      10.0
icontract          2.7.2
idna               3.2
importlib-metadata 6.7.0
packaging          24.0
paramiko           2.12.0
pip                24.0
pxd                0.7.1
pycparser          2.21
pycryptodomex      3.10.1
PyMySQL            1.0.2
PyNaCl             1.5.0
PyYAML             5.4.1
requests           2.26.0
retrying           1.3.3
setuptools         40.8.0
six                1.16.0
spur               0.3.20
spurplus           2.3.4
temppathlib        1.2.0
typing_extensions  4.7.1
urllib3            1.26.6
websocket-client   1.2.1
zipp               3.15.0

[notice] A new release of pip is available: 24.0 -> 25.3
[notice] To update, run: pip install --upgrade pip
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pxd version
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
pxd version: 0.7.1
commit id: 93fbbe8
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$

2. setup polardb-x 企业版 cluster by pxd

  • 配置文件
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ cat pxd-com.yaml
version: v1
type: polardbx
cluster:
  name: pxc_test_aly
  gms:
    image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-engine:v2.4.2_8.4.19
    host_group: [172.16.0.2]
  cn:
    image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-sql:v2.4.2_5.4.19
    replica: 1
    nodes:
      - host: 172.16.0.2
    resources:
      mem_limit: 1G
  dn:
    image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-engine:v2.4.2_8.4.19
    replica: 1
    nodes:
      - host_group: [172.16.0.2]
    resources:
      mem_limit: 1G
  cdc:
    image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-cdc:v2.4.2_5.4.19
    replica: 1
    nodes:
      - host: 172.16.0.2
    resources:
      mem_limit: 1G
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • 编写启动脚本
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ cat create-com.sh

pxd create -f ./pxd-com.yaml  -repo="polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/"

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • 启动 企业版集群
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ sh create-com.sh
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
yaml file: ./pxd-com.yaml.bak-aly
Processing  [------------------------------------]    0%    pre check
Processing  [##----------------------------------]    7%    generate topology
Processing  [#####-------------------------------]   14%    check docker engine version
Processing  [#######-----------------------------]   21%    pull images
Pull image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-engine:v2.4.2_8.4.19 at 172.16.0.2

... 此处省略一大部分内容

e3172cab5c41:Extracting [============================>                      ]  69.63MB/122.9MB
e3172cab5c41:Extracting [==========================================>        ]  105.3MB/122.9MB
e3172cab5c41:Extracting [==================================================>]  122.9MB/122.9MB
e3172cab5c41:Pull complete
095a75859683:Extracting [==================================================>]     236B/236B
095a75859683:Extracting [==================================================>]     236B/236B
095a75859683:Pull complete
Digest: sha256:a137cec08150c7f6920abdcaa739b923cfdac0d7f274d96ef99d3e4cafcba7cd
Status: Downloaded newer image for polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-cdc:v2.4.2_5.4.19
Processing  [##########--------------------------]   28%    create gms node
Processing  [############------------------------]   35%    create gms db and tables
Processing  [###############---------------------]   42%    create PolarDB-X root account
Processing  [##################------------------]   50%    create dn
Processing  [####################----------------]   57%    register dn to gms
Processing  [#######################-------------]   64%    create cn
Processing  [#########################-----------]   71%    wait cn ready
Processing  [############################--------]   78%    create cdc containers
Processing  [##############################------]   85%    create columnar containers
Processing  [#################################---]   92%    wait PolarDB-X ready
Processing  [####################################]  100%


PolarDB-X cluster create successfully, you can try it out now.
Connect PolarDB-X using the following command:

    mysql -h172.16.0.2 -P60731 -upolardbx_root -pNRJAaNga
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • 连接测试
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ mysql -h172.16.0.2 -P60731 -upolardbx_root -pNRJAaNga
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 73
Server version: 8.0.3 Tddl Server (ALIBABA)

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select version();
+---------------------------+
| VERSION()                 |
+---------------------------+
| 8.0.3-PXC-5.4.19-20250825 |
+---------------------------+
1 row in set (0.00 sec)

mysql> select * from information_schema.schemata;
+--------------+--------------------+----------------------------+------------------------+----------+--------------------+
| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | DEFAULT_ENCRYPTION |
+--------------+--------------------+----------------------------+------------------------+----------+--------------------+
| def          | information_schema | utf8mb4                    | utf8mb4_general_ci     | NULL     | NO                 |
+--------------+--------------------+----------------------------+------------------------+----------+--------------------+
1 row in set (0.03 sec)

mysql> show master status ;
+---------------+----------+--------------+------------------+-------------------+
| FILE          | POSITION | BINLOG_DO_DB | BINLOG_IGNORE_DB | EXECUTED_GTID_SET |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000001 |     5098 |              |                  |                   |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.58 sec)

mysql> show storage ;
+-------------------+------------------+------------+-----------+----------+-------------+--------+-----------+-------+--------+
| STORAGE_INST_ID   | LEADER_NODE      | IS_HEALTHY | INST_KIND | DB_COUNT | GROUP_COUNT | STATUS | DELETABLE | DELAY | ACTIVE |
+-------------------+------------------+------------+-----------+----------+-------------+--------+-----------+-------+--------+
| pxc_test_aly-dn-0 | 172.16.0.2:14818 | true       | MASTER    | 1        | 2           | 0      | false     | null  | null   |
| pxc_test_aly-gms  | 172.16.0.2:17029 | true       | META_DB   | 2        | 2           | 0      | false     | null  | null   |
+-------------------+------------------+------------+-----------+----------+-------------+--------+-----------+-------+--------+
2 rows in set (0.00 sec)

mysql> show mpp ;
+--------------+------------------+------+--------+
| ID           | NODE             | ROLE | LEADER |
+--------------+------------------+------+--------+
| pxc_test_aly | 172.16.0.2:60731 | W    | Y      |
+--------------+------------------+------+--------+
1 row in set (0.00 sec)

mysql>
mysql> create database polarx_example partition_mode='partitioning';
Query OK, 1 row affected (0.39 sec)

mysql> use polarx_example;
Database changed
mysql> create table example (
    ->   `id` bigint(11) auto_increment NOT NULL,
    ->   `name` varchar(255) DEFAULT NULL,
    ->   `score` bigint(11) DEFAULT NULL,
    ->   primary key (`id`)
    -> ) engine=InnoDB default charset=utf8
    -> partition by hash(id)
    -> partitions 8;
Query OK, 0 rows affected (1.13 sec)

mysql> insert into example values(null,'lily',375),(null,'lisa',400),(null,'ljh',500);
Query OK, 3 rows affected (0.05 sec)

mysql> select * from example;
+----+------+-------+
| id | name | score |
+----+------+-------+
|  1 | lily |   375 |
|  2 | lisa |   400 |
|  3 | ljh  |   500 |
+----+------+-------+
3 rows in set (0.03 sec)

mysql> show topology from example;
+------+-----------------------------+--------------------+----------------+-------------------+-----------------------+-------------------+-------------------+
| ID   | GROUP_NAME                  | TABLE_NAME         | PARTITION_NAME | SUBPARTITION_NAME | PHY_DB_NAME           | DN_ID             | STORAGE_POOL_NAME |
+------+-----------------------------+--------------------+----------------+-------------------+-----------------------+-------------------+-------------------+
|    0 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00000 | p1             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    1 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00001 | p2             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    2 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00002 | p3             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    3 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00003 | p4             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    4 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00004 | p5             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    5 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00005 | p6             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    6 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00006 | p7             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
|    7 | POLARX_EXAMPLE_P00000_GROUP | example_NGE9_00007 | p8             |                   | polarx_example_p00000 | pxc_test_aly-dn-0 | _default          |
+------+-----------------------------+--------------------+----------------+-------------------+-----------------------+-------------------+-------------------+
8 rows in set (0.00 sec)

mysql>
  • check cluster
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ pxd list
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
NAME                          CN        DN        CDC       STATUS
pxc_test_aly                  1         1         1         running
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • delete cluster

必须授权,否则 待会 delete 会报错

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ sudo chown -R qc: /home/qc/
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pxd delete pxc_test_aly
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$ pxd list
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
NAME                          CN        DN        CDC       STATUS
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~$

3. setup polardb-x 标准版 cluster by pxd

  • 编写配置文件和启动脚本
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ cat create-std.sh

pxd create -f ./pxd-std.yaml  -repo="polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/"

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ cat pxd-std.yaml
version: v1
type: polardbx
cluster:
  name: pxc_test_standard
  dn:
    image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-engine:v2.4.2_8.4.19
    replica: 1
    nodes:
      - host_group: [172.16.0.2]
    resources:
      mem_limit: 2G
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • 启动 标准版 polardb-x
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ sh create-std.sh
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
yaml file: ./pxd-std.yaml
Processing  [------------------------------------]    0%    pre check
Processing  [##----------------------------------]    7%    generate topology
Processing  [#####-------------------------------]   14%    check docker engine version
Processing  [#######-----------------------------]   21%    pull images
Pull image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-engine:v2.4.2_8.4.19 at 172.16.0.2


v2.4.2_8.4.19:Pulling from polardbx/polardbx-engine
Digest: sha256:ec0c8df5a017e7074929e31e185dad7d5aa31c5b2073fe38473ee29ec690c04a
Status: Image is up to date for polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/polardbx-engine:v2.4.2_8.4.19
Pull image: polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/xstore-tools:latest at 172.16.0.2


latest:Pulling from polardbx/xstore-tools
Digest: sha256:e7d6b7697a0de92db2a032064130c6ff605e576ce4b5830990f145da07745ea2
Status: Image is up to date for polardbx-opensource-registry.cn-beijing.cr.aliyuncs.com/polardbx/xstore-tools:latest
Processing  [##################------------------]   50%    create dn
Processing  [#################################---]   92%    wait PolarDB-X ready
Processing  [####################################]  100%


PolarDB-X cluster create successfully, you can try it out now.
Connect PolarDB-X using the following command:

    mysql -h172.16.0.2 -P15197 -uadmin -pbBREONPu
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • 连接测试
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ mysql -h172.16.0.2 -P15197 -uadmin -pbBREONPu
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 8.0.32-X-Cluster-8.4.19-20250825 Source distribution

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> select version();
+----------------------------------+
| version()                        |
+----------------------------------+
| 8.0.32-X-Cluster-8.4.19-20250825 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select host,user from mysql.user;
+-----------+------------------+
| host      | user             |
+-----------+------------------+
| %         | admin            |
| localhost | mysql.infoschema |
| localhost | mysql.session    |
| localhost | mysql.sys        |
| localhost | root             |
+-----------+------------------+
5 rows in set (0.00 sec)

mysql> select * from information_schema.schemata;
+--------------+--------------------+----------------------------+------------------------+----------+--------------------+
| CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | DEFAULT_ENCRYPTION |
+--------------+--------------------+----------------------------+------------------------+----------+--------------------+
| def          | mysql              | utf8mb3                    | utf8mb3_general_ci     |     NULL | NO                 |
| def          | information_schema | utf8mb3                    | utf8mb3_general_ci     |     NULL | NO                 |
| def          | performance_schema | utf8mb4                    | utf8mb4_0900_ai_ci     |     NULL | NO                 |
| def          | __recycle_bin__    | utf8mb4                    | utf8mb4_0900_ai_ci     |     NULL | NO                 |
| def          | sys                | utf8mb4                    | utf8mb4_0900_ai_ci     |     NULL | NO                 |
+--------------+--------------------+----------------------------+------------------------+----------+--------------------+
5 rows in set (0.01 sec)

mysql> show master status ;
+------------------+----------+--------------+------------------+------------------------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                        |
+------------------+----------+--------------+------------------+------------------------------------------+
| mysql_bin.000001 |     1032 |              |                  | 56e21f50-f66d-11f0-8dfb-00163e20cb2a:1-2 |
+------------------+----------+--------------+------------------+------------------------------------------+
1 row in set (0.00 sec)

mysql>
  • 检查集群
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ pxd list
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
NAME                          CN        DN        CDC       STATUS
pxc_test_standard             0         1         0         running
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
  • 删除集群

必须授权,否则待会 delete 会报错权限不足

(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ sudo chown -R qc: /home/qc/
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ pxd delete pxc_test_standard
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
Prepare to delete PolarDB-X cluster: pxc_test_standard
stop and remove container: pxc_test_standard-dn-0-Cand-15197, id: 8bb20f6c2e at 172.16.0.2
container: 8bb20f6c2e is not existing at 172.16.0.2.
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$ pxd list
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:33: CryptographyDeprecationWarning: Python 3.7 is no longer supported by the Python core team and support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.7.
  from cryptography.hazmat.backends import default_backend
/home/qc/venv/lib/python3.7/site-packages/paramiko/pkey.py:82: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "cipher": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/paramiko/transport.py:253: CryptographyDeprecationWarning: TripleDES has been moved to cryptography.hazmat.decrepit.ciphers.algorithms.TripleDES and will be removed from cryptography.hazmat.primitives.ciphers.algorithms in 48.0.0.
  "class": algorithms.TripleDES,
/home/qc/venv/lib/python3.7/site-packages/deployer
NAME                          CN        DN        CDC       STATUS
(venv) qc@iZbp1b2hnsd51fdnun2vwzZ:~/pxd$

在此感谢阿里云数据库迪哲大佬支持,20260120晚上帮忙排查问题(docker 最新版本 29.x 开始,api 版本升级至 1.52 不再支持 返回 容器的 IPAddress)

lQLPKd3CViy62_vNAfbNCCSwqnxOLMF1O8QJSIIulOMKAA_2084_502.png

Docker API 1.52 版本不再返回 NetworkSettings.IPAddress 字段,导致报错: https://docs.docker.com/reference/api/engine/version-history/#v152-api-changes


我们下期见,拜拜!

相关文章
|
28天前
|
Java Linux 数据库连接
PolarDB-X 集中式三节点高可用集群部署 & Java 场景 CRUD 应用
本文介绍在CentOS 7.9、openEuler 20.03及银河麒麟V10上部署PolarDB-X三节点高可用集群的完整过程,涵盖环境准备、配置文件设置、集群初始化与启动,并通过Java应用实现CRUD操作验证。集群支持自动主备切换,确保服务高可用,适用于生产环境数据库架构搭建与学习参考。
327 0
|
1月前
|
Linux 数据库
Linux 环境 国产银河麒麟V10操作系统安装 Polardb-X 数据库 单机版 rpm 包 教程
本文介绍在国产银河麒麟V10操作系统上安装Polardb-X单机版数据库的完整过程。基于RPM包方式部署,步骤与CentOS 7.9类似,涵盖系统环境确认、依赖安装、用户配置、初始化数据目录及启动服务等关键环节,并通过命令验证运行状态,助力国产化平台数据库搭建。
435 0
|
1月前
|
Linux 数据库
Linux 环境 Polardb-X 数据库 单机版 rpm 包 安装教程
本文介绍在CentOS 7.9环境下安装PolarDB-X单机版数据库的完整流程,涵盖系统环境准备、本地Yum源配置、RPM包安装、用户与目录初始化、依赖库解决、数据库启动及客户端连接等步骤,助您快速部署运行PolarDB-X。
575 1
Linux 环境 Polardb-X 数据库 单机版 rpm 包 安装教程
|
SQL Kubernetes 关系型数据库
如何一键安装部署PolarDB-X
《PolarDB-X 动手实践》系列第一期,体验如何一键安装部署PolarDB-X。
|
26天前
|
Kubernetes 容器 数据库
K8S 部署 阿里云 PolarDB-X 集群(企业版、标准版)minikube 教程
本文介绍在 Minikube Kubernetes 环境中部署 PolarDB-X 数据库的完整实践,涵盖环境准备、Operator 安装、企业版与标准版集群部署。通过 Helm 快速部署 Operator,并分别搭建分布式与三节点高可用架构,验证核心功能。虽 K8S 部署便捷,但生产环境建议谨慎使用,尤其对有状态数据库系统。附系列前8篇安装指南供参考。
883 2
|
28天前
|
Ubuntu Java Linux
ARM Linux 环境 国产 华为 欧拉 openEuler 20.03 操作系统安装 Polardb-X 数据库 单机版 rpm 包 教程
本文介绍在ARM64架构的openEuler 20.03系统上,通过RPM包安装部署PolarDB-X单节点数据库的完整过程,涵盖环境准备、RPM安装、用户配置、数据库初始化及启动连接等步骤,助力用户在国产化软硬件平台上快速搭建PolarDB-X运行环境。
301 1
|
4月前
|
SQL 关系型数据库 MySQL
开源新发布|PolarDB-X v2.4.2开源生态适配升级
PolarDB-X v2.4.2开源发布,重点完善生态能力:新增客户端驱动、开源polardbx-proxy组件,支持读写分离与高可用;强化DDL变更、扩缩容等运维能力,并兼容MySQL主备复制及MCP AI生态。
开源新发布|PolarDB-X v2.4.2开源生态适配升级
|
1月前
|
Linux 数据库
Linux 环境 国产 华为 欧拉 openEuler 20.03 操作系统安装 Polardb-X 数据库 单机版 rpm 包 教程
本文为华为欧拉openEuler 20.03操作系统下Polardb-X单机版RPM包安装教程,继CentOS 7.9与银河麒麟V10后,延续相似步骤,详述环境准备、依赖安装、配置初始化及服务启动全过程,助力国产化平台数据库部署。作者张阳,资深从业者,欢迎交流。
272 5
|
27天前
|
Ubuntu Linux 数据库
Linux 环境 Docker 安装 Polardb-X 数据库 容器 教程
本文介绍如何通过 Docker 快速部署 Polardb-X 数据库容器,实现一键启动。涵盖镜像拉取、容器运行、登录验证等步骤,操作简便,适用于快速开发与测试环境。附往期7篇主流系统安装教程。
238 5
|
1月前
|
Ubuntu 关系型数据库 MySQL
基于Ubuntu 24编译部署开源PolarDB-X
作者介绍: 韦玮 浙江宇视科技有限公司分布式存储开发工程师 浙江宇视科技有限公司是全球AIoT产品、解决方案与全栈式能力提供商,以“ABCI”(AI人工智能、BigData大数据、Cloud云计算、IoT物联网)技术为核心。

热门文章

最新文章