欧美free性护士vide0shd,老熟女,一区二区三区,久久久久夜夜夜精品国产,久久久久久综合网天天,欧美成人护士h版

目錄

linux ubuntu環(huán)境下postgresql 12 數(shù)據(jù)庫安裝卸載及主從配置

很多情況下,都是權(quán)限原因?qū)е碌膱箦e,為了避免這類問題,需要切換幾次用戶。

完全卸載PG數(shù)據(jù)庫

sudo systemctl stop postgresql           ### 關(guān)閉數(shù)據(jù)庫服務(wù)

sudo systemctl status postgresql         ### 確認數(shù)據(jù)庫服務(wù)處于關(guān)閉狀態(tài)

sudo apt-get purge 'postgresql-*'        ### 卸載數(shù)據(jù)庫

sudo apt-get autoremove 'postgresql-*'   ### 卸載數(shù)據(jù)庫依賴包

sudo rm -r /etc/postgresql/              ### 刪除配置文件

sudo rm -r /etc/postgresql-common/       ### 刪除配置文件

sudo rm -r /var/lib/postgresql/          ### 刪除數(shù)據(jù)目錄

sudo userdel -r postgres                 ### 刪除用戶

sudo groupdel postgres                   ### 刪除用戶組

安裝PG數(shù)據(jù)庫并配置主從(主庫操作)

sudo apt install postgresql postgresql-contrib                          ### 安裝數(shù)據(jù)庫及其依賴包

sudo su root                                                            ### 切換權(quán)限為root

su postgres                                                             ### 切換權(quán)限為postgres

psql                                                                    ### 進入數(shù)據(jù)庫

ALTER USER postgres WITH PASSWORD 'postgres';                           ### 修改postgres用戶密碼

create role replica login replication encrypted password 'replica';     ### 創(chuàng)建replica用戶,用戶備庫訪問主庫

create user admin superuser password 'admin123';                        ### 創(chuàng)建超級用戶admin

exit                                                                    ### 退出數(shù)據(jù)庫

systemctl stop postgresql                                               ### 關(guān)閉數(shù)據(jù)庫服務(wù)

systemctl status postgresql                                             ### 確認數(shù)據(jù)庫服務(wù)處于關(guān)閉狀態(tài)

exit                                                                    ### 恢復(fù)權(quán)限為root

mkdir /opt/postgres/data -p                                             ### 創(chuàng)建數(shù)據(jù)存放目錄

rsync -av -progress /var/lib/postgresql/12/main/ /opt/postgres/data/    ### 同步數(shù)據(jù),避免操作影響原數(shù)據(jù)

mv /var/lib/postgresql /var/lib/postgresql.bak                          ### 備份數(shù)據(jù)

vim /etc/postgresql/12/main/postgresql.conf                             ### 修改PG數(shù)據(jù)庫配置文件

data_directory = ‘opt/postgres/data’

listen_addresses = ‘*’

wal_level = replica

max_wal_senders = 10

max_replication_slots = 10

wal_keep_segments = 64

archive_mode = on

archive_command = ‘cp %p /opt/postgresql/data/pg_archive/%f’

max_connections = 1000                                                  ### 從庫必須大于主庫

synchronous_commit = off

synchronous_standby_names = ‘*’

wal_sender_timeout = 60s

max_standby_streaming_delay = 30s

wal_receiver_status_interval = 10s

hot_standby_feedback = on

:wq                                                                     ### 保存并退出

mkdir -p /opt/postgresql/data/pg_archive                                ### 手動創(chuàng)建

chmod -R 750 /opt/postgresql/data/pg_archive                                                  ### 修改權(quán)限

vim /etc/postgresql/12/main/pg_hba.conf                                 ### 開啟遠程

host    replication     admin           *.*.*.*/32       trust      ###(此處*.*.*.*為從庫ip)

host    all             all             0.0.0.0/0               md5         

:wq                                                                     ### 保存并退出

systemctl start postgresql                                              ### 啟動PG數(shù)據(jù)庫

systemctl status postgresql                                             ### 查看數(shù)據(jù)庫狀態(tài)

systemctl enable postgresql                                             ### 開機自啟PG數(shù)據(jù)庫

安裝PG數(shù)據(jù)庫并配置主從(從庫操作)

sudo apt install postgresql postgresql-contrib                          ### 安裝數(shù)據(jù)庫及其依賴包

sudo su root                                                            ### 切換權(quán)限為root

su postgres                                                             ### 切換權(quán)限為postgres

psql                                                                    ### 進入數(shù)據(jù)庫

ALTER USER postgres WITH PASSWORD 'postgres';                          ### 修改postgres用戶密碼

exit                                                                    ### 退出數(shù)據(jù)庫

exit                                                                    ### 切換權(quán)限為root

systemctl stop postgresql                                               ### 關(guān)閉數(shù)據(jù)庫服務(wù)

systemctl status postgresql                                             ### 確認數(shù)據(jù)庫服務(wù)處于關(guān)閉狀態(tài)

mkdir /opt/postgres/data -p                                             ### 創(chuàng)建數(shù)據(jù)存放目錄

rsync -av -progress /var/lib/postgresql/12/main/ /opt/postgres/data/    ### 同步數(shù)據(jù),避免操作影響原數(shù)據(jù)

mv /var/lib/postgresql /var/lib/postgresql.bak                          ### 備份數(shù)據(jù)

rm -rf /opt/postgres/data/*                                             ### 清空從庫數(shù)據(jù)存儲文件夾

cd /opt/postgres/data                                                   ### 進去數(shù)據(jù)存儲目錄

su postgres                                                             ### 切換權(quán)限為postgres

pg_basebackup -h *.*.*.* -p 5432 -U admin  -Fp -Xs -Pv -R -D /opt/postgres/data      ###基礎(chǔ)備份(*.*.*.*位置根據(jù)實際情況輸入ip)

vim /opt/postgres/data/standby.signal

standby_mode='on'

:wq                                                                     ### 保存并退出

vim /etc/postgresql/12/main/postgresql.conf                             ### 編輯配置文件

data_directory = '/opt/postgres/data/'

primary_conninfo = 'host=*.*.*.* port=5432 user=admnin password=admin123'

recovery_target_timeline = 'latest'

max_connections = 1500

hot_standby = on

max_standby_streaming_delay = 30s

wal_receiver_status_interval = 10s

hot_standby_feedback = on

:wq                                                                     ### 保存并退出

vim /etc/postgresql/12/main/pg_hba.conf

host    all             all             0.0.0.0/0               md5         

:wq                                                                     ### 保存并退出

exit                                                                    ### 切換權(quán)限為root

systemctl restart postgresql                                            ### 重啟PG數(shù)據(jù)庫

systemctl enable postgresql                                             ### 開機自啟PG數(shù)據(jù)庫

參考                        

評論可見,查看隱藏內(nèi)容


本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點和立場。

轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。

本文鏈接:http://m.gantiao.com.cn/post/18428537.html

發(fā)布評論

您暫未設(shè)置收款碼

請在主題配置——文章設(shè)置里上傳

掃描二維碼手機訪問

文章目錄