Skytools安装配置管理(六)

前端之家收集整理的这篇文章主要介绍了Skytools安装配置管理(六)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

子节点接管root节点,如下:@H_502_2@

[postgres@londiste1 londiste3]$ londiste3 db2.ini takeover node1@H_502_2@

2013-09-21 10:22:13,158 25616 INFO old: node1@H_502_2@

502_2@

502_2@

2013-09-21 10:22:22,224 25616 INFO Consumer 'londiste_db1' on node 'node1' paused@H_502_2@

502_2@

502_2@

2013-09-21 10:22:23,260 25616 INFO [node2] Consumer londiste_db2 tagged as paused@H_502_2@

502_2@

2013-09-21 10:22:24,273 25616 INFO Consumer 'londiste_db2' on node 'node2' paused@H_502_2@

502_2@

502_2@

502_2@

502_2@

502_2@

2013-09-21 10:22:25,338 25616 INFO Consumer 'londiste_db2' on node 'node2' resumed@H_502_2@

502_2@

502_2@

502_2@

2013-09-21 10:22:26,363 25616 INFO Consumer 'londiste_db1' on node 'node1' resumed@H_502_2@

[postgres@londiste1 londiste3]$ londiste3 db1.ini status@H_502_2@

Queue: replika Local node: node1@H_502_2@

@H_502_2@

node2 (root)@H_502_2@

| Tables:1/0/0@H_502_2@

| Lag:8s,Tick: 463@H_502_2@

+--:node4 (branch)@H_502_2@

+--:node1 (branch)@H_502_2@

+--:node3 (branch)@H_502_2@

+--:node5 (branch)@H_502_2@

Tables:1/0/0@H_502_2@

Lag:8s,SimSun;font-size:14px;vertical-align:baseline;">{此时,接管节点成为root节点,远root节点变为node2的子节点,且原来与node2同级的节点也变为node2的子节点}@H_502_2@

3.2、walmgr3常用命令@H_502_2@

【2.5节中包括的此处不再累赘说明】@H_502_2@

3.2.1 MASTER COMMANDS@H_502_2@

1.列举当前备份命令(listbackups):@H_502_2@

[postgres@db1 pg93]$ walmgr3 wal-master.ini listbackups@H_502_2@

2.对wal进行一次手动同步命令(sync):@H_502_2@

[postgres@db1 pg93]$ walmgr3 wal-master.ini sync@H_502_2@

2013-12-23 21:44:32,280 22317 INFO 000000030000000000000030.00000028.backup: last complete@H_502_2@

502_2@

502_2@

502_2@

2013-12-23 21:44:33,310 22317 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000033@H_502_2@

502_2@

2013-12-23 21:44:34,595 22317 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000035@H_502_2@

2013-12-23 21:44:35,057 22317 INFO Partial copy done@H_502_2@

3.启动定时同步命令(syncdaemon):@H_502_2@

【同步间隔时间为配置文件中loop_delay参数指定】@H_502_2@

[postgres@db1 pg93]$ walmgr3 wal-master.ini syncdaemon@H_502_2@

2013-12-23 21:54:12,574 22473 INFO 000000030000000000000033: last complete@H_502_2@

502_2@

502_2@

2013-12-23 21:54:13,148 22473 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000036@H_502_2@

502_2@

502_2@

2013-12-23 21:54:23,990 22473 INFO 000000030000000000000033: last complete@H_502_2@

502_2@

2013-12-23 21:54:24,155 22473 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000035@H_502_2@

502_2@

502_2@

502_2@

4.取消archive配置命令(stop):@H_502_2@

【执行后archive_command参数配置将取消】@H_502_2@

[postgres@db1 pg93]$ walmgr3 wal-master.ini stop@H_502_2@

2013-12-23 21:57:25,488 22524 INFO Disabling WAL archiving@H_502_2@

502_2@

502_2@

502_2@

502_2@

5.自定义定期任务命令(periodic):@H_502_2@

[postgres@db1 pg93]$ walmgr3 wal-master.ini periodic@H_502_2@

该命令仅在配置文件中制定了定期执行命令(periodic_command)时有效。可以指定任何脚本,如同步、配置文件、系统定时任务crontab脚本等。@H_502_2@

3.2.2 SLAVE COMMANDS@H_502_2@

[postgres@db2pg93]$ walmgr3 wal-slave.ini listbackups@H_502_2@

List of backups:@H_502_2@

Backup set Timestamp Label First WAL@H_502_2@

--------------- ------------------------ ----------- ------------------------@H_502_2@

data.master 2013-12-23 21:45:30 EST FullBackup 000000030000000000000032@H_502_2@

2.暂停wal重放命令(pause):@H_502_2@

[postgres@db2pg93]$ walmgr3 wal-slave.ini pause@H_502_2@

2013-12-23 22:14:47,210 4139 INFO Pausing recovery mode@H_502_2@

3.继续wal重放命令(continue):@H_502_2@

[postgres@db2pg93]$ walmgr3 wal-slave.ini continue@H_502_2@

2013-12-23 22:15:21,740 4149 INFO Continuing with recovery@H_502_2@

4. 停止恢复模式命令(boot):@H_502_2@

【slave将变为可读写模式】@H_502_2@

[postgres@db2pg93]$ walmgr3 wal-slave.ini boot@H_502_2@

2013-12-23 22:17:27,412 4164 INFO Stopping recovery mode@H_502_2@

5.创建一个slave节点(createslave):@H_502_2@

【该命令使子节点的创建过程更加简单】@H_502_2@

[postgres@db2pg93]$ walmgr3 wal-slave.ini createslave@H_502_2@

2013-12-23 22:21:20,216@H_502_2@4306 INFO Backup lock obtained.@H_502_2@

502_2@

502_2@

2013-12-23 22:21:22,772 4306 INFO pg_basebackup finished successfully@H_502_2@

502_2@

502_2@

502_2@

502_2@

server starting@H_502_2@

LOG: database system was interrupted; last known up at 2013-12-23 22:21:20 EST@H_502_2@

LOG: creating missing WAL directory "pg_xlog/archive_status"@H_502_2@

LOG: entering standby mode@H_502_2@

2013-12-23 22:21:23,149 4358 INFO 00000003.history: Found@H_502_2@

502_2@

LOG: restored log file "00000003.history" from archive@H_502_2@

502_2@

502_2@

LOG: restored log file "000000030000000000000036" from archive@H_502_2@

LOG: redo starts at 0/36000028@H_502_2@

LOG: consistent recovery state reached at 0/360000F0@H_502_2@

LOG: database system is ready to accept read only connections@H_502_2@

502_2@

LOG: started streaming WAL from primary at 0/37000000 on timeline 3@H_502_2@

2013-12-23 22:21:27,845 4306 INFO pg_receivelog stopped@H_502_2@

502_2@

2013-12-23 22:21:27,846 4306 INFO Streaming replication standby created successfully@H_502_2@

四、参考文献@H_502_2@

http://pgfoundry.org/projects/skytools/

http://skytools.projects.pgfoundry.org/skytools-3.0/

http://skytools.projects.pgfoundry.org/skytools-3.0/doc/skytools3.html

http://wiki.postgresql.org/wiki/Skytools#Documentation_3

http://wiki.postgresql.org/wiki/Londiste_Tutorial

@H_502_2@

五、错误解决@H_502_2@

5.1、ImportError@H_502_2@

错误现象:@H_502_2@

[pg90@localhostconf]$ londiste3 part1.ini create-root part1_root dbname=part1@H_502_2@

Traceback (most recent call last):@H_502_2@

File"/opt/skytools/bin/londiste3",line 8,in <module>@H_502_2@

importpkgloader@H_502_2@

ImportError: No module named pkgloader@H_502_2@

解决办法:@H_502_2@

[root@localhostskytools-3.1.5]# python setup_pkgloader.py build@H_502_2@

[root@localhostskytools-3.1.5]# python setup_pkgloader.py install@H_502_2@

[root@localhostskytools-3.1.5]# python setup_skytools.py build@H_502_2@

[root@localhostskytools-3.1.5]# python setup_skytools.py install@H_502_2@

@H_502_2@

5.2、ProgrammingError@H_502_2@

ProgrammingError: schema "partconf" does not exist@H_502_2@

解决方法:@H_502_2@

在root节点上也创建partconf模式:@H_502_2@

part_root=# CREATE SCHEMA partconf;@H_502_2@

CREATE SCHEMA@H_502_2@

part_root=# CREATE TABLE partconf.conf (@H_502_2@

part_root(# part_nr integer,@H_502_2@

part_root(# max_part integer,SimSun;vertical-align:baseline;">part_root(# db_code bigint,SimSun;vertical-align:baseline;">part_root(# is_primary boolean,SimSun;vertical-align:baseline;">part_root(# max_slot integer,SimSun;vertical-align:baseline;">part_root(# cluster_name text@H_502_2@

part_root(# );@H_502_2@

CREATE TABLE@H_502_2@

5.3、hash_string@H_502_2@

part_root=# CREATE FUNCTION partconf.get_hash_raw@H_502_2@

part_root-# ( i_input integer)@H_502_2@

part_root-# RETURNS integer@H_502_2@

part_root-# LANGUAGE sql@H_502_2@

part_root-# AS $$@H_502_2@

part_root$# -- used to wrap hashtext so that we can replace it in 8.4@H_502_2@

part_root$# -- with older implementation to keep compatibility@H_502_2@

part_root$# select hash_string($1::text,'lookup2');@H_502_2@

part_root$# $$;@H_502_2@

ERROR: function hash_string(text,unknown) does not exist@H_502_2@

LINE 8: select hash_string($1::text,SimSun;vertical-align:baseline;"> ^@H_502_2@

HINT: No function matches the given name and argument types. You might need to add explicit type casts.@H_502_2@

5.4、rst2html@H_502_2@

[postgres@localhostpghashlib-master]$ make install@H_502_2@

/bin/mkdir -p '/opt/pgsql/lib'@H_502_2@

/bin/mkdir -p '/opt/pgsql/share/contrib'@H_502_2@

/bin/mkdir -p '/opt/pgsql/share/doc/contrib'@H_502_2@

/bin/sh /opt/pgsql/lib/pgxs/src/makefiles/../../config/install-sh -c -m 755 hashlib.so '/opt/pgsql/lib/hashlib.so'@H_502_2@

rst2html README.rst > hashlib.html@H_502_2@

/bin/sh: rst2html: command not found@H_502_2@

make: *** [hashlib.html] Error 127@H_502_2@

make: *** Deleting file `hashlib.html'@H_502_2@

下载docutils并安装@H_502_2@https://pypi.python.org/pypi/docutils

[root@localhostdocutils-0.11]# python setup.py install@H_502_2@

[root@localhost~]# ln -s /opt/python25/bin/rst2html.py /usr/bin/rst2html@H_502_2@

5.5、undefined symbol: le64toh@H_502_2@

[postgres@localhostextension]$ psql test < hashlib--1.0.sql@H_502_2@

ERROR: could not load library "/opt/pgsql/lib/hashlib.so": /opt/pgsql/lib/hashlib.so: undefined symbol: le64toh@H_502_2@

换64位操作系统@H_502_2@

5.6、找不到头文件@H_502_2@

编译skytools报错,找不到相应头文件@H_502_2@

[root@localhostskytools-3.1.5]# make@H_502_2@

……@H_502_2@

make[3]: Entering directory `/root/skytools-3.1.5/sql/pgq/lowlevel'@H_502_2@

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fpic -DHAVE_CONFIG_H -I. -I. -I/opt/pg93/include/server -I/opt/pg93/include/internal -D_GNU_SOURCE -c -o insert_event.o insert_event.c@H_502_2@

insert_event.c:19:22: error: postgres.h: No such file or directory@H_502_2@

insert_event.c:20:21: error: funcapi.h: No such file or directory@H_502_2@

insert_event.c:22:29: error: catalog/pg_type.h: No such file or directory@H_502_2@

insert_event.c:23:30: error: commands/trigger.h: No such file or directory@H_502_2@

insert_event.c:24:26: error: executor/spi.h: No such file or directory@H_502_2@

insert_event.c:25:28: error: lib/stringinfo.h: No such file or directory@H_502_2@

insert_event.c:26:28: error: utils/builtins.h: No such file or directory@H_502_2@

insert_event.c:27:28: error: utils/datetime.h: No such file or directory@H_502_2@

insert_event.c:28:27: error: utils/hsearch.h: No such file or directory@H_502_2@

insert_event.c:29:25: error: access/xact.h: No such file or directory@H_502_2@

错误原因:@H_502_2@

9.3中头文件路径发生了变化(/opt/pg93/include/postgresql/server),但skytools还是按照之前版本的路径查找(/opt/pg93/include/server)@H_502_2@

将server拷贝至include下@H_502_2@

5.7、Python.h@H_502_2@

./psycopg/psycopg.h:30:20: error: Python.h: No such file or directory@H_502_2@

缺少Python.h头文件@H_502_2@

[root@db1 psycopg2-2.5.1]# find / -name Python.h@H_502_2@

[root@db1 psycopg2-2.5.1]# yum install python-devel@H_502_2@

/usr/include/python2.6/Python.h@H_502_2@

猜你在找的Postgre SQL相关文章