-
WAL-E 설치PostgreSQL 2019. 10. 11. 13:42
WAL-E 설치에 대해 설명한다.
설치
1.필수 라이브러리 설치
[bylee@localhost etc]$ sudo dnf install lzop pv [sudo] bylee의 암호: Last metadata expiration check: 2:21:31 ago on 2018년 08월 13일 (월) 오전 11시 03분 36초. Package lzop-1.03-20.fc28.x86_64 is already installed, skipping. Dependencies resolved. ========================================================================================================= Package Arch Version Repository Size ========================================================================================================= Installing: pv x86_64 1.6.6-3.fc27 fedora 62 k Transaction Summary ========================================================================================================= Install 1 Package Total download size: 62 k Installed size: 119 k Is this ok [y/N]: y 패키지 다운로드중: pv-1.6.6-3.fc27.x86_64.rpm 361 kB/s | 62 kB 00:00 --------------------------------------------------------------------------------------------------------- Total 44 kB/s | 62 kB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : pv-1.6.6-3.fc27.x86_64 1/1 Running scriptlet: pv-1.6.6-3.fc27.x86_64 1/1 Verifying : pv-1.6.6-3.fc27.x86_64 1/1 Installed: pv.x86_64 1.6.6-3.fc27 Complete!
2.파이썬 3.5 확인
[bylee@localhost etc]$ ll /usr/bin/python* lrwxrwxrwx. 1 root root 7 3월 15 01:46 /usr/bin/python -> python2 -rwxr-xr-x. 1 root root 254 8월 2 16:26 /usr/bin/python-argcomplete-check-easy-install-script -rwxr-xr-x. 1 root root 314 8월 2 16:26 /usr/bin/python-argcomplete-tcsh lrwxrwxrwx. 1 root root 9 3월 15 01:46 /usr/bin/python2 -> python2.7 -rwxr-xr-x. 1 root root 7600 3월 15 01:46 /usr/bin/python2.7 lrwxrwxrwx. 1 root root 9 3월 30 03:24 /usr/bin/python3 -> python3.6 -rwxr-xr-x. 1 root root 388 2월 13 22:49 /usr/bin/python3-chardetect -rwxr-xr-x. 1 root root 387 2월 13 05:38 /usr/bin/python3-coverage -rwxr-xr-x. 1 root root 396 4월 12 22:50 /usr/bin/python3-mako-render -rwxr-xr-x. 1 root root 392 2월 9 2018 /usr/bin/python3-pyinotify -rwxr-xr-x. 2 root root 11152 3월 30 03:24 /usr/bin/python3.6 -rwxr-xr-x. 2 root root 11152 3월 30 03:24 /usr/bin/python3.6m --파이썬 3.5 설치 [bylee@localhost wal-e]$ sudo dnf install python35 Last metadata expiration check: 1:49:12 ago on 2018년 08월 13일 (월) 오후 02시 06분 36초. Dependencies resolved. ========================================================================================================= Package Arch Version Repository Size ========================================================================================================= Installing: python35 x86_64 3.5.5-1.fc28 updates 19 M Installing dependencies: tk x86_64 1:8.6.8-1.fc28 fedora 1.6 M Transaction Summary ========================================================================================================= Install 2 Packages Total download size: 21 M Installed size: 87 M Is this ok [y/N]: y 패키지 다운로드중: (1/2): tk-8.6.8-1.fc28.x86_64.rpm 2.1 MB/s | 1.6 MB 00:00 (2/2): python35-3.5.5-1.fc28.x86_64.rpm 1.9 MB/s | 19 MB 00:09 --------------------------------------------------------------------------------------------------------- Total 1.7 MB/s | 21 MB 00:12 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: tk-1:8.6.8-1.fc28.x86_64 1/2 Installing : tk-1:8.6.8-1.fc28.x86_64 1/2 Running scriptlet: tk-1:8.6.8-1.fc28.x86_64 1/2 Installing : python35-3.5.5-1.fc28.x86_64 2/2 Running scriptlet: python35-3.5.5-1.fc28.x86_64 2/2 Verifying : python35-3.5.5-1.fc28.x86_64 1/2 Verifying : tk-1:8.6.8-1.fc28.x86_64 2/2 Installed: python35.x86_64 3.5.5-1.fc28 tk.x86_64 1:8.6.8-1.fc28 Complete! [bylee@localhost wal-e]$ ll /usr/bin/python* lrwxrwxrwx. 1 root root 7 3월 15 01:46 /usr/bin/python -> python2 -rwxr-xr-x. 1 root root 254 8월 2 16:26 /usr/bin/python-argcomplete-check-easy-install-script -rwxr-xr-x. 1 root root 314 8월 2 16:26 /usr/bin/python-argcomplete-tcsh lrwxrwxrwx. 1 root root 9 3월 15 01:46 /usr/bin/python2 -> python2.7 -rwxr-xr-x. 1 root root 7600 3월 15 01:46 /usr/bin/python2.7 lrwxrwxrwx. 1 root root 9 3월 30 03:24 /usr/bin/python3 -> python3.6 -rwxr-xr-x. 1 root root 388 2월 13 22:49 /usr/bin/python3-chardetect -rwxr-xr-x. 1 root root 387 2월 13 05:38 /usr/bin/python3-coverage -rwxr-xr-x. 1 root root 396 4월 12 22:50 /usr/bin/python3-mako-render -rwxr-xr-x. 1 root root 392 2월 9 2018 /usr/bin/python3-pyinotify -rwxr-xr-x. 2 root root 11720 4월 22 02:02 /usr/bin/python3.5 lrwxrwxrwx. 1 root root 17 4월 22 02:01 /usr/bin/python3.5-config -> python3.5m-config -rwxr-xr-x. 2 root root 11720 4월 22 02:02 /usr/bin/python3.5m -rwxr-xr-x. 1 root root 173 4월 22 02:02 /usr/bin/python3.5m-config -rwxr-xr-x. 1 root root 3779 4월 22 01:31 /usr/bin/python3.5m-x86_64-config -rwxr-xr-x. 2 root root 11152 3월 30 03:24 /usr/bin/python3.6 -rwxr-xr-x. 2 root root 11152 3월 30 03:24 /usr/bin/python3.6m lrwxrwxrwx. 1 root root 9 4월 22 02:01 /usr/bin/python35 -> python3.5
3.wal-e 설치
--3.5 버전에서 pip 오류 [bylee@localhost ~]$ sudo python3.5 -m pip install wal-e /usr/bin/python3.5: No module named pip [bylee@localhost ~]$ wget https://bootstrap.pypa.io/get-pip.py --2018-08-13 16:37:33-- https://bootstrap.pypa.io/get-pip.py Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.0.175, 151.101.64.175, 151.101.128.175, ... Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.0.175|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1642522 (1.6M) [text/x-python] Saving to: ‘get-pip.py’ get-pip.py 100%[=====================================>] 1.57M 914KB/s in 1.8s 2018-08-13 16:37:35 (914 KB/s) - ‘get-pip.py’ saved [1642522/1642522] [bylee@localhost ~]$ ll 합계 1648 -rw-rw-r--. 1 bylee bylee 1642522 7월 22 19:30 get-pip.py drwxrwxr-x. 6 bylee bylee 4096 8월 13 13:56 install drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 공개 drwxr-xr-x. 2 bylee bylee 4096 8월 2 09:31 다운로드 drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 문서 drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 바탕화면 drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 비디오 drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 사진 drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 서식 drwxr-xr-x. 2 bylee bylee 4096 8월 1 09:42 음악 [bylee@localhost ~]$ sudo python3.5 get-pip.py [sudo] bylee의 암호: Collecting pip Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl Collecting setuptools Downloading https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB) 100% |████████████████████████████████| 573kB 767kB/s Collecting wheel Downloading https://files.pythonhosted.org/packages/81/30/e935244ca6165187ae8be876b6316ae201b71485538ffac1d718843025a9/wheel-0.31.1-py2.py3-none-any.whl (41kB) 100% |████████████████████████████████| 51kB 1.5MB/s Installing collected packages: pip, setuptools, wheel Successfully installed pip-18.0 setuptools-40.0.0 wheel-0.31.1 [bylee@localhost ~]$ [bylee@localhost ~]$ sudo python3.5 -m pip install wal-e Collecting wal-e Using cached https://files.pythonhosted.org/packages/d6/73/b210a8900d4fc8ef4e5b919f96358cdddcb2b909fcd81bf673b3c7f08aa6/wal-e-1.1.0.tar.gz Collecting gevent>=1.1.1 (from wal-e) Downloading https://files.pythonhosted.org/packages/6c/c3/55290480d3c992fbe563478e302fb0bf228ccca398174de6cca3dff9d11c/gevent-1.3.5-cp35-cp35m-manylinux1_x86_64.whl (4.5MB) 100% |████████████████████████████████| 4.5MB 4.0MB/s Collecting greenlet>=0.4.13; platform_python_implementation == "CPython" (from gevent>=1.1.1->wal-e) Downloading https://files.pythonhosted.org/packages/e0/69/3cd1d75ccf1e38f9cd701833daecd3c5ac5de949653b559cee735e4ad4cd/greenlet-0.4.14-cp35-cp35m-manylinux1_x86_64.whl (41kB) 100% |████████████████████████████████| 51kB 5.9MB/s Building wheels for collected packages: wal-e Running setup.py bdist_wheel for wal-e ... done Stored in directory: /root/.cache/pip/wheels/57/fb/a2/aacb17a42cdf5753b8ee144cb588572419f5d17a925e47a034 Successfully built wal-e Installing collected packages: greenlet, gevent, wal-e Successfully installed gevent-1.3.5 greenlet-0.4.14 wal-e-1.1.0 --wal-e 설치 확인 [bylee@localhost wal-e]$ wal-e version 1.1.0
4.wal backup
postgresql.conf 수정 archive_command = 'wal-e --file-prefix=file://localhost//home/bylee/install/wal-e wal-push %p' archive_mode = on wal_level = archive archive_timeout = 60 --또는 wal 파일을 개별적으로 backup [bylee@localhost wal-e1]$ wal-e --file-prefix=file://localhost//home/bylee/install/wal-e/wal-e1 wal-push /home/bylee/install/agensgraph/data/pg_wal/000000010000000000000008
5.backup
--DB 서버 시작 [bylee@localhost wal-e]$ wal-e --file-prefix=file://localhost/home/bylee/install/wal-e backup-push /home/bylee/install/agensgraph/data wal_e.main INFO MSG: starting WAL-E DETAIL: The subcommand is "backup-push". STRUCTURED: time=2018-08-13T07:40:16.350270-00 pid=16226 wal_e.operator.backup INFO MSG: start upload postgres version metadata DETAIL: Uploading to file://localhost/home/bylee/install/wal-e/basebackups_005/base_00000001000000000000000E_00000040/extended_version.txt. STRUCTURED: time=2018-08-13T07:40:16.704758-00 pid=16226 wal_e.operator.backup INFO MSG: postgres version metadata upload complete STRUCTURED: time=2018-08-13T07:40:16.720363-00 pid=16226 wal_e.worker.upload INFO MSG: beginning volume compression DETAIL: Building volume 0. STRUCTURED: time=2018-08-13T07:40:16.899992-00 pid=16226 wal_e.worker.upload INFO MSG: begin uploading a base backup volume DETAIL: Uploading to "file://localhost/home/bylee/install/wal-e/basebackups_005/base_00000001000000000000000E_00000040/tar_partitions/part_00000000.tar.lzo". STRUCTURED: time=2018-08-13T07:40:17.593995-00 pid=16226 wal_e.worker.upload INFO MSG: finish uploading a base backup volume DETAIL: Uploading to "file://localhost/home/bylee/install/wal-e/basebackups_005/base_00000001000000000000000E_00000040/tar_partitions/part_00000000.tar.lzo" complete at 42203.2KiB/s. STRUCTURED: time=2018-08-13T07:40:17.699700-00 pid=16226 NOTICE: pg_stop_backup complete, all required WAL segments have been archived
6.backup 확인
[bylee@localhost wal-e]$ wal-e --file-prefix=file://localhost/home/bylee/install/wal-e backup-list wal_e.main INFO MSG: starting WAL-E DETAIL: The subcommand is "backup-list". STRUCTURED: time=2018-08-13T07:40:27.222212-00 pid=16259 name last_modified expanded_size_bytes wal_segment_backup_start wal_segment_offset_backup_start wal_segment_backup_stop wal_segment_offset_backup_stop base_00000001000000000000000E_00000040 2018-08-13T07:40:18.856293 00000001000000000000000E00000040
7.restore
--최신 버전 restore $ wal-e --file-prefix=file://localhost/home/bylee/install/wal-e backup-fetch /home/bylee/install/agensgraph/data1 LATEST --또는 특정 버전 restore [bylee@localhost wal-e]$ wal-e --file-prefix=file://localhost/home/bylee/install/wal-e backup-fetch /home/bylee/install/agensgraph/data1 base_00000001000000000000000E_00000040 wal_e.main INFO MSG: starting WAL-E DETAIL: The subcommand is "backup-fetch". STRUCTURED: time=2018-08-13T07:49:59.539913-00 pid=16481 wal_e.worker.file.file_worker INFO MSG: beginning partition download DETAIL: The partition being downloaded is part_00000000.tar.lzo. HINT: The absolute file key is home/bylee/install/wal-e/basebackups_005/base_00000001000000000000000E_00000040/tar_partitions/part_00000000.tar.lzo. STRUCTURED: time=2018-08-13T07:49:59.649787-00 pid=16481 [bylee@localhost wal-e]$
8.conf 파일이 없으므로 복사하거나 새로 생성한다.
--나는 복사해서 conf 파일을 만들었다. [bylee@localhost data1]$ cp ../data/pg_hba.conf . [bylee@localhost data1]$ cp ../data/pg_ident.conf . [bylee@localhost data1]$ cp postgresql.auto.conf postgresql.conf
9.wal restore
$ vi recovery.conf restore_command = 'wal-e --file-prefix=file://localhost/home/bylee/install/wal-e wal-fetch %f %p'
10.DB start
[bylee@localhost agensgraph]$ pg_ctl -D data1 start waiting for server to start..... done server started
11. restore 확인
[bylee@localhost agensgraph]$ psql -d postgres agens (AgensGraph 1.4devel, based on PostgreSQL 10.3) Type "help" for help. postgres=# match (n) return n; n ------------------------- v[3.1]{"name": "bylee"} (1 row)
'PostgreSQL' 카테고리의 다른 글
pgBouncer 설치 (0) 2019.10.11 PostgreSQL 백업 도구 비교 (0) 2019.10.11 pgBackRest 설치 (0) 2019.10.11 Barman 설치 (0) 2019.10.11 temboard에 대하여(작성필요) (0) 2019.08.12