##Postgresql數(shù)據(jù)庫(kù)的優(yōu)勢(shì) 1、目前功能最強(qiáng)大的開(kāi)源數(shù)據(jù)庫(kù) 2、穩(wěn)定可靠 3、開(kāi)源省錢(qián) 4、支持廣泛 5、Postgresql社區(qū)活躍 ##pg跟MySQL對(duì)比,mysql有以下缺點(diǎn) 1、功能不夠強(qiáng)大 2、性能優(yōu)化工具和度量信息不足 3、在線操作功能較弱 --安裝所需要的系統(tǒng)軟件包 yum groupinstall -y "Development tools" yum install -y bison flex readline-devel zlib-devel --編譯,size參數(shù)只能編譯時(shí)指定,后期無(wú)法更改 ./configure --prefix=/opt/pg10/ --with-pgport=1921 gmake world gmake install --安裝完成 --為方便管理,設(shè)置軟連接 [root@pgnode1 ~]# ln -s /opt/pg10/ /opt/pgsql --創(chuàng)建pg用戶(hù) groupadd -g 1000 postgres useradd -g 1000 -u 1000 -d /home/postgres -m postgres --創(chuàng)建相關(guān)目錄 [root@pgnode1 ~]# mkdir -p /pgdata/10/{data,backups,scripts,archive_wals} [root@pgnode1 ~]# chown -R postgres:postgres /pgdata/10/ [root@pgnode1 ~]# chmod 0700 /pgdata/10/data/ --初始化數(shù)據(jù)目錄(postgres用戶(hù)) /opt/pgsql/bin/initdb -D /pgdata/10/data/ -W --or /opt/pgsql/bin/pg_ctl init -D /pgdata/10/data/ -o "-W" --環(huán)境變量 export LD_LIBRARY_PATH=/opt/pgsql/lib export PGHOME=/opt/pgsql export PGDATA=/pgdata/10/data export PATH=$PGHOME/bin:$PATH --啟動(dòng) pg_ctl -D /pgdata/10/data/ start --or postgres -D /pgdata/10/data --測(cè)試數(shù)據(jù)庫(kù)是否允許連接 pg_isready -p 1921 --配置開(kāi)機(jī)自動(dòng)啟動(dòng) [postgres@pgnode1 start-scripts]$ pwd /pgbackup/postgresql-10.6/contrib/start-scripts [postgres@pgnode1 start-scripts]$ ls -l total 16 -rw-r--r-- 1 1107 1107 1467 Nov 6 05:45 freebsd -rw-r--r-- 1 1107 1107 3552 Nov 6 05:45 linux drwxrwxrwx 2 1107 1107 4096 Nov 6 05:58 macos drwxrwxrwx 2 1107 1107 4096 Nov 6 05:58 osx [postgres@pgnode1 start-scripts]$ --注意修改相關(guān)目錄 [postgres@pgnode1 start-scripts]$ cat linux |grep -v "#" |grep -v "^$" prefix=/opt/pgsql PGDATA="/pgdata/10/data" PGUSER=postgres PGLOG="$PGDATA/log" PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON="$prefix/bin/postmaster" PGCTL="$prefix/bin/pg_ctl" cp linux /etc/init.d/postgresql-10 chmod +x /etc/init.d/postgresql-10 chkconfig postgresql-10 on/off --ph_hba.conf 客戶(hù)端連接認(rèn)證, host all all 192.168.8.19/32 trust --修改需要重啟,或者重新加載 pg_ctl -D /pgdata/10/data reload --postgresql.conf 主要配置文件,資源限制、集群、文件位置等 alter system set listen_addresses='*'; --database級(jí)別 alter database name set configparameter to =; alter database name reset configparameter; --session 級(jí)別 set configparameter to ; set configparameter to default; --查看配置 select name,setting from pg_settings; --如果不需要重啟參數(shù),可以使用以下命令 select pg_reload_conf(); --查看監(jiān)聽(tīng)端口 [postgres@pgnode1 data]$ netstat -nlt |grep 1921 --連接 [postgres@pgnode1 data]$ netstat -nlt |grep 1921 tcp 0 0 192.168.8.19:1921 0.0.0.0:* LISTEN [postgres@pgnode1 data]$ psql -h 192.168.8.19 -p 1921 psql (10.6) Type "help" for help. postgres=# select version(); version --------------------------------------------------------------------------------------------------------- PostgreSQL 10.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit (1 row) postgres=#
分享文章:【PG安裝】postgresql10forlinux源碼安裝
文章起源:http://bm7419.com/article14/iehgge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、網(wǎng)站設(shè)計(jì)公司、網(wǎng)站策劃、外貿(mào)建站、服務(wù)器托管、云服務(wù)器
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)