温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

centos6安装postgresql9主从节点重点提要

发布时间:2020-07-23 01:17:46 来源:网络 阅读:367 作者:断臂人 栏目:数据库

1、需求分析

系统版本:

cat /etc/redhat-release 

Red Hat Enterprise Linux Server release 6.7 (Santiago)


在PGSQL9之后才有了主从的功能,但是在centos6的源中默认是安装PGSQL8,所以就需要去网上下载软件包安装。


2、卸载旧版PGSQL

# yum remove postgresql-server


3、在下面网站找到自己需要的版本

https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-6.7-x86_64/

postgresql94-9.4.18-1PGDG.rhel6.x86_64.rpm

postgresql94-devel-9.4.18-1PGDG.rhel6.x86_64.rpm

postgresql94-libs-9.4.18-1PGDG.rhel6.x86_64.rpm

postgresql94-server-9.4.18-1PGDG.rhel6.x86_64.rpm


4、上传并安装

# yum install -y postgresql94-libs-9.4.18-1PGDG.rhel6.x86_64.rpm postgresql94-9.4.18-1PGDG.rhel6.x86_64.rpm postgresql94-server-9.4.18-1PGDG.rhel6.x86_64.rpm postgresql94-devel-9.4.18-1PGDG.rhel6.x86_64.rpm


5、命令执行注意点

因为不是按照系统默认安装的,所以需要把执行路径添加到环境变量


通过命令查看相关命令的具体位置

# rpm -qa | grep postgres*

postgresql94-libs-9.4.18-1PGDG.rhel6.x86_64

postgresql94-devel-9.4.18-1PGDG.rhel6.x86_64

postgresql-libs-8.4.20-8.el6_9.x86_64

postgresql94-9.4.18-1PGDG.rhel6.x86_64

postgresql94-server-9.4.18-1PGDG.rhel6.x86_64


# rpm -ql postgresql94-server-9.4.18-1PGDG.rhel6.x86_64 | more

/usr/pgsql-9.4/bin/psql

/usr/pgsql-9.4/bin/initdb

/usr/pgsql-9.4/bin/pg_ctl


# vi /etc/profile

添加

export PATH=$PATH://usr/pgsql-9.4/bin


# source /etc/profile


6、启动方式和开机启动配置

启动方式

$ pg_ctl -D /data/pg_data start


开机启动服务配置

vi /etc/rc.d/rc.local

添加

/usr/pgsql-9.4/bin/pg_ctl -D /data/pg_data start


如果服务起不来,可以查看日志文件/data/pg_data/pg_log/postgresql-xxx.log进行排查。

其他配置与我之前的文章生产环境postgresql主从环境配置并无二致


参考:

https://blog.csdn.net/kongxx/article/details/52883383

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI