zoukankan      html  css  js  c++  java
  • Centos8安装PostgreSQL

    一、前言

    官网地址:https://www.postgresql.org/download/linux/redhat/

    二、安装

    # Install the repository RPM:
    sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
    
    # Disable the built-in PostgreSQL module:
    sudo dnf -qy module disable postgresql
    
    # Install PostgreSQL:
    sudo dnf install -y postgresql13-server
    
    # Optionally initialize the database and enable automatic start:
    sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
    sudo systemctl enable postgresql-13
    sudo systemctl start postgresql-13

    过程中如果出现错误,请执行:sudo dnf install wget


    三、配置

    # 切换成 postgres 用户
    sudo -i -u postgres
    password


    四、远程访问

    cd /var/lib/pgsql/13/data
    vim pg_hba.conf

    1、修改pg_hba.conf,添加一行到IPv4

    host    all             all             0.0.0.0/0            scram-sha-256

    2、修改postgresql.conf

      取消#listen_addresses = 'localhost'注释

      修改为listen_addresses = '*'

    3、重启

    systemctl restart postgresql-13.service 

    五、其他

    1.查看当前连接数

    select count(1) from pg_stat_activity;

    2.查看最大连接数

    show max_connections;

    3.设置最大连接数

    cd /var/lib/pgsql/13/data

    vim postgresql.conf

    max_connections = 1000

    作者: jamesbing
    提示: 欢迎转载,但是必须保留本文的署名 jamesbing (包含链接)
  • 相关阅读:
    第一次作业:阅读与准备作业
    第一阶段意见总结
    第一冲刺阶段总结与评审
    第一冲刺阶段总结
    第一冲刺阶段第七天
    第一冲刺阶段第六天
    第一冲刺阶段第五天
    第一冲刺阶段第四天
    第一冲刺阶段第三天
    第一冲刺阶段第二天
  • 原文地址:https://www.cnblogs.com/gaobing/p/14697356.html
Copyright © 2011-2022 走看看