1. 현재 디렉토리 확인
renderaccount@ellord-Precision-T5600:/home2/data$ sudo -u postgres -i
postgres@ellord-Precision-T5600:~$ psql
psql (12.20 (Ubuntu 12.20-0ubuntu0.20.04.1))
Type "help" for help.
postgres=#
postgres=# show data_directory;
data_directory
-----------------------------
/var/lib/postgresql/12/main
(1 row)
postgres=#
2. postgresql 중지
renderaccount@ellord-Precision-T5600:/home3$ sudo service postgresql stop
renderaccount@ellord-Precision-T5600:/home3$
3. 새로운 위치 생성
renderaccount@ellord-Precision-T5600:/home3$ mkdir postgres-data
renderaccount@ellord-Precision-T5600:/home3$ sudo chown postgres:postgres postgres-data/
[sudo] renderaccount 암호:
renderaccount@ellord-Precision-T5600:/home3$ sudo chmod 700 postgres-data/
renderaccount@ellord-Precision-T5600:/home3$ ls -la
합계 36
drwxr-xr-x 6 renderaccount renderaccount 4096 10월 8 19:54 .
drwxr-xr-x 22 root root 4096 10월 8 19:30 ..
drwx------ 2 postgres postgres 4096 10월 8 19:54 postgres-data
4. 새로운 공간으로 데이터 이전
renderaccount@ellord-Precision-T5600:/home3$ sudo mv /var/lib/postgresql/12/main/ /home3/postgres-data/
renderaccount@ellord-Precision-T5600:/home3$
5. conf 파일 수정
root@ellord-Precision-T5600:/home3/postgres-data# cd /etc/postgresql/12/main/postgresql.conf
data_directory = '/home3/postgres-data/main'
6. PostgreSQL 서비스 시작
renderaccount@ellord-Precision-T5600:/home3$ sudo service postgresql start
renderaccount@ellord-Precision-T5600:/home3$ sudo service postgresql status
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor pr>
Active: active (exited) since Tue 2024-10-08 20:03:28 KST; 16s ago
Process: 12867 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 12867 (code=exited, status=0/SUCCESS)
10월 08 20:03:28 ellord-Precision-T5600 systemd[1]: Starting PostgreSQL RDBMS...
10월 08 20:03:28 ellord-Precision-T5600 systemd[1]: Finished PostgreSQL RDBMS.
lines 1-8/8 (END)
'Linux' 카테고리의 다른 글
ubuntu is not in the sudoers file. This incident will be reported. (0) | 2024.09.08 |
---|---|
ubuntu 에서 sudo 안될때. (0) | 2024.09.08 |
Selinux 기반에서 rsyncd Permission denied 발생시 (0) | 2022.05.14 |
리눅스 swapfile 추가 (0) | 2020.09.01 |
centos7 jdk1.7 설치하기, 자바버전선택 (0) | 2020.09.01 |