子节点接管root节点,如下:
[postgres@londiste1 londiste3]$ londiste3 db2.ini takeover node1
2013-09-21 10:22:13,158 25616 INFO old: node1
2013-09-21 10:22:22,224 25616 INFO Consumer 'londiste_db1' on node 'node1' paused
2013-09-21 10:22:23,260 25616 INFO [node2] Consumer londiste_db2 tagged as paused
2013-09-21 10:22:24,273 25616 INFO Consumer 'londiste_db2' on node 'node2' paused
2013-09-21 10:22:25,338 25616 INFO Consumer 'londiste_db2' on node 'node2' resumed
2013-09-21 10:22:26,363 25616 INFO Consumer 'londiste_db1' on node 'node1' resumed
[postgres@londiste1 londiste3]$ londiste3 db1.ini status
Queue: replika Local node: node1
node2 (root)
| tables:1/0/0
| Lag:8s,Tick: 463
+--:node4 (branch)
+--:node1 (branch)
+--:node3 (branch)
+--:node5 (branch)
tables:1/0/0
Lag:8s,Simsun;Font-size:14px;vertical-align:baseline;">{此时,接管节点成为root节点,远root节点变为node2的子节点,且原来与node2同级的节点也变为node2的子节点}
3.2、walmgr3常用命令【2.5节中包括的此处不再累赘说明】
@H_404_96@3.2.1 MASTER COMMANDS1.列举当前备份命令(Listbackups):
[postgres@db1 pg93]$ walmgr3 wal-master.ini Listbackups
2.对wal进行一次手动同步命令(sync):
[postgres@db1 pg93]$ walmgr3 wal-master.ini sync
2013-12-23 21:44:32,280 22317 INFO 000000030000000000000030.00000028.backup: last complete
2013-12-23 21:44:33,310 22317 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000033
2013-12-23 21:44:34,595 22317 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000035
2013-12-23 21:44:35,057 22317 INFO Partial copy done
3.启动定时同步命令(syncdaemon):
【同步间隔时间为配置文件中loop_delay参数指定】
[postgres@db1 pg93]$ walmgr3 wal-master.ini syncdaemon
2013-12-23 21:54:12,574 22473 INFO 000000030000000000000033: last complete
2013-12-23 21:54:13,148 22473 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000036
2013-12-23 21:54:23,990 22473 INFO 000000030000000000000033: last complete
2013-12-23 21:54:24,155 22473 INFO Syncing /opt/pg93/data/pg_xlog/000000030000000000000035
4.取消archive配置命令(stop):
【执行后archive_command参数配置将取消】
[postgres@db1 pg93]$ walmgr3 wal-master.ini stop
2013-12-23 21:57:25,488 22524 INFO disabling WAL archiving
5.自定义定期任务命令(periodic):
[postgres@db1 pg93]$ walmgr3 wal-master.ini periodic
该命令仅在配置文件中制定了定期执行命令(periodic_command)时有效。可以指定任何脚本,如同步、配置文件、系统定时任务crontab脚本等。
3.2.2 SLAVE COMMANDS[postgres@db2pg93]$ walmgr3 wal-slave.ini Listbackups
List of backups:
Backup set Timestamp Label First WAL
--------------- ------------------------ ----------- ------------------------
data.master 2013-12-23 21:45:30 EST FullBackup 000000030000000000000032
2.暂停wal重放命令(pause):
[postgres@db2pg93]$ walmgr3 wal-slave.ini pause
2013-12-23 22:14:47,210 4139 INFO Pausing recovery mode
3.继续wal重放命令(continue):
[postgres@db2pg93]$ walmgr3 wal-slave.ini continue
2013-12-23 22:15:21,740 4149 INFO Continuing with recovery
4. 停止恢复模式命令(boot):
【slave将变为可读写模式】
[postgres@db2pg93]$ walmgr3 wal-slave.ini boot
2013-12-23 22:17:27,412 4164 INFO StopPing recovery mode
5.创建一个slave节点(createslave):
【该命令使子节点的创建过程更加简单】
[postgres@db2pg93]$ walmgr3 wal-slave.ini createslave
2013-12-23 22:21:20,2164306 INFO Backup lock obtained.
2013-12-23 22:21:22,772 4306 INFO pg_basebackup finished successfully
server starting
LOG: database system was interrupted; last kNown up at 2013-12-23 22:21:20 EST
LOG: creating missing WAL directory "pg_xlog/archive_status"
LOG: entering standby mode
2013-12-23 22:21:23,149 4358 INFO 00000003.history: Found
LOG: restored log file "00000003.history" from archive
LOG: restored log file "000000030000000000000036" from archive
LOG: redo starts at 0/36000028
LOG: consistent recovery state reached at 0/360000F0
LOG: database system is ready to accept read only connections
LOG: started streaming WAL from primary at 0/37000000 on timeline 3
2013-12-23 22:21:27,845 4306 INFO pg_receivelog stopped
2013-12-23 22:21:27,846 4306 INFO Streaming replication standby created successfully
四、参考文献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
五、错误解决 5.1、importError错误现象:
[pg90@localhostconf]$ londiste3 part1.ini create-root part1_root dbname=part1
Traceback (most recent call last):
file"/opt/skytools/bin/londiste3",line 8,in <module>
importpkgloader
importError: No module named pkgloader
解决办法:
[root@localhostskytools-3.1.5]# python setup_pkgloader.py build
[root@localhostskytools-3.1.5]# python setup_pkgloader.py install
[root@localhostskytools-3.1.5]# python setup_skytools.py build
[root@localhostskytools-3.1.5]# python setup_skytools.py install
5.2、ProgrammingErrorProgrammingError: schema "partconf" does not exist
解决方法:
在root节点上也创建partconf模式:
part_root=# CREATE SCHEMA partconf;
CREATE SCHEMA
part_root=# CREATE table partconf.conf (
part_root(# part_nr integer,
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
part_root(# );
CREATE table
5.3、hash_stringpart_root=# CREATE FUNCTION partconf.get_hash_raw
part_root-# ( i_input integer)
part_root-# RETURNS integer
part_root-# LANGUAGE sql
part_root-# AS $$
part_root$# -- used to wrap hashtext so that we can replace it in 8.4
part_root$# -- with older implementation to keep compatibility
part_root$# select hash_string($1::text,'lookup2');
part_root$# $$;
ERROR: function hash_string(text,unkNown) does not exist
liNE 8: select hash_string($1::text,Simsun;vertical-align:baseline;"> ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
5.4、rst2HTML
[postgres@localhostpghashlib-master]$ make install
/bin/mkdir -p '/opt/pgsql/lib'
/bin/mkdir -p '/opt/pgsql/share/contrib'
/bin/mkdir -p '/opt/pgsql/share/doc/contrib'
/bin/sh /opt/pgsql/lib/pgxs/src/makefiles/../../config/install-sh -c -m 755 hashlib.so '/opt/pgsql/lib/hashlib.so'
rst2HTML README.rst > hashlib.HTML
/bin/sh: rst2HTML: command not found
make: *** [hashlib.HTML] Error 127
make: *** Deleting file `hashlib.HTML'
下载docutils并安装https://pypi.python.org/pypi/docutils
[root@localhostdocutils-0.11]# python setup.py install
[root@localhost~]# ln -s /opt/python25/bin/rst2HTML.py /usr/bin/rst2HTML
5.5、undefined symbol: le64toh[postgres@localhostextension]$ psql test < hashlib--1.0.sql
ERROR: Could not load library "/opt/pgsql/lib/hashlib.so": /opt/pgsql/lib/hashlib.so: undefined symbol: le64toh
换64位 *** 作系统
5.6、找不到头文件
编译skytools报错,找不到相应头文件
[root@localhostskytools-3.1.5]# make
……
make[3]: Entering directory `/root/skytools-3.1.5/sql/pgq/lowlevel'
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
insert_event.c:19:22: error: postgres.h: No such file or directory
insert_event.c:20:21: error: funcAPI.h: No such file or directory
insert_event.c:22:29: error: catalog/pg_type.h: No such file or directory
insert_event.c:23:30: error: commands/trigger.h: No such file or directory
insert_event.c:24:26: error: executor/spi.h: No such file or directory
insert_event.c:25:28: error: lib/stringinfo.h: No such file or directory
insert_event.c:26:28: error: utils/builtins.h: No such file or directory
insert_event.c:27:28: error: utils/datetime.h: No such file or directory
insert_event.c:28:27: error: utils/hsearch.h: No such file or directory
insert_event.c:29:25: error: access/xact.h: No such file or directory
错误原因:
9.3中头文件路径发生了变化(/opt/pg93/include/postgresql/server),但skytools还是按照之前版本的路径查找(/opt/pg93/include/server)
将server拷贝至include下
5.7、Python.h
./psycopg/psycopg.h:30:20: error: Python.h: No such file or directory
缺少Python.h头文件
[root@db1 psycopg2-2.5.1]# find / -name Python.h
[root@db1 psycopg2-2.5.1]# yum install python-devel
/usr/include/python2.6/Python.h
总结以上是内存溢出为你收集整理的Skytools安装配置管理(六)全部内容,希望文章能够帮你解决Skytools安装配置管理(六)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)