溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

CentOS 7 安裝 postgreSQL 9.4

發(fā)布時間:2020-07-11 10:50:36 來源:網(wǎng)絡 閱讀:1501 作者:紫色葡萄 欄目:數(shù)據(jù)庫

CentOS 7倉庫中的postgresql軟件包太老,我們希望從postgresql 官方獲取支持,尤其是關于postgresql 集群方面的支持,比如pgpool 。


安裝postgresql 9.4

yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-2.noarch.rpm 
yum install postgresql-9.4-server


初始化數(shù)據(jù)庫

mkdir -p /data/pgsql
chmod 755 /data
chmod 755 /data/pgsql
chown -R postgres:postgres /data/pgsql
sudo -u postgres /usr/pgsql-9.4/bin/initdb -D /data/pgsql --encoding='UTF8' --locale='zh_CN.UTF-8' --lc-collate='zh_CN.UTF-8' --lc-ctype='zh_CN.UTF-8'


創(chuàng)建文件/etc/systemd/system/postgresql-9.4.service ,

touch /etc/systemd/system/postgresql-9.4.service

內容如下

.include /usr/lib/systemd/system/postgresql-9.4.service
[Service]
Environment=PGPORT=5432
Environment=PGDATA=/data/pgsql

啟動postgresql

systemctl daemon-reload
systemctl enable postgresql-9.4
systemctl start postgresql-9.4


設置postgres用戶密碼

psql -U postgres
alter user postgres with password '123456';


主要的性能參數(shù)

shared_buffers = 4GB    #物理內存的1/4左右,不超過8G
work_mem = 32MB       #work_mem * max_connections 不超過物理內存
max_connections = 500    #最大連接數(shù)
maintenance_work_mem = 256MB
effective_cache_size = 8GB  #能夠使用的最大緩存,建議物理內存1/2
fsync = on  #是否強制刷寫硬盤,on開啟可防止數(shù)據(jù)丟失,off關閉,性能會更好。
向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI