读书人

PostgreSQL 9.2迁徙到9.3

发布时间: 2013-09-28 10:01:20 作者: rapoo

PostgreSQL 9.2迁移到9.3

?

PostgreSQL 9.2迁徙到9.3

1.3.?PostgreSQL YUM 源安装

CentOS 6.4 环境 YUM 地址?http://yum.postgresql.org/

# yum install http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm# yum list postgres*# yum install postgresql92-server postgresql92chkconfig postgresql-9.2 onservice postgresql-9.2 initdbservice postgresql-9.2 start

配置文件的位置

# ls /var/lib/pgsql/9.2/data/*.conf/var/lib/pgsql/9.2/data/pg_hba.conf  /var/lib/pgsql/9.2/data/pg_ident.conf  /var/lib/pgsql/9.2/data/postgresql.conf

9.2 升级到 9.3

备份数据库

# su - postgres$ pg_dump -f wechat.sql wechat

升级数据库

# yum install http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm# yum install postgresql93-server postgresql93

关闭9.2,启动9。3

# chkconfig postgresql-9.2 off# service postgresql-9.2 stop# chkconfig postgresql-9.3 on# service postgresql-9.3 initdb# service postgresql-9.3 start

回复数据库

# su - postgres$ createuser -r -s -P dba$ createuser -P wechat$ createdb -E UTF8 -O wechat wechat$ cat wechat.sql | psql wechat

合并配置文件

$ cp 9.3/data/postgresql.conf{,.original}$ cp 9.3/data/pg_hba.conf{,.original}$ vimdiff 9.2/data/postgresql.conf 9.3/data/postgresql.conf$ vimdiff 9.2/data/pg_hba.conf 9.3/data/pg_hba.conf

注意 vimdiff 命令是文件对比于合并工具,建议你选择你比较熟悉的工具。

# service postgresql-9.3 restart

读书人网 >操作系统

热点推荐