日本三级片在线观看视频_西西大胆午夜人体视频无码_少妇无码一区二区_亚洲天堂超碰_极品少妇被猛的白浆直流_91精品云霸高清中文字幕_草草五月天伊人_久久少妇无码专区_欧美激欧美啪啪5老太_日韩在线在线成人

opengauss更改數(shù)據(jù)目錄位置

2025-12-12 11:07:00 398

opengauss更改數(shù)據(jù)目錄位置

 

歡迎來到藍(lán)隊云技術(shù)小課堂,每天分享一個技術(shù)小知識。

一、概述

有時我們部署完數(shù)據(jù)庫,發(fā)現(xiàn)隨著數(shù)據(jù)量的不斷增加,數(shù)據(jù)目錄所在的磁盤大小不能夠滿足我們的需求,需要更大的磁盤空間,這時選擇重新部署數(shù)據(jù)庫會很麻煩,之前所使用的數(shù)據(jù)庫還需要重新導(dǎo)入,這里介紹將數(shù)據(jù)庫目錄更改到別的位置的方法,不建議生產(chǎn)環(huán)境使用,建議測試環(huán)境使用。

二、更改過程

1、查看數(shù)據(jù)目錄位置

gsql -d postgres -p26000 -r

show data_directory ;

        data_directory

-------------------------------

 /opt/huawei/install/data/dn01

(1 row)

2、更改數(shù)據(jù)庫位置

postgres=# alter system set data_directory='/opt/data';     ==>更改數(shù)據(jù)目錄位置

NOTICE:  please restart the database for the POSTMASTER level parameter to take effect.

ALTER SYSTEM SET

postgres=# show data_directory ;    ==>這個參數(shù)需要重啟數(shù)據(jù)庫生效

 data_directory

-----------------

 /opt/mogdb/data

(1 row)

3、停止數(shù)據(jù)庫更改目錄

gs_ctl stop -D /opt/huawei/install/data/dn01/      

#本機(jī)采取二進(jìn)制方式部署,采用標(biāo)準(zhǔn)安裝可的使用gs_om -t stop 停止


mkdir -p /opt/data ==>創(chuàng)建新的數(shù)據(jù)目錄

cd /opt/data/

cp -r /opt/huawei/install/data/dn01/* /opt/data/    ==>將原來數(shù)據(jù)目錄的數(shù)據(jù)拷貝到新的數(shù)據(jù)目錄下

chmod 0700 /opt/data         ==>將新的數(shù)據(jù)目錄賦予0700的權(quán)限,否則重啟數(shù)據(jù)庫會報錯

4、啟動數(shù)據(jù)庫

gs_ctl start -D /opt/data

gsql -d postgres -p26000 -r

postgres=# show data_directory ;      ==>更改成功

 data_directory

----------------

 /opt/data

(1 row)

藍(lán)隊云官網(wǎng)上擁有完善的技術(shù)支持庫可供參考,大家可自行查閱,更多技術(shù)問題,可以直接咨詢。同時,藍(lán)隊云整理了運(yùn)維必備的工具包免費(fèi)分享給大家使用,需要的朋友可以直接咨詢。

更多技術(shù)知識,藍(lán)隊云期待與你一起探索。


提交成功!非常感謝您的反饋,我們會繼續(xù)努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問題: