实验练习:使用PXD体验polardb-X开源版

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云原生数据库 PolarDB 分布式版,标准版 2核8GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
简介: 详细的实验步骤,每一步都有输出

1 安装python3,创建并激活虚拟环境,升级PIP

  yum install python3

   [root@my_ob ~]# python3 -m venv venv

   [root@my_ob ~]# source venv/bin/activate

      (venv) [root@my_ob ~]#

     (venv) [root@my_ob ~]# pip install --upgrade pip

      Collecting pip

        Downloading https://files.pythonhosted.org/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7MB)

          100% |████████████████████████████████| 1.7MB 59kB/s

      Installing collected packages: pip

        Found existing installation: pip 9.0.3

          Uninstalling pip-9.0.3:

            Successfully uninstalled pip-9.0.3

      Successfully installed pip-21.3.1

      You are using pip version 21.3.1, however version 22.1.1 is available.

      You should consider upgrading via the 'pip install --upgrade pip' command.

2 安装PXD

(venv) [root@my_ob ~]# pip install pxd

      Collecting pxd

        Downloading pxd-0.3.0-py3-none-any.whl (56 kB)

           |████████████████████████████████| 56 kB 237 kB/s

      Collecting PyYAML==5.4.1

        Downloading PyYAML-5.4.1-cp36-cp36m-manylinux1_x86_64.whl (640 kB)

           |████████████████████████████████| 640 kB 33 kB/s

      Collecting humanfriendly==10.0

        Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)

           |████████████████████████████████| 86 kB 50 kB/s

      Collecting requests==2.26.0

        Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB)

           |████████████████████████████████| 62 kB 24 kB/s

      Collecting idna==3.2

        Downloading idna-3.2-py3-none-any.whl (59 kB)

           |████████████████████████████████| 59 kB 32 kB/s

      Collecting urllib3==1.26.6

        Downloading urllib3-1.26.6-py2.py3-none-any.whl (138 kB)

           |████████████████████████████████| 138 kB 38 kB/s

      Collecting retrying==1.3.3

        Downloading retrying-1.3.3.tar.gz (10 kB)

        Preparing metadata (setup.py) ... done

      Collecting certifi==2021.5.30

        Downloading certifi-2021.5.30-py2.py3-none-any.whl (145 kB)

           |████████████████████████████████| 145 kB 23 kB/s

      Collecting six==1.16.0

        Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)

      Collecting click==8.0.1

        Downloading click-8.0.1-py3-none-any.whl (97 kB)

           |████████████████████████████████| 97 kB 41 kB/s

      Collecting PyMySQL==1.0.2

        Downloading PyMySQL-1.0.2-py3-none-any.whl (43 kB)

           |████████████████████████████████| 43 kB 48 kB/s

      Collecting websocket-client==1.2.1

        Downloading websocket_client-1.2.1-py2.py3-none-any.whl (52 kB)

           |████████████████████████████████| 52 kB 56 kB/s

      Collecting spurplus==2.3.4

        Downloading spurplus-2.3.4.tar.gz (20 kB)

        Preparing metadata (setup.py) ... done

      Collecting docker==5.0.0

        Downloading docker-5.0.0-py2.py3-none-any.whl (146 kB)

           |████████████████████████████████| 146 kB 31 kB/s

      Collecting colorama==0.4.4

        Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)

      Collecting charset-normalizer==2.0.4

        Downloading charset_normalizer-2.0.4-py3-none-any.whl (36 kB)

      Collecting pycryptodomex==3.10.1

        Downloading pycryptodomex-3.10.1-cp35-abi3-manylinux2010_x86_64.whl (1.9 MB)

           |████████████████████████████████| 1.9 MB 50 kB/s

      Collecting importlib-metadata

        Downloading importlib_metadata-4.8.3-py3-none-any.whl (17 kB)

      Collecting spur==0.3.20

        Downloading spur-0.3.20-py2.py3-none-any.whl (18 kB)

      Collecting typing_extensions>=3.6.2.1

        Downloading typing_extensions-4.1.1-py3-none-any.whl (26 kB)

      Collecting icontract<3,>=2.0.1

        Downloading icontract-2.6.1.tar.gz (36 kB)

        Preparing metadata (setup.py) ... done

      Collecting temppathlib<2,>=1.0.3

        Downloading temppathlib-1.2.0.tar.gz (6.3 kB)

        Preparing metadata (setup.py) ... done

      Collecting paramiko<3,>=1.13.1

        Downloading paramiko-2.11.0-py2.py3-none-any.whl (212 kB)

           |████████████████████████████████| 212 kB 39 kB/s

      Collecting asttokens<3,>=2

        Downloading asttokens-2.0.5-py2.py3-none-any.whl (20 kB)

      Collecting zipp>=0.5

        Downloading zipp-3.6.0-py3-none-any.whl (5.3 kB)

      Collecting pynacl>=1.0.1

        Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)

           |████████████████████████████████| 1.1 MB 54 kB/s

      Collecting bcrypt>=3.1.3

        Downloading bcrypt-3.2.2-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (61 kB)

           |████████████████████████████████| 61 kB 95 kB/s

      Collecting cryptography>=2.5

        Downloading cryptography-37.0.2-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.1 MB)

           |████████████████████████████████| 4.1 MB 81 kB/s

      Collecting cffi>=1.1

        Downloading cffi-1.15.0-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (405 kB)

           |████████████████████████████████| 405 kB 60 kB/s

      Collecting pycparser

        Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)

           |████████████████████████████████| 118 kB 77 kB/s

      Using legacy 'setup.py install' for retrying, since package 'wheel' is not installed.

      Using legacy 'setup.py install' for spurplus, since package 'wheel' is not installed.

      Using legacy 'setup.py install' for icontract, since package 'wheel' is not installed.

      Using legacy 'setup.py install' for temppathlib, since package 'wheel' is not installed.

      Installing collected packages: pycparser, cffi, six, pynacl, cryptography, bcrypt, zipp, urllib3, typing-extensions, paramiko, idna, charset-normalizer, certifi, asttokens, websocket-client, temppathlib, spur, requests, importlib-metadata, icontract, spurplus, retrying, PyYAML, PyMySQL, pycryptodomex, humanfriendly, docker, colorama, click, pxd

          Running setup.py install for temppathlib ... done

          Running setup.py install for icontract ... done

          Running setup.py install for spurplus ... done

          Running setup.py install for retrying ... done

      Successfully installed PyMySQL-1.0.2 PyYAML-5.4.1 asttokens-2.0.5 bcrypt-3.2.2 certifi-2021.5.30 cffi-1.15.0 charset-normalizer-2.0.4 click-8.0.1 colorama-0.4.4 cryptography-37.0.2 docker-5.0.0 humanfriendly-10.0 icontract-2.6.1 idna-3.2 importlib-metadata-4.8.3 paramiko-2.11.0 pxd-0.3.0 pycparser-2.21 pycryptodomex-3.10.1 pynacl-1.5.0 requests-2.26.0 retrying-1.3.3 six-1.16.0 spur-0.3.20 spurplus-2.3.4 temppathlib-1.2.0 typing-extensions-4.1.1 urllib3-1.26.6 websocket-client-1.2.1 zipp-3.6.0

3 启动docker,创建集群

(venv) [root@my_ob ~]# systemctl start docker

(venv) [root@my_ob ~]#pxd tryout

       Status: Downloaded newer image for docker.io/polardbx/xstore-tools:latest

       Processing  [#########---------------------------]   25%    create gms node

       Processing  [############------------------------]   33%    create gms db and tables

       Processing  [###############---------------------]   41%    create PolarDB-X root account

       Processing  [##################------------------]   50%    create dn

       Processing  [#####################---------------]   58%    register dn to gms

       Processing  [########################------------]   66%    create cn

       Processing  [###########################---------]   75%    wait cn ready

       Processing  [##############################------]   83%    create cdc containers

       Processing  [#################################---]   91%    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 -h127.0.0.1 -P4657 -upolardbx_root -prrGOnPmp

创建集群的步骤是先下载镜像,然后创建节点,最后输出连接方式及密码,密码只在这里显示一次,需要记住。

4 连接集群,检查各个节点的情况

 (venv) [root@my_ob ~]# obclient -h 127.0.0.1 -P4657 -upolardbx_root -prrGOnPmp

        Welcome to the OceanBase.  Commands end with ; or \g.

        Your MySQL connection id is 10

        Server version: 5.6.29 Tddl Server (ALIBABA)

       

        Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

       

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

1) 检查GMS

MySQL [(none)]> select * from information_schema.schemata;

      +--------------+--------------------+----------------------------+------------------------+----------+--------------------+

      | CATALOG_NAME | SCHEMA_NAME        | DEFAULT_CHARACTER_SET_NAME | DEFAULT_COLLATION_NAME | SQL_PATH | DEFAULT_ENCRYPTION |

      +--------------+--------------------+----------------------------+------------------------+----------+--------------------+

      | def          | information_schema | utf8                       | UTF8_GENERAL_CI        | NULL     | NO                 |

      | def          | __cdc__            | utf8                       | UTF8_GENERAL_CI        | NULL     | NO                 |

      +--------------+--------------------+----------------------------+------------------------+----------+--------------------+

      2 rows in set (0.136 sec)

2)创建数据库

MySQL [(none)]> create database polarx_example partition_mode='partitioning';

      Query OK, 1 row affected (0.800 sec)

     

MySQL [(none)]> use polarx_example;

      Database changed

3) 创建表,insert数据

MySQL [polarx_example]> 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 (5.720 sec)

MySQL [polarx_example]> insert into example values(null,'lily',375),(null,'lisa',400),(null,'ljh',500);

      Query OK, 3 rows affected (0.139 sec)

4) 查看数据及拓扑

MySQL [polarx_example]> select * from example;

      +--------+------+-------+

      | id     | name | score |

      +--------+------+-------+

      | 100001 | lily |   375 |

      | 100002 | lisa |   400 |

      | 100003 | ljh  |   500 |

      +--------+------+-------+

      3 rows in set (0.078 sec)

MySQL [polarx_example]> show topology from example;

+----+-----------------------------+--------------------+----------------+

| ID | GROUP_NAME                  | TABLE_NAME         | PARTITION_NAME |

+----+-----------------------------+--------------------+----------------+

|  0 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00000 | p1             |

|  1 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00001 | p2             |

|  2 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00002 | p3             |

|  3 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00003 | p4             |

|  4 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00004 | p5             |

|  5 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00005 | p6             |

|  6 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00006 | p7             |

|  7 | POLARX_EXAMPLE_P00000_GROUP | example_jVt5_00007 | p8             |

+----+-----------------------------+--------------------+----------------+

8 rows in set (0.009 sec)

5)检查CDC

MySQL [polarx_example]> show master status ;

   +---------------+----------+--------------+------------------+-------------------+

   | FILE          | POSITION | BINLOG_DO_DB | BINLOG_IGNORE_DB | EXECUTED_GTID_SET |

   +---------------+----------+--------------+------------------+-------------------+

   | binlog.000001 |     7658 |              |                  |                   |

   +---------------+----------+--------------+------------------+-------------------+

   1 row in set (0.913 sec)

MySQL [polarx_example]> show binlog events in 'binlog.000001' from 4;

+---------------+------+-------------+------------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

       | LOG_NAME      | POS  | EVENT_TYPE  | SERVER_ID  | END_LOG_POS | INFO                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

       +---------------+------+-------------+------------+-------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

       | binlog.000001 |    4 | Format_desc | 1275453311 |         123 | Server ver: 5.6.29-PXC-5.4.13-16534775, Binlog ver: 4                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

       | binlog.000001 |  123 | Rows_query  | 1275453311 |         206 | CTS::693756915409433401614686343691690352640000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 |  206 | Rows_query  | 1275453311 |         289 | CTS::693756915512613280014686343702847201280000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

       | binlog.000001 | 2032 | Rows_query  | 1275453311 |        2115 | CTS::693756966040554707214686348756647976960000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2115 | Rows_query  | 1275453311 |        2198 | CTS::693756966100113824014686348763149148160000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2198 | Rows_query  | 1275453311 |        2281 | CTS::693756978300505299214686349982643036170000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2281 | Rows_query  | 1275453311 |        2364 | CTS::693756978385649670414686349989437808640000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2364 | Rows_query  | 1275453311 |        2447 | CTS::693756978450661382414686349998581391360000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2447 | Rows_query  | 1275453311 |        2530 | CTS::693756978513995372814686350004830904330000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2530 | Rows_query  | 1275453311 |        2613 | CTS::693756978601236896014686350011374018560000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2613 | Rows_query  | 1275453311 |        2696 | CTS::693756978669184620814686350020265943040000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 2696 | Query       | 1275453311 |        2989 | # POLARX_ORIGIN_SQL=CREATE DATABASE polarx_example MODE 'partitioning'

       # POLARX_TSO=693756986400545184014686350788788264960000000000000000

       CREATE DATABASE polarx_example CHARACTER SET utf8mb4                                                                                                                                                                                                                                                                                                                                                                                          |

       | binlog.000001 | 2989 | Rows_query  | 1275453311 |        3072 | CTS::693756986400545184014686350788788264960000000000000000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 3072 | Rows_query  | 1275453311 |        3155 | CTS::693756990871673248014686351240850350090000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 3155 | Rows_query  | 1275453311 |        3238 | CTS::693756990955139897614686351248777584640000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 3238 | Rows_query  | 1275453311 |        3321 | CTS::693756991072580409614686351259053629440000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 3321 | Rows_query  | 1275453311 |        3404 | CTS::693756991146819590414686351266351718400000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

       | binlog.000001 | 3902 | Query       | 1275453311 |        4572 | # POLARX_ORIGIN_SQL=CREATE TABLE example ( `id` bigint(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) DEFAULT NULL, `score` bigint(11) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8 PARTITION BY HASH (id) PARTITIONS 8

       # POLARX_TSO=693757008319977888014686352979305472000000000000000000

       create table example ( `id` bigint(11) not null auto_increment, `name` varchar(255) default null, `score` bigint(11) default null, primary key (`id`) ) engine = innodb default charset = utf8 default character set = utf8 default collate = utf8_general_ci |

       | binlog.000001 | 4572 | Rows_query  | 1275453311 |        4655 | CTS::693757008319977888014686352979305472000000000000000000                                                                                                                                                                                                                                                                                                                                                                                                                                                  

       | binlog.000001 | 5050 | Rows_query  | 1275453311 |        5116 | /*DRDS /172.17.0.1/1461a428ddc01000/1// */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

       | binlog.000001 | 5116 | Table_map   | 1275453311 |        5180 | table_id: 1 (polarx_example.example)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

       | binlog.000001 | 5180 | Write_rows  | 1275453311 |        5238 | table_id: 1 flags: STMT_END_F                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

       | binlog.000001 | 5238 | Xid         | 1275453311 |        5269 | COMMIT /* xid=1 */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

       | binlog.000001 | 5269 | Rows_query  | 1275453311 |        5352 | CTS::693757023314195257614686354485438095360000000001469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 5352 | Query       | 1275453311 |        5415 | BEGIN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

       | binlog.000001 | 5415 | Rows_query  | 1275453311 |        5481 | /*DRDS /172.17.0.1/1461a428ddc01000/1// */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

       | binlog.000001 | 5481 | Table_map   | 1275453311 |        5545 | table_id: 1 (polarx_example.example)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

       | binlog.000001 | 5545 | Write_rows  | 1275453311 |        5603 | table_id: 1 flags: STMT_END_F                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

       | binlog.000001 | 5603 | Xid         | 1275453311 |        5634 | COMMIT /* xid=2 */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

       | binlog.000001 | 5634 | Rows_query  | 1275453311 |        5717 | CTS::693757023363688044814686354488374108170000000001469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 5717 | Query       | 1275453311 |        5780 | BEGIN                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

       | binlog.000001 | 5780 | Rows_query  | 1275453311 |        5846 | /*DRDS /172.17.0.1/1461a428ddc01000/1// */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

       | binlog.000001 | 5846 | Table_map   | 1275453311 |        5910 | table_id: 1 (polarx_example.example)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

       | binlog.000001 | 5910 | Write_rows  | 1275453311 |        5967 | table_id: 1 flags: STMT_END_F                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

       | binlog.000001 | 5967 | Xid         | 1275453311 |        5998 | COMMIT /* xid=3 */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

       | binlog.000001 | 5998 | Rows_query  | 1275453311 |        6081 | CTS::693757023363688044814686354488374108170000000002469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

       | binlog.000001 | 6081 | Rows_query  | 1275453311 |        6164 | CTS::693757028633411590414686355015304519680000000000469718                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

   

87 rows in set (0.412 sec)

6) 检查DN

MySQL [polarx_example]> show storage ;

     +-----------------+------------------+------------+-----------+----------+-------------+--------+-----------+-------+--------+

     | STORAGE_INST_ID | LEADER_NODE      | IS_HEALTHY | INST_KIND | DB_COUNT | GROUP_COUNT | STATUS | DELETABLE | DELAY | ACTIVE |

     +-----------------+------------------+------------+-----------+----------+-------------+--------+-----------+-------+--------+

     | pxc-tryout-dn-0 | 172.17.0.3:14508 | true       | MASTER    | 2        | 3           | 0      | false     | null  | null   |

     | pxc-tryout-gms  | 172.17.0.2:17077 | true       | META_DB   | 2        | 2           | 0      | false     | null  | null   |

     +-----------------+------------------+------------+-----------+----------+-------------+--------+-----------+-------+--------+

     2 rows in set (0.014 sec)

7)检查CN

     MySQL [polarx_example]> show mpp ;

     +------------+-----------------+------+--------+

     | ID         | NODE            | ROLE | LEADER |

     +------------+-----------------+------+--------+

     | pxc-tryout | 172.17.0.4:4659 | W    | Y      |

     +------------+-----------------+------+--------+

     1 row in set (0.008 sec)

8)查看语句的执行计划

MySQL [polarx_example]> explain select * from example;

     +----------------------------------------------------------------------------------------------------------------------------------------+

     | LOGICAL EXECUTIONPLAN                                                                                                                  |

     +----------------------------------------------------------------------------------------------------------------------------------------+

     | Gather(concurrent=true)                                                                                                                |

     |   LogicalView(tables="example[p1,p2,p3,p4,p5,p6,p7,p8]", shardCount=8, sql="SELECT `id`, `name`, `score` FROM `example` AS `example`") |

     | HitCache:true                                                                                                                          |

     | Source:PLAN_CACHE                                                                                                                      |

     | TemplateId: bdbc4fb8                                                                                                                   |

     +----------------------------------------------------------------------------------------------------------------------------------------+

     5 rows in set (0.049 sec)

5 检查下载的映像

(venv) [root@my_ob ~]# docker images

     REPOSITORY                         TAG                 IMAGE ID            CREATED             SIZE

     docker.io/polardbx/galaxysql       latest              78c86515c06f        4 days ago          948 MB

     docker.io/polardbx/galaxycdc       latest              943a6731feb0        12 days ago         905 MB

     docker.io/polardbx/galaxyengine    latest              2b35a63ba00a        5 weeks ago         2.11 GB

     docker.io/polardbx/xstore-tools    latest              b5e066e144eb        7 weeks ago         2.69 MB

     docker.io/polardbx/polardbx-init   latest              af4828b6797e        7 weeks ago         6.58 MB

6 检查运行的容器    

(venv) [root@my_ob ~]# docker ps

     CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS              PORTS                      NAMES

     2fa39a46f4b6        polardbx/galaxycdc:latest      "/bin/sh -c /home/..."   14 minutes ago      Up 14 minutes                                  pxc-tryout-cdc-LJhR

     b4b29949a075        polardbx/galaxysql:latest      "/home/admin/entry..."   14 minutes ago      Up 14 minutes       0.0.0.0:4657->4657/tcp     pxc-tryout-cn-bLzM

     1bd0be8eb646        polardbx/galaxyengine:latest   "bash -c '/tools/x..."   15 minutes ago      Up 15 minutes       0.0.0.0:14508->14508/tcp   pxc-tryout-dn-0-Cand-14508

     e930288c581c        polardbx/galaxyengine:latest   "bash -c '/tools/x..."   17 minutes ago      Up 17 minutes       0.0.0.0:17077->17077/tcp   pxc-tryout-gms-Cand-17077

从名字来看,dn、cn、cdc、gms每个节点都是一个容器。

相关实践学习
快速体验PolarDB开源数据库
本实验环境已内置PostgreSQL数据库以及PolarDB开源数据库:PolarDB PostgreSQL版和PolarDB分布式版,支持一键拉起使用,方便各位开发者学习使用。
相关文章
|
6天前
|
存储 容灾 关系型数据库
PolarDB开源数据库进阶课11 激活容灾(Standby)节点
本文介绍了如何激活PolarDB容灾(Standby)节点,实验环境依赖于Docker容器中用loop设备模拟共享存储。通过`pg_ctl promote`命令可以将Standby节点提升为主节点,使其能够接收读写请求。激活后,原Standby节点不能再成为PolarDB集群的Standby节点。建议删除对应的复制槽位以避免WAL文件堆积。相关操作和配置请参考系列文章及视频教程。
18 1
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课5 在线备份
本文介绍了如何在PolarDB RAC一写多读集群中进行在线备份,特别针对共享存储模式。通过使用`polar_basebackup`工具,可以将实例的本地数据和共享数据备份到本地盘中。实验环境依赖于Docker容器中用loop设备模拟的共享存储。
19 1
|
6天前
|
存储 NoSQL 关系型数据库
PolarDB开源数据库进阶课17 集成数据湖功能
本文介绍了如何在PolarDB数据库中接入pg_duckdb、pg_mooncake插件以支持数据湖功能, 可以读写对象存储的远程数据, 支持csv, parquet等格式, 支持delta等框架, 并显著提升OLAP性能。
19 0
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课15 集成DeepSeek等大模型
本文介绍了如何在PolarDB数据库中接入私有化大模型服务,以实现多种应用场景。实验环境依赖于Docker容器中的loop设备模拟共享存储,具体搭建方法可参考相关系列文章。文中详细描述了部署ollama服务、编译并安装http和openai插件的过程,并通过示例展示了如何使用这些插件调用大模型API进行文本分析和情感分类等任务。此外,还探讨了如何设计表结构及触发器函数自动处理客户反馈数据,以及生成满足需求的SQL查询语句。最后对比了不同模型的回答效果,展示了deepseek-r1模型的优势。
28 0
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课14 纯享单机版
PolarDB不仅支持基于“共享存储+多计算节点”的集群版,还提供类似开源PostgreSQL的单机版。单机版部署简单,适合大多数应用场景,并可直接使用PostgreSQL生态插件。通过Docker容器、Git克隆代码、编译软件等步骤,即可完成PolarDB单机版的安装与配置。具体操作包括启动容器、进入容器、克隆代码、编译软件、初始化实例、配置参数及启动数据库。此外,还有多个相关教程和视频链接供参考,帮助用户更好地理解和使用PolarDB单机版。
18 0
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课13 单机版转换为集群版
本文介绍如何将“本地存储实例”转换为“共享存储实例”,依赖于先前搭建的实验环境。主要步骤包括:准备PFS二进制文件、格式化共享盘为pfs文件系统、启动pfsd服务、停库并拷贝数据到pfs内、修改配置文件,最后启动实例。通过这些操作,成功实现了从本地存储到共享存储的转换,并验证了新实例的功能。相关系列文章和视频链接提供了更多背景信息和技术细节。
16 0
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课7 实时流式归档
本文介绍了如何在PolarDB RAC一写多读集群中实现实时归档,确保WAL日志的及时备份。实验依赖于Docker容器和loop设备模拟的共享存储环境。通过配置主节点的`pg_hba.conf`、创建复制槽以及使用`pg_receivewal`工具,实现实时接收并归档WAL文件。此外,还提供了详细的命令行帮助和相关文档链接,方便读者参考和操作。注意:如果已搭建容灾节点,则无需重复进行实时归档。
10 0
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课2 创建容灾(standby)节点
本文介绍了如何在macOS中搭建PolarDB的容灾(standby)节点,作为“穷鬼玩PolarDB RAC一写多读集群”系列的一部分。基于前一篇通过Docker和loop设备模拟共享存储的经验,本文详细描述了创建虚拟磁盘、启动容器、配置网络、格式化磁盘、备份数据及配置standby节点的具体步骤。
14 0
|
6天前
|
存储 关系型数据库 分布式数据库
PolarDB开源数据库进阶课12 集群版转换为单机版
本文介绍了如何将“共享存储实例”转换为“本地存储实例”,实验环境依赖于Docker容器中的loop设备模拟共享存储。具体步骤包括准备本地目录、停库、拷贝数据、修改配置文件并启动实例。通过这些操作,可以实现从共享存储到本地存储的平滑转换。相关系列文章详细记录了PolarDB RAC一写多读集群的搭建与管理,提供了丰富的实战经验。
14 2
|
6天前
|
关系型数据库 分布式数据库 PolarDB
PolarDB开源数据库进阶课1 搭建共享存储集群
在笔记本上构建PolarDB RAC环境,本文介绍了一种适用于Windows、macOS和Linux的方法:通过将宿主机上的文件模拟为块设备,并在多个Docker容器中使用loop设备共享该文件。此方法解决了macOS不支持直接挂载块设备的问题。
16 2