软件下载吧文章资讯

分类分类

postgresql 12版本搭建及主备部署操作

2024-03-13 13:57作者:下载吧

postgresql 12版本主备部署

环境搭建

centos 7+

postgresql 12.0

# 网络检查
ping -c2 baidu.com
#关闭防火墙,selinux
systemctl stop firewalld && sudo systemctl disable firewalld
sed -ri s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
setenforce 0
### 配置阿里云yum源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#echo “isntalling tools”
yum -y install vim net-tools wget ntpdate
yum -y groupinstall “Development Tools”
# 时间同步
echo “*/10 * * * * /usr/sbin/ntpdate ntp.aliyun.com > /dev/null 2>&1” >>/etc/crontab
# 加快ssh连接
sed -ri s/”#UseDNS yes”/”UseDNS no”/g /etc/ssh/sshd_config
systemctl restart sshd
## 环境准备,根据自身需要,减少或者增加
yum install -y wget gcc gcc-c++ epel-release llvm5.0 llvm5.0-devel clang libicu-devel perl-ExtUtils-Embed readline readline-devel zlib zlib-devel openssl openssl-devel pam-devel libxml2-devel libxslt-devel openldap-devel systemd-devel tcl-devel python-devel
## 下载、解压,安装
cd /usr/local/src
wget https://ftp.postgresql.org/pub/source/v12.0/postgresql-12.0.tar.gz
tar -xvzf postgresql-12.tar.gz
cd postgresql-12
./configure –prefix=/usr/local/pgsql/12 –enable-nls –with-python –with-tcl –with-gssapi –with-icu –with-openssl –with-pam –with-ldap –with-systemd –with-libxml –with-libxslt
make && make install
## 创建目录和用户,以及配置环境变量
groupadd postgres
useradd -g postgres postgres
## 密码设置在引号内输入自己的密码
echo “postgres” | passwd –stdin postgres
mkdir -p /data/pgdata/{data,archivedir}
chown -R postgres:postgres /usr/local/pgsql -R
chown postgres:postgres /data/pgdata -R
echo “export PATH=/usr/local/pgsql/12/bin:$PATH” >/etc/profile.d/pgsql.sh
source /etc/profile.d/pgsql.sh

展开全部

相关文章

说两句网友评论
    我要跟贴
    取消