云原生数据库PolarDB for PostgreSQL已于2021年5月29日开源。有幸拿到测试资格。接下来我们感受下在云起实验室,如何快速体验PolarDB for PostgreSQL!
背景知识
PolarDB for PostgreSQL采用了基于Shared-Storage的存储计算分离架构。数据库由传统的Share-Nothing架构,转变成了Shared-Storage架构——由原来的N份计算+N份存储,转变成了N份计算+1份存储;而PostgreSQL使用了传统的单体数据库架构,存储和计算耦合在一起。

为保证所有计算节点能够以相同的可见性视角访问分布式块存储设备,PolarDB需要使用分布式文件系统PolarDB File System(PFS)来访问块设备;如果所有计算节点都可以本地访问同一个块存储设备,那么也可以不使用PFS,直接使用本地的单机文件系统(如 ext4)。这是与PostgreSQL的不同点之一。
实验环境已内置Docker环境以及PolarDB for PostgreSQL开源版的镜像资源,直接拉取镜像并运行,即可启动PolarDB实例。
- 执行如下命令,拉取PolarDB-PG实例镜像。
docker pull polardb/polardb_pg_local_instance
- 执行如下命令,创建容器。
[root@iZuf6i67aqdz2525tkxsp4Z ~]# docker run -it --rm polardb/polardb_pg_local_instance psql
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "C".
The default database encoding has accordingly been set to "SQL_ASCII".
The default text search configuration will be set to "english".
Data page checksums are enabled.
Data encryption is disabled.
fixing permissions on existing directory /var/polardb/primary_datadir ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Shanghai
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... 2024-07-25 23:16:02.713 CST [29] [29] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:02.713 CST [29] [29] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:02.716 CST [29] [29] LOG: server cannot reuse buffer pool due to polar_shmem_reused is false, start to reset buffer pool
2024-07-25 23:16:02.716 CST [29] [29] LOG: server cannot reuse buffer pool, start to reset it, pid=29
2024-07-25 23:16:02.718 CST [29] [29] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:03.076 CST [29] [29] LOG: rename pg_logindex to local cache trash polar_cache_trash/pg_logindex_0000, errno=0
2024-07-25 23:16:03.076 CST [29] [29] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:03.076 CST [29] [29] LOG: rename polar_fullpage to local cache trash polar_cache_trash/polar_fullpage_0000, errno=0
2024-07-25 23:16:03.088 CST [29] [29] LOG: removing file "pg_notify/0000"
2024-07-25 23:16:03.108 CST [29] [29] LOG: polardb read control file "global/pg_control" success
2024-07-25 23:16:03.108 CST [29] [29] LOG: polardb load and check controlfile success
2024-07-25 23:16:03.109 CST [29] [29] WARNING: could not open directory "polar_fra": No such file or directory
2024-07-25 23:16:03.109 CST [29] [29] LOG: database system was not properly shut down; automatic recovery in progress
2024-07-25 23:16:03.110 CST [29] [29] LOG: polar_logindex_snapshot_base_init logindex meta: magic=0 version=0 max_table_id=0 seg.no=0 seg.max_lsn=0 seg.max_id=0 seg.min_id=0 start_lsn=0 max_lsn=0 crc=0
2024-07-25 23:16:03.377 CST [29] [29] LOG: Init pg_logindex succeed
2024-07-25 23:16:03.378 CST [29] [29] LOG: polar_logindex_snapshot_base_init logindex meta: magic=0 version=0 max_table_id=0 seg.no=0 seg.max_lsn=0 seg.max_id=0 seg.min_id=0 start_lsn=0 max_lsn=0 crc=0
2024-07-25 23:16:03.466 CST [29] [29] LOG: Init polar_fullpage succeed
2024-07-25 23:16:03.466 CST [29] [29] LOG: polar logindex change from 1000098 to 1000098
2024-07-25 23:16:03.466 CST [29] [29] LOG: invalid record length at 0/1000098: wanted 24, got 0
2024-07-25 23:16:03.466 CST [29] [29] LOG: redo is not required
2024-07-25 23:16:03.547 CST [29] [29] LOG: Truncate relation size cache from 1000098
2024-07-25 23:16:03.547 CST [29] [29] LOG: Truncate logindex pg_logindex from lsn=1000098
2024-07-25 23:16:03.547 CST [29] [29] LOG: Truncate logindex polar_fullpage from lsn=1000098
2024-07-25 23:16:03.547 CST [29] [29] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
ok
performing post-bootstrap initialization ... 2024-07-25 23:16:03.669 CST [31] [31] LOG: polardb read control file "global/pg_control" success
2024-07-25 23:16:03.669 CST [31] [31] LOG: polardb load and check controlfile success
2024-07-25 23:16:03.669 CST [31] [31] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:03.669 CST [31] [31] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:03.673 CST [31] [31] LOG: server cannot reuse buffer pool due to polar_shmem_reused is false, start to reset buffer pool
2024-07-25 23:16:03.673 CST [31] [31] LOG: server cannot reuse buffer pool, start to reset it, pid=31
2024-07-25 23:16:03.675 CST [31] [31] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:03.997 CST [31] [31] LOG: rename pg_logindex to local cache trash polar_cache_trash/pg_logindex_0000, errno=0
2024-07-25 23:16:03.997 CST [31] [31] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:03.998 CST [31] [31] LOG: rename polar_fullpage to local cache trash polar_cache_trash/polar_fullpage_0000, errno=0
2024-07-25 23:16:04.009 CST [31] [31] LOG: removing file "pg_notify/0000"
2024-07-25 23:16:04.010 CST [31] [31] WARNING: could not open directory "polar_fra": No such file or directory
2024-07-25 23:16:04.010 CST [31] [31] LOG: database system was not properly shut down; automatic recovery in progress
2024-07-25 23:16:04.010 CST [31] [31] LOG: polar_logindex_snapshot_base_init logindex meta: magic=0 version=0 max_table_id=0 seg.no=0 seg.max_lsn=0 seg.max_id=0 seg.min_id=0 start_lsn=0 max_lsn=0 crc=0
2024-07-25 23:16:04.250 CST [31] [31] LOG: Init pg_logindex succeed
2024-07-25 23:16:04.250 CST [31] [31] LOG: polar_logindex_snapshot_base_init logindex meta: magic=0 version=0 max_table_id=0 seg.no=0 seg.max_lsn=0 seg.max_id=0 seg.min_id=0 start_lsn=0 max_lsn=0 crc=0
2024-07-25 23:16:04.330 CST [31] [31] LOG: Init polar_fullpage succeed
2024-07-25 23:16:04.330 CST [31] [31] LOG: polar logindex change from 107cf18 to 107cf18
2024-07-25 23:16:04.330 CST [31] [31] LOG: invalid record length at 0/107CF18: wanted 24, got 0
2024-07-25 23:16:04.330 CST [31] [31] LOG: redo is not required
2024-07-25 23:16:04.866 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.866 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.866 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.866 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.866 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.866 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.866 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
2024-07-25 23:16:04.866 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.882 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.882 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.882 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.882 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.882 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.882 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.882 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
2024-07-25 23:16:04.882 CST [31] [31] STATEMENT: CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false;
2024-07-25 23:16:04.884 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.884 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.884 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.884 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.884 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.884 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.884 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
2024-07-25 23:16:04.884 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.901 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.901 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.901 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.901 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.901 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.901 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.901 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
2024-07-25 23:16:04.901 CST [31] [31] STATEMENT: CREATE DATABASE postgres;
2024-07-25 23:16:04.902 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.902 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.902 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.902 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.902 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.902 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.902 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
2024-07-25 23:16:04.902 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.920 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.920 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.920 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.920 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.920 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.920 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.920 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
2024-07-25 23:16:04.920 CST [31] [31] STATEMENT: CREATE DATABASE polardb_admin;
2024-07-25 23:16:04.921 CST [31] [31] LOG: Truncate relation size cache from 107CF18
2024-07-25 23:16:04.921 CST [31] [31] LOG: Truncate logindex pg_logindex from lsn=107CF18
2024-07-25 23:16:04.921 CST [31] [31] LOG: Truncate logindex polar_fullpage from lsn=107CF18
2024-07-25 23:16:04.921 CST [31] [31] LOG: attempting to remove WAL segments older than log file 000000000000000000000000
ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
pg_ctl -D /var/polardb/primary_datadir -l logfile start
use localfs mode
list base dir file 1
13163
13164
13165
delete /var/polardb/primary_datadir/base/1/112
delete /var/polardb/primary_datadir/base/13163/112
delete /var/polardb/primary_datadir/base/13164/112
delete /var/polardb/primary_datadir/base/13165/112
delete /var/polardb/primary_datadir/global/1136
delete /var/polardb/primary_datadir/pg_wal
delete /var/polardb/primary_datadir/pg_logindex
delete /var/polardb/primary_datadir/pg_twophase
delete /var/polardb/primary_datadir/pg_xact
delete /var/polardb/primary_datadir/pg_commit_ts
delete /var/polardb/primary_datadir/pg_multixact
delete /var/polardb/primary_datadir/pg_csnlog
delete /var/polardb/primary_datadir/polar_dma
init polarDB data dir success
waiting for server to start....2024-07-25 23:16:05.645 CST [81] [81] LOG: /var/polardb/primary_datadir/polar_node_static.conf does not exist, we create it, This is best done on the first boot and not on restart
2024-07-25 23:16:05.652 CST [81] [81] WARNING: polardb skip readControlfile
2024-07-25 23:16:05.652 CST [81] [81] LOG: recovery.conf not exist, polardb in readwrite mode
2024-07-25 23:16:05.659 CST [81] [81] LOG: polar_vfs loaded in postmaster 81
2024-07-25 23:16:05.662 CST [81] [81] WARNING: could not access file "polar_resource_group": No such file or directory
2024-07-25 23:16:05.674 CST [81] [81] LOG: Auto detecting polar_stat_sql.linux_hz parameter...
2024-07-25 23:16:05.674 CST [81] [81] LOG: polar_stat_sql.linux_hz is set to 500000
2024-07-25 23:16:05.688 CST [81] [81] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-07-25 23:16:05.689 CST [81] [81] LOG: listening on IPv6 address "::", port 5432
2024-07-25 23:16:05.693 CST [81] [81] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2024-07-25 23:16:05.694 CST [81] [81] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:05.694 CST [81] [81] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:05.694 CST [81] [81] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:05.694 CST [81] [81] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:05.694 CST [81] [81] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:05.696 CST [81] [81] LOG: init vfs_mount_state done
2024-07-25 23:16:05.696 CST [81] [81] LOG: Database will be in readwrite mode
2024-07-25 23:16:05.696 CST [81] [81] LOG: pfs in localfs mode
2024-07-25 23:16:05.696 CST [81] [81] LOG: PolarIOStatArray share memory total size is 706680
2024-07-25 23:16:05.697 CST [81] [81] LOG: PolarGlobalIOReadStats share memory size is 176
2024-07-25 23:16:05.697 CST [81] [81] LOG: polar_vfs init done
2024-07-25 23:16:05.697 CST [81] [81] LOG: polar_lwlocks_stat_array share memory total size is 1280000
2024-07-25 23:16:05.698 CST [81] [81] LOG: polar_locks_stat_array share memory total size is 800000
2024-07-25 23:16:05.698 CST [81] [81] LOG: polar_network_stat_array share memory total size is 14496
2024-07-25 23:16:05.701 CST [81] [81] LOG: polardb delay load controlfile
2024-07-25 23:16:05.717 CST [81] [81] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:05.717 CST [81] [81] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:05.727 CST [81] [81] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:05.727 CST [81] [81] LOG: vfs open dir /var/polardb/primary_datadir/polar_rel_size_cache, num open dir 1
2024-07-25 23:16:06.056 CST [81] [81] LOG: rename pg_logindex to local cache trash polar_cache_trash/pg_logindex_0000, errno=2
2024-07-25 23:16:06.056 CST [81] [81] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:06.056 CST [81] [81] LOG: creating missing directory "file-dio:///var/polardb/shared_datadir/polar_fullpage"
2024-07-25 23:16:06.056 CST [81] [81] LOG: rename polar_fullpage to local cache trash polar_cache_trash/polar_fullpage_0001, errno=39
2024-07-25 23:16:06.083 CST [81] [81] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:06.095 CST [81] [81] LOG: vfs open dir pg_notify, num open dir 1
2024-07-25 23:16:06.095 CST [81] [81] LOG: removing file "pg_notify/0000"
2024-07-25 23:16:06.095 CST [81] [81] LOG: vfs_unlink pg_notify/0000
2024-07-25 23:16:06.095 CST [81] [81] LOG: pss shmem share memory total size is 1048576
2024-07-25 23:16:06.095 CST [81] [81] LOG: pss global share memory total size is 1736
2024-07-25 23:16:06.095 CST [81] [81] LOG: pss dispatcher share memory total size is 131568
2024-07-25 23:16:06.095 CST [81] [81] LOG: pss session_contexts share memory total size is 8000
2024-07-25 23:16:06.099 CST [81] [81] LOG: forked new process, pid is 82, true pid is 2370
2024-07-25 23:16:06.099 CST [81] [81] LOG: redirecting log output to logging collector process
2024-07-25 23:16:06.099 CST [81] [81] HINT: Future log output will appear in directory "pg_log".
. done
server started
slot_name | lsn
-----------+-----
replica1 |
(1 row)
slot_name | lsn
-----------+-----
replica2 |
(1 row)
waiting for server to shut down.... done
server stopped
waiting for server to start....2024-07-25 23:16:08.075 CST [116] [116] WARNING: polardb skip readControlfile
2024-07-25 23:16:08.075 CST [116] [116] LOG: recovery.conf not exist, polardb in readwrite mode
2024-07-25 23:16:08.078 CST [116] [116] LOG: polar_vfs loaded in postmaster 116
2024-07-25 23:16:08.080 CST [116] [116] WARNING: could not access file "polar_resource_group": No such file or directory
2024-07-25 23:16:08.084 CST [116] [116] LOG: Auto detecting polar_stat_sql.linux_hz parameter...
2024-07-25 23:16:08.084 CST [116] [116] LOG: polar_stat_sql.linux_hz is set to 333333
2024-07-25 23:16:08.093 CST [116] [116] LOG: listening on IPv4 address "0.0.0.0", port 5432
2024-07-25 23:16:08.094 CST [116] [116] LOG: listening on IPv6 address "::", port 5432
2024-07-25 23:16:08.097 CST [116] [116] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
2024-07-25 23:16:08.099 CST [116] [116] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:08.099 CST [116] [116] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:08.099 CST [116] [116] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:08.099 CST [116] [116] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:08.099 CST [116] [116] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:08.101 CST [116] [116] LOG: init vfs_mount_state done
2024-07-25 23:16:08.101 CST [116] [116] LOG: Database will be in readwrite mode
2024-07-25 23:16:08.101 CST [116] [116] LOG: pfs in localfs mode
2024-07-25 23:16:08.101 CST [116] [116] LOG: PolarIOStatArray share memory total size is 706680
2024-07-25 23:16:08.102 CST [116] [116] LOG: PolarGlobalIOReadStats share memory size is 176
2024-07-25 23:16:08.102 CST [116] [116] LOG: polar_vfs init done
2024-07-25 23:16:08.102 CST [116] [116] LOG: polar_lwlocks_stat_array share memory total size is 1280000
2024-07-25 23:16:08.103 CST [116] [116] LOG: polar_locks_stat_array share memory total size is 800000
2024-07-25 23:16:08.103 CST [116] [116] LOG: polar_network_stat_array share memory total size is 14496
2024-07-25 23:16:08.105 CST [116] [116] LOG: polardb delay load controlfile
2024-07-25 23:16:08.121 CST [116] [116] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:08.122 CST [116] [116] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:08.131 CST [116] [116] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:08.132 CST [116] [116] LOG: vfs open dir /var/polardb/primary_datadir/polar_rel_size_cache, num open dir 1
2024-07-25 23:16:08.454 CST [116] [116] LOG: rename pg_logindex to local cache trash polar_cache_trash/pg_logindex_0000, errno=0
2024-07-25 23:16:08.454 CST [116] [116] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:08.454 CST [116] [116] LOG: rename polar_fullpage to local cache trash polar_cache_trash/polar_fullpage_0000, errno=0
2024-07-25 23:16:08.480 CST [116] [116] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:08.491 CST [116] [116] LOG: vfs open dir pg_notify, num open dir 1
2024-07-25 23:16:08.492 CST [116] [116] LOG: removing file "pg_notify/0000"
2024-07-25 23:16:08.492 CST [116] [116] LOG: vfs_unlink pg_notify/0000
2024-07-25 23:16:08.492 CST [116] [116] LOG: pss shmem share memory total size is 1048576
2024-07-25 23:16:08.492 CST [116] [116] LOG: pss global share memory total size is 1736
2024-07-25 23:16:08.492 CST [116] [116] LOG: pss dispatcher share memory total size is 131568
2024-07-25 23:16:08.492 CST [116] [116] LOG: pss session_contexts share memory total size is 8000
2024-07-25 23:16:08.496 CST [116] [116] LOG: forked new process, pid is 117, true pid is 2405
2024-07-25 23:16:08.496 CST [116] [116] LOG: redirecting log output to logging collector process
2024-07-25 23:16:08.496 CST [116] [116] HINT: Future log output will appear in directory "pg_log".
. done
server started
waiting for server to start....2024-07-25 23:16:10.094 CST [147] [147] LOG: /var/polardb/replica_datadir1/polar_node_static.conf does not exist, we create it, This is best done on the first boot and not on restart
2024-07-25 23:16:10.096 CST [147] [147] WARNING: polardb skip readControlfile
2024-07-25 23:16:10.096 CST [147] [147] LOG: polar_replica = 'on'
2024-07-25 23:16:10.096 CST [147] [147] LOG: read polar_replica = on, polardb in replica mode, use ro mode mount pfs
2024-07-25 23:16:10.098 CST [147] [147] LOG: polar_vfs loaded in postmaster 147
2024-07-25 23:16:10.099 CST [147] [147] WARNING: could not access file "polar_resource_group": No such file or directory
2024-07-25 23:16:10.104 CST [147] [147] LOG: Auto detecting polar_stat_sql.linux_hz parameter...
2024-07-25 23:16:10.104 CST [147] [147] LOG: polar_stat_sql.linux_hz is set to 500000
2024-07-25 23:16:10.111 CST [147] [147] LOG: listening on IPv4 address "0.0.0.0", port 5433
2024-07-25 23:16:10.111 CST [147] [147] LOG: listening on IPv6 address "::", port 5433
2024-07-25 23:16:10.114 CST [147] [147] LOG: listening on Unix socket "/tmp/.s.PGSQL.5433"
2024-07-25 23:16:10.116 CST [147] [147] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:10.116 CST [147] [147] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:10.116 CST [147] [147] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:10.116 CST [147] [147] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:10.116 CST [147] [147] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:10.118 CST [147] [147] LOG: init vfs_mount_state done
2024-07-25 23:16:10.118 CST [147] [147] LOG: Database will be in readonly mode
2024-07-25 23:16:10.118 CST [147] [147] LOG: pfs in localfs mode
2024-07-25 23:16:10.118 CST [147] [147] LOG: PolarIOStatArray share memory total size is 697320
2024-07-25 23:16:10.119 CST [147] [147] LOG: PolarGlobalIOReadStats share memory size is 176
2024-07-25 23:16:10.119 CST [147] [147] LOG: polar_vfs init done
2024-07-25 23:16:10.119 CST [147] [147] LOG: polar_lwlocks_stat_array share memory total size is 757760
2024-07-25 23:16:10.119 CST [147] [147] LOG: polar_locks_stat_array share memory total size is 473600
2024-07-25 23:16:10.120 CST [147] [147] LOG: polar_network_stat_array share memory total size is 14304
2024-07-25 23:16:10.122 CST [147] [147] LOG: polardb delay load controlfile
2024-07-25 23:16:10.138 CST [147] [147] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:10.138 CST [147] [147] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:10.148 CST [147] [147] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:10.149 CST [147] [147] LOG: vfs open dir /var/polardb/replica_datadir1/polar_rel_size_cache, num open dir 1
2024-07-25 23:16:10.486 CST [147] [147] LOG: rename pg_logindex to local cache trash polar_cache_trash/pg_logindex_0000, errno=2
2024-07-25 23:16:10.486 CST [147] [147] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:10.486 CST [147] [147] LOG: rename polar_fullpage to local cache trash polar_cache_trash/polar_fullpage_0001, errno=39
2024-07-25 23:16:10.512 CST [147] [147] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:10.524 CST [147] [147] LOG: vfs open dir pg_notify, num open dir 1
2024-07-25 23:16:10.524 CST [147] [147] LOG: removing file "pg_notify/0000"
2024-07-25 23:16:10.524 CST [147] [147] LOG: vfs_unlink pg_notify/0000
2024-07-25 23:16:10.527 CST [147] [147] LOG: forked new process, pid is 148, true pid is 2436
2024-07-25 23:16:10.527 CST [147] [147] LOG: redirecting log output to logging collector process
2024-07-25 23:16:10.527 CST [147] [147] HINT: Future log output will appear in directory "pg_log".
. done
server started
waiting for server to start....2024-07-25 23:16:11.213 CST [163] [163] LOG: /var/polardb/replica_datadir2/polar_node_static.conf does not exist, we create it, This is best done on the first boot and not on restart
2024-07-25 23:16:11.215 CST [163] [163] WARNING: polardb skip readControlfile
2024-07-25 23:16:11.215 CST [163] [163] LOG: polar_replica = 'on'
2024-07-25 23:16:11.215 CST [163] [163] LOG: read polar_replica = on, polardb in replica mode, use ro mode mount pfs
2024-07-25 23:16:11.217 CST [163] [163] LOG: polar_vfs loaded in postmaster 163
2024-07-25 23:16:11.218 CST [163] [163] WARNING: could not access file "polar_resource_group": No such file or directory
2024-07-25 23:16:11.222 CST [163] [163] LOG: Auto detecting polar_stat_sql.linux_hz parameter...
2024-07-25 23:16:11.222 CST [163] [163] LOG: polar_stat_sql.linux_hz is set to 500000
2024-07-25 23:16:11.231 CST [163] [163] LOG: listening on IPv4 address "0.0.0.0", port 5434
2024-07-25 23:16:11.231 CST [163] [163] LOG: listening on IPv6 address "::", port 5434
2024-07-25 23:16:11.235 CST [163] [163] LOG: listening on Unix socket "/tmp/.s.PGSQL.5434"
2024-07-25 23:16:11.236 CST [163] [163] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:11.236 CST [163] [163] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:11.237 CST [163] [163] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:11.237 CST [163] [163] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:11.237 CST [163] [163] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:11.239 CST [163] [163] LOG: init vfs_mount_state done
2024-07-25 23:16:11.239 CST [163] [163] LOG: Database will be in readonly mode
2024-07-25 23:16:11.239 CST [163] [163] LOG: pfs in localfs mode
2024-07-25 23:16:11.239 CST [163] [163] LOG: PolarIOStatArray share memory total size is 697320
2024-07-25 23:16:11.239 CST [163] [163] LOG: PolarGlobalIOReadStats share memory size is 176
2024-07-25 23:16:11.239 CST [163] [163] LOG: polar_vfs init done
2024-07-25 23:16:11.239 CST [163] [163] LOG: polar_lwlocks_stat_array share memory total size is 757760
2024-07-25 23:16:11.240 CST [163] [163] LOG: polar_locks_stat_array share memory total size is 473600
2024-07-25 23:16:11.240 CST [163] [163] LOG: polar_network_stat_array share memory total size is 14304
2024-07-25 23:16:11.242 CST [163] [163] LOG: polardb delay load controlfile
2024-07-25 23:16:11.260 CST [163] [163] LOG: clog buffer max slot size is 4096, and it will be set to 512
2024-07-25 23:16:11.260 CST [163] [163] LOG: commit timestamp buffer max slot size is 2048, and it will set to 16
2024-07-25 23:16:11.270 CST [163] [163] LOG: The total log index memory table size is 402525536
2024-07-25 23:16:11.270 CST [163] [163] LOG: vfs open dir /var/polardb/replica_datadir2/polar_rel_size_cache, num open dir 1
2024-07-25 23:16:11.601 CST [163] [163] LOG: rename pg_logindex to local cache trash polar_cache_trash/pg_logindex_0000, errno=2
2024-07-25 23:16:11.601 CST [163] [163] LOG: The total log index memory table size is 133987136
2024-07-25 23:16:11.601 CST [163] [163] LOG: rename polar_fullpage to local cache trash polar_cache_trash/polar_fullpage_0001, errno=39
2024-07-25 23:16:11.630 CST [163] [163] LOG: The total log index memory table size is 66993872
2024-07-25 23:16:11.643 CST [163] [163] LOG: vfs open dir pg_notify, num open dir 1
2024-07-25 23:16:11.643 CST [163] [163] LOG: removing file "pg_notify/0000"
2024-07-25 23:16:11.643 CST [163] [163] LOG: vfs_unlink pg_notify/0000
2024-07-25 23:16:11.647 CST [163] [163] LOG: forked new process, pid is 164, true pid is 2452
2024-07-25 23:16:11.647 CST [163] [163] LOG: redirecting log output to logging collector process
2024-07-25 23:16:11.647 CST [163] [163] HINT: Future log output will appear in directory "pg_log".
. done
server started
psql (11.9)
Type "help" for help.
尝试创建一个数据库:
postgres-# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+----------+-----------+---------+-------+-----------------------
polardb_admin | postgres | SQL_ASCII | C | C | =T/postgres +
| | | | | postgres=CTc/postgres
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
postgres=# create database test;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+----------+-----------+---------+-------+-----------------------
polardb_admin | postgres | SQL_ASCII | C | C | =T/postgres +
| | | | | postgres=CTc/postgres
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
test | postgres | SQL_ASCII | C | C |
(5 rows)
postgres=#

最后修改时间:2024-09-09 21:20:03
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




