|
|
<!doctype html>
|
|
|
<html class="no-js" lang="tw">
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
<meta name="author" content="Eric Chang">
|
|
|
<meta name="description" content="What’s the Worst That Could Happen?">
|
|
|
<meta name="keywords" content="linux,blog,responsive,search,font awesome,pages,posts,multilingual,highlight.js,syntax highlighting,premium,shortcuts">
|
|
|
<meta content="postgresql, pgbackrest" name="keywords">
|
|
|
<meta name="generator" content="Hugo 0.50" />
|
|
|
<title> [筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest | MCの飄狂山莊㊣</title>
|
|
|
<meta name="description" content="[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest - What’s the Worst That Could Happen?">
|
|
|
<meta itemprop="name" content="[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest">
|
|
|
<meta itemprop="description" content="[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest - What’s the Worst That Could Happen?">
|
|
|
<meta property="og:title" content="[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest">
|
|
|
<meta property="og:description" content="[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest - What’s the Worst That Could Happen?">
|
|
|
<meta property="og:image" content="https://h.cowbay.org/images/post-default-11.jpg">
|
|
|
<meta property="og:url" content="https://h.cowbay.org/post/backup-restore-postgresql-with-pgbackrest/">
|
|
|
<meta property="og:site_name" content="MCの飄狂山莊㊣">
|
|
|
<meta property="og:type" content="article">
|
|
|
<link rel="icon" type="image/png" href="https://h.cowbay.org/favicon-32x32.png" sizes="32x32">
|
|
|
<link rel="icon" type="image/png" href="https://h.cowbay.org/favicon-16x16.png" sizes="16x16">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://h.cowbay.org/sass/combined.min.a89dfa577f701bffe9659f476ef61241cb2a3452b913e793463b0074a10c0a59.css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
|
|
|
|
|
|
|
</head>
|
|
|
<body class="bilberry-hugo-theme">
|
|
|
|
|
|
<nav class="permanentTopNav">
|
|
|
|
|
|
<div class="container">
|
|
|
<ul class="topnav">
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
<div id="search-box" class="search">
|
|
|
<i class="fa fa-search"></i>
|
|
|
<input id="search" type="text" placeholder="">
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
<header>
|
|
|
<div class="container">
|
|
|
<div class="logo">
|
|
|
<a href="/" class="logo">
|
|
|
|
|
|
<img src="https://www.gravatar.com/avatar/e4eb1f8e016ffb73e9889f87d16e15f0?d=mm&size=200" alt="">
|
|
|
|
|
|
|
|
|
<span class="overlay"><i class="fa fa-home"></i></span>
|
|
|
</a>
|
|
|
</div>
|
|
|
<div class="titles">
|
|
|
<h3 class="title"><a href="/">MCの飄狂山莊㊣</a></h3>
|
|
|
|
|
|
<span class="subtitle">What’s the Worst That Could Happen?</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="toggler permanentTopNav">
|
|
|
|
|
|
<i class="fa fa-bars" aria-hidden="true"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
<div class="main container">
|
|
|
|
|
|
|
|
|
<div class="article-wrapper u-cf single">
|
|
|
|
|
|
<a class="bubble" href="/post/backup-restore-postgresql-with-pgbackrest/">
|
|
|
<i class="fa fa-fw fa-pencil"></i>
|
|
|
</a>
|
|
|
|
|
|
<article class="default article">
|
|
|
|
|
|
<div class="featured-image">
|
|
|
<a href="/post/backup-restore-postgresql-with-pgbackrest/">
|
|
|
<img src="/images/post-default-11.jpg" alt="">
|
|
|
</a>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
<h3><a href="/post/backup-restore-postgresql-with-pgbackrest/">[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest</a></h3>
|
|
|
<div class="meta">
|
|
|
|
|
|
|
|
|
<span class="date moment">2019-09-05</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="categories">
|
|
|
|
|
|
<a href="/categories/%E7%AD%86%E8%A8%98">筆記</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="author"><a href="/author/eric-chang">Eric Chang</a></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<p>這兩天在測試pgbackrest ,簡單筆記一下測試狀況</p>
|
|
|
|
|
|
<p></p>
|
|
|
|
|
|
<h4 id="install">install</h4>
|
|
|
|
|
|
<p>在ubuntu 18.04 安裝pgbackrest 很簡單,內建在apt裡面,所以可以直接用</p>
|
|
|
|
|
|
<pre><code>sudo apt install pgbackrest
|
|
|
</code></pre>
|
|
|
|
|
|
<p>進行安裝</p>
|
|
|
|
|
|
<h4 id="config">config</h4>
|
|
|
|
|
|
<p>pgbackrest 的設定檔在 /etc/pgbackrest/pgbackrest.conf
|
|
|
如果是用apt 安裝,預設會建立一個 /etc/pgbackrest.conf
|
|
|
但是這個路徑是錯誤的
|
|
|
執行 pgbackrest的時候,預設還是會去讀取 /etc/pgbackrest/pgbackrest.conf
|
|
|
要特別注意,要不就是每次都指定config路徑,要不就是把那個錯誤的設定檔幹掉</p>
|
|
|
|
|
|
<h4 id="config-內容">config 內容</h4>
|
|
|
|
|
|
<p>內容其實很簡單</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc039:~$ cat /etc/pgbackrest/pgbackrest.conf
|
|
|
[demo]
|
|
|
pg1-path=/database/11/main
|
|
|
|
|
|
[global]
|
|
|
repo1-cipher-pass=zWaf6XtpjIVZC5444yXB+cgFDFl7MxGlgkZSaoPvTGirhPygu4jOKOXf9LO4vjfO
|
|
|
repo1-cipher-type=aes-256-cbc
|
|
|
repo1-path=/var/lib/pgbackrest
|
|
|
repo1-retention-full=2
|
|
|
|
|
|
[global:archive-push]
|
|
|
compress-level=3
|
|
|
process-max=4
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>[demo]</strong> 用來指定這個 “stanza” 的名稱
|
|
|
* pg1-path 是資料庫存放的路徑</p>
|
|
|
|
|
|
<p><strong>[global]</strong> 中的兩個cipher 用途我不清楚,不設定也沒關係</p>
|
|
|
|
|
|
<ul>
|
|
|
<li>“repo1-path” 則是用來存放備份的路徑</li>
|
|
|
<li>“repo1-retention-full” 定義要保留幾次 full backup</li>
|
|
|
</ul>
|
|
|
|
|
|
<p><strong>[global:archive-push]</strong> 似乎是用來定義在備份/還原時的選項
|
|
|
* process-max 指定要用多少process (平行處理)</p>
|
|
|
|
|
|
<h4 id="簡單流程">簡單流程</h4>
|
|
|
|
|
|
<ul>
|
|
|
<li>config (pgbackrest & postgresql )</li>
|
|
|
<li>建立 stanza</li>
|
|
|
<li>建立備份</li>
|
|
|
<li>(還原,如果有需要的話)</li>
|
|
|
</ul>
|
|
|
|
|
|
<h4 id="其他部份">其他部份</h4>
|
|
|
|
|
|
<ul>
|
|
|
<li>清除 stanza (刪除備份)</li>
|
|
|
<li>踩到的地雷</li>
|
|
|
</ul>
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<h4 id="設定-pgbackrest-postgresql">設定 pgbackrest & postgresql</h4>
|
|
|
|
|
|
<p>pgbackrest 基本上設定很簡單,內容就跟上面的一樣就可以跑了。
|
|
|
當然要新增其他進階的,就要自己研究了,內容有夠長
|
|
|
<a href="https://pgbackrest.org/configuration.html">https://pgbackrest.org/configuration.html</a></p>
|
|
|
|
|
|
<p>在postgresql 中,要新增一些設定,主要是 archive_command</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc039:~$ grep -A 100 "for pgbackrest" /etc/postgresql/11/main/postgresql.conf
|
|
|
#for pgbackrest
|
|
|
archive_command = 'pgbackrest --stanza=demo archive-push %p'
|
|
|
archive_mode = on
|
|
|
listen_addresses = '*'
|
|
|
log_line_prefix = ''
|
|
|
max_wal_senders = 3
|
|
|
wal_level = replica
|
|
|
postgres@hqdc039:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>archive_command</strong>
|
|
|
這個因為要帶stanza 名稱進來,所以<strong>需要跟pgbackrest.conf 裡面定義的名稱一致</strong></p>
|
|
|
|
|
|
<p><strong>max_wal_senders</strong>
|
|
|
簡單說就是定義在抄寫wal 的時候,可以同時抄給幾台
|
|
|
這是postgresql 的說明</p>
|
|
|
|
|
|
<pre><code>the maximum number of simultaneously running WAL sender processes
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>wal_level</strong>
|
|
|
有三種等級,參考 <a href="https://blog.csdn.net/pg_hgdb/article/details/78666719">https://blog.csdn.net/pg_hgdb/article/details/78666719</a></p>
|
|
|
|
|
|
<ul>
|
|
|
<li>minimal –不能通过基础备份和wal日志恢复数据库。</li>
|
|
|
<li>replica = 9.6版本以前的archive和hot_standby –该级别支持wal归档和复制。</li>
|
|
|
<li>logical –在replica级别的基础上添加了支持逻辑解码所需的信息。</li>
|
|
|
</ul>
|
|
|
|
|
|
<p>設定完成後,重起 postgresql 就可以了</p>
|
|
|
|
|
|
<h4 id="建立-stanza">建立 stanza</h4>
|
|
|
|
|
|
<p>stanza 這名詞我是第一次聽到,直接翻譯就是 <strong>”“(詩的)節,段”</strong></p>
|
|
|
|
|
|
<p><a href="https://dictionary.cambridge.org/zht/%E8%A9%9E%E5%85%B8/%E8%8B%B1%E8%AA%9E-%E6%BC%A2%E8%AA%9E-%E7%B9%81%E9%AB%94/stanza">https://dictionary.cambridge.org/zht/%E8%A9%9E%E5%85%B8/%E8%8B%B1%E8%AA%9E-%E6%BC%A2%E8%AA%9E-%E7%B9%81%E9%AB%94/stanza</a></p>
|
|
|
|
|
|
<p>在pgbackrest中,可以一次定義多個 stanza,用來備份不同的DB
|
|
|
這次環境很簡單,所以就只有設定一個
|
|
|
依照上面的pgbackrest.conf 內容設定好了,需要先建立這個stanza
|
|
|
指令:</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo stanza-create --log-level-console=detail
|
|
|
2019-09-04 16:21:40.700 P00 INFO: stanza-create command begin 2.16: --log-level-console=detail --pg1-path=/database/11/main --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/var/lib/pgbackrest --stanza=demo
|
|
|
2019-09-04 16:21:41.525 P00 INFO: stanza-create command end: completed successfully (825ms)
|
|
|
postgres@hqdc039:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>接著就可以執行備份了</p>
|
|
|
|
|
|
<h4 id="backup">backup</h4>
|
|
|
|
|
|
<p>備份指令也很簡單,要注意的是,如果不帶參數,pgbackrest 會自行決定要用incremental或者是 full backup</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo --log-level-console=detail backup
|
|
|
2019-09-04 16:41:17.458 P00 INFO: backup command begin 2.16: --log-level-console=detail --pg1-path=/database/11/main --repo1-cipher-pass=<redacted> --repo1-cipher-type=aes-256-cbc --repo1-path=/var/lib/pgbackrest --repo1-retention-full=2 --stanza=demo
|
|
|
2019-09-04 16:41:17.697 P00 INFO: last backup label = 20190904-134245F, version = 2.16
|
|
|
2019-09-04 16:41:18.607 P00 INFO: execute non-exclusive pg_start_backup() with label "pgBackRest backup started at 2019-09-04 16:41:17": backup begins after the next regular checkpoint completes
|
|
|
2019-09-04 16:41:19.008 P00 INFO: backup start archive = 000000100000000E0000004A, lsn = E/4A000028
|
|
|
WARN: a timeline switch has occurred since the last backup, enabling delta checksum
|
|
|
2019-09-04 16:41:21.213 P01 DETAIL: match file from prior backup /database/11/main/base/51435/51488 (546.3MB, 20%) checksum 5eb4f73d9b1c535ebfdfb622d930dade87e23786
|
|
|
2019-09-04 16:41:21.821 P01 DETAIL: match file from prior backup /database/11/main/base/51435/51460 (455.3MB, 37%) checksum aa74bba2bea8823789ad4194e4574b44a020271a
|
|
|
...
|
|
|
...
|
|
|
...
|
|
|
|
|
|
2019-09-04 16:41:24.827 P01 DETAIL: match file from prior backup /database/11/main/PG_VERSION (3B, 100%) checksum dd71038f3463f511ee7403dbcbc87195302d891c
|
|
|
2019-09-04 16:41:24.835 P01 INFO: backup file /database/11/main/base/13125/51569 (0B, 100%)
|
|
|
2019-09-04 16:41:24.860 P00 INFO: incr backup size = 2.5GB
|
|
|
2019-09-04 16:41:24.860 P00 INFO: execute non-exclusive pg_stop_backup() and wait for all WAL segments to archive
|
|
|
2019-09-04 16:41:24.961 P00 INFO: backup stop archive = 000000100000000E0000004A, lsn = E/4A000130
|
|
|
2019-09-04 16:41:24.964 P00 DETAIL: wrote 'pg_data/backup_label' file returned from pg_stop_backup()
|
|
|
2019-09-04 16:41:25.155 P00 INFO: new backup label = 20190904-134245F_20190904-164117I
|
|
|
2019-09-04 16:41:25.194 P00 INFO: backup command end: completed successfully (7736ms)
|
|
|
2019-09-04 16:41:25.194 P00 INFO: expire command begin
|
|
|
2019-09-04 16:41:25.214 P00 INFO: full backup total < 2 - using oldest full backup for 11-1 archive retention
|
|
|
2019-09-04 16:41:25.214 P00 DETAIL: archive retention on backup 20190904-134245F, archiveId = 11-1, start = 0000000D0000000E00000048
|
|
|
2019-09-04 16:41:25.215 P00 DETAIL: no archive to remove, archiveId = 11-1
|
|
|
2019-09-04 16:41:25.215 P00 INFO: expire command end: completed successfully (21ms)
|
|
|
postgres@hqdc039:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>執行後,可以檢查一下</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo --log-level-console=info info
|
|
|
stanza: demo
|
|
|
status: ok
|
|
|
cipher: aes-256-cbc
|
|
|
|
|
|
db (current)
|
|
|
wal archive min/max (11-1): 0000000D0000000E00000048/000000100000000E0000004A
|
|
|
|
|
|
full backup: 20190904-134245F
|
|
|
timestamp start/stop: 2019-09-04 13:42:45 / 2019-09-04 13:48:54
|
|
|
wal start/stop: 0000000D0000000E00000048 / 0000000D0000000E00000048
|
|
|
database size: 2.6GB, backup size: 2.6GB
|
|
|
repository size: 547MB, repository backup size: 547MB
|
|
|
|
|
|
incr backup: 20190904-134245F_20190904-164117I
|
|
|
timestamp start/stop: 2019-09-04 16:41:17 / 2019-09-04 16:41:25
|
|
|
wal start/stop: 000000100000000E0000004A / 000000100000000E0000004A
|
|
|
database size: 2.6GB, backup size: 2.2MB
|
|
|
repository size: 547MB, repository backup size: 220.4KB
|
|
|
backup reference list: 20190904-134245F
|
|
|
postgres@hqdc039:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="還原測試">還原測試</h4>
|
|
|
|
|
|
<p>pgbackrest 的還原因為透過WAL ,所以有一些觀念需要先釐清
|
|
|
本來我的測試是先做好備份,然後直接砍掉 DB,接著再用restore還原
|
|
|
卻發現砍掉的DB居然沒有回來..
|
|
|
後來看了這一篇,然後又研究了一下 <strong>Point-in-Time Recovery</strong>
|
|
|
<a href="https://github.com/pgbackrest/pgbackrest/issues/800">https://github.com/pgbackrest/pgbackrest/issues/800</a>
|
|
|
才找到正確的用法</p>
|
|
|
|
|
|
<p>先把DB整個砍掉</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc034:/zp/database$ time dropdb demo
|
|
|
</code></pre>
|
|
|
|
|
|
<p>然後停止postgresql 服務</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc034:/zp/database$ pg_ctlcluster 10 main stop
|
|
|
sudo systemctl stop postgresql@10-main
|
|
|
</code></pre>
|
|
|
|
|
|
<p>接著就可以來下指令還原了</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc034:/zp/database$ time pgbackrest --stanza=demo --log-level-console=info --delta --type=time "--target=2019-09-05 11:00:00.268248+08" --target-action=promote restore
|
|
|
2019-09-05 11:15:57.480 P00 INFO: restore command begin 2.13: --delta --log-level-console=info --pg1-path=/zp/database/10/main --process-max=4 --repo1-path=/var/lib/pgbackrest --stanza=demo --target="2019-09-05 11:00:00.268248+08" --target-action=promote --type=time
|
|
|
2019-09-05 11:15:57.624 P00 INFO: restore backup set 20190905-111109F
|
|
|
2019-09-05 11:15:57.947 P00 INFO: remove invalid files/paths/links from /zp/database/10/main
|
|
|
2019-09-05 11:16:00.440 P01 INFO: restore file /zp/database/10/main/global/pg_control.pgbackrest.tmp (8KB, 99%) checksum e253f9d706ac59e1ec0408ba477d1d5bac41b20f
|
|
|
2019-09-05 11:16:00.791 P00 INFO: write /zp/database/10/main/recovery.conf
|
|
|
2019-09-05 11:16:00.797 P00 INFO: restore global/pg_control (performed last to ensure aborted restores cannot be started)
|
|
|
2019-09-05 11:16:00.800 P00 INFO: restore command end: completed successfully (3321ms)
|
|
|
|
|
|
real 0m3.328s
|
|
|
user 0m6.896s
|
|
|
sys 0m0.832s
|
|
|
</code></pre>
|
|
|
|
|
|
<p>在DB目錄中,會產生一個recovery.conf,這是用來給 postgresql 看的檔案,裡面會紀錄怎麼還原、以及還原的類型、時間點,這邊指定要恢復到 <strong><em>2019-09-05 11:00:00.268248+08</em></strong>
|
|
|
這個時間格式要看資料庫的設定,可以藉由以下指令得到</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc034:/zp/database$ psql -Atc "select current_timestamp"
|
|
|
2019-09-05 11:14:27.268248+08
|
|
|
</code></pre>
|
|
|
|
|
|
<p>檢查一下recovery.conf</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc034:/zp/database$ cat /zp/database/10/main/recovery.conf
|
|
|
restore_command = 'pgbackrest --log-level-console=info --stanza=demo archive-get %f "%p"'
|
|
|
recovery_target_time = '2019-09-05 11:00:00.268248+08'
|
|
|
recovery_target_action = 'promote'
|
|
|
</code></pre>
|
|
|
|
|
|
<p>重新啟動postgresql 然後看看被砍掉的demo DB有沒有回來</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc034:/zp/database$ pg_ctlcluster 10 main start
|
|
|
Warning: the cluster will not be running as a systemd service. Consider using systemctl:
|
|
|
sudo systemctl start postgresql@10-main
|
|
|
postgres@hqdc034:/zp/database$ psql
|
|
|
psql (10.8 (Ubuntu 10.8-1.pgdg14.04+1))
|
|
|
Type "help" for help.
|
|
|
|
|
|
postgres=# \l
|
|
|
List of databases
|
|
|
Name | Owner | Encoding | Collate | Ctype | Access privileges
|
|
|
-----------+----------+----------+-------------+-------------+-----------------------
|
|
|
demo | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
|
|
|
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
|
|
|
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
|
|
|
| | | | | postgres=CTc/postgres
|
|
|
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
|
|
|
| | | | | postgres=CTc/postgres
|
|
|
(4 rows)
|
|
|
|
|
|
postgres=# \q
|
|
|
postgres@hqdc034:/zp/database$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>很好, demo DB 有順利的還原回來了,先暫時測試到這邊。接下來要來玩postgresql on zfs</p>
|
|
|
|
|
|
<p>後續如果想更深入測試 pgbackrest,可以試試看異機備份還原。</p>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="footer">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="tags">
|
|
|
<i class="fa fa-tags"></i>
|
|
|
<div class="links">
|
|
|
|
|
|
<a href="/tags/postgresql">postgresql</a>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div id="disqus_thread"></div>
|
|
|
<script type="application/javascript">
|
|
|
var disqus_config = function () {
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
(function() {
|
|
|
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
|
|
|
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
|
|
|
return;
|
|
|
}
|
|
|
var d = document, s = d.createElement('script'); s.async = true;
|
|
|
s.src = '//' + "h-cowbay-org-1" + '.disqus.com/embed.js';
|
|
|
s.setAttribute('data-timestamp', +new Date());
|
|
|
(d.head || d.body).appendChild(s);
|
|
|
})();
|
|
|
</script>
|
|
|
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
|
|
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
|
<div class="recent-posts">
|
|
|
<strong></strong>
|
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/recommended-ulauncher-in-ubuntu-1804/">[推薦] ulauncher ubuntu 18.04 底下,好用的 app launcher / Recommended Ulauncher in Ubuntu 1804</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/pg_auto_failover_in_ubuntu_1804_psql_11/">[筆記] 在ubuntu 18.04安裝psql 11 以及 pg_auto_failover / install psql 11 and pg_auto_failover in ubuntu 18.04</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/bencmark-with-external-internal-nvme-ssd-and-external-sata-ssd/">[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/postgresql-backup-restore-using-zfs-snapshot/">[筆記] 用zfs的snapshot 快照功能來做 postgresql 的備份還原 / Postgresql Backup Restore Using Zfs Snapshot</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/backup-restore-postgresql-with-pgbackrest/">[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/pgbarman-in-ubuntu-1804-postgresql-10-via-ssh/">[筆記] 在Ubuntu 18.04 下 透過 pgbarman rsync/ssh backup 備份 postgresql 10 / backup postgresql 10 with pgbarman via ssh/rsync in ubuntu 18.04</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/pgbarman-in-ubuntu-1804-postgresql-10/">[筆記] 在Ubuntu 18.04 下 透過 pgbarman streaming backup 備份 postgresql 10/ backup postgresql 10 with pgbarman straming backup in ubuntu 18.04</a>
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="categories">
|
|
|
<a href="/categories/"><strong></strong></a>
|
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/%E7%AD%86%E8%A8%98">筆記 (31)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/ansible">Ansible (3)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/"> (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/linux">Linux (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/proxmox">Proxmox (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/ps">Ps (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/%E7%A2%8E%E5%BF%B5">碎念 (1)</a>
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="right">
|
|
|
|
|
|
<div class="external-profiles">
|
|
|
<strong></strong>
|
|
|
|
|
|
|
|
|
<a href="https://www.facebook.com/mariahchang" target="_blank"><i class="fa fa-facebook-adblock-proof"></i></a>
|
|
|
|
|
|
|
|
|
<a href="https://twitter.com/changchichung" target="_blank"><i class="fa fa-twitter-adblock-proof"></i></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/changchichung" target="_blank"><i class="fa fa-github"></i></a>
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://www.yapee.tw/mvc/onlinePay/webLink?key=lMC74kucH21JChCR77-wJ80ZZ-Poh11amP24BwiDdHw" target="_blank"><img border="0" src="https://www.yapee.tw/mvc/file/publicFile?pathType=data/linkLogo/B0S0F0002585.jpg"></img></a>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
</footer>
|
|
|
|
|
|
|
|
|
<div class="credits">
|
|
|
<div class="container">
|
|
|
<div class="copyright">
|
|
|
<a href="https://github.com/Lednerb" target="_blank">
|
|
|
©
|
|
|
|
|
|
2017
|
|
|
|
|
|
by Lednerb
|
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
<div class="author">
|
|
|
<a href="https://www.yapee.tw/mvc/onlinePay/webLink?key=lMC74kucH21JChCR77-wJ80ZZ-Poh11amP24BwiDdHw" target="_blank">Bilberry Hugo Theme</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
var doNotTrack = false;
|
|
|
if (!doNotTrack) {
|
|
|
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
|
ga('create', 'UA-138954876-1', 'auto');
|
|
|
|
|
|
ga('send', 'pageview');
|
|
|
}
|
|
|
</script>
|
|
|
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="https://h.cowbay.org/js/externalDependencies.39c47e10e241eae2947b3fe21809c572.js" integrity="md5-OcR+EOJB6uKUez/iGAnFcg=="></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="https://h.cowbay.org/js/theme.ff50ae6dc1bfc220b23bf69dbb41b54e.js" integrity="md5-/1CubcG/wiCyO/adu0G1Tg=="></script>
|
|
|
|
|
|
<script>
|
|
|
$(".moment").each(function() {
|
|
|
$(this).text(
|
|
|
moment( $(this).text() )
|
|
|
.locale( "tw" )
|
|
|
.format('LL')
|
|
|
);
|
|
|
});
|
|
|
|
|
|
$(".footnote-return sup").html("");
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
var client = algoliasearch("2XL0P8XDCY", "4ef65b37b627bb886b46c34a10e63aa6");
|
|
|
var index = client.initIndex("h_cowbay_org");
|
|
|
|
|
|
$('#search').autocomplete({ hint: false, autoselect: true, debug: false },
|
|
|
[
|
|
|
{
|
|
|
|
|
|
source: $.fn.autocomplete.sources.hits(index, { hitsPerPage: 10 }),
|
|
|
|
|
|
displayKey: function(suggestion) {
|
|
|
return suggestion.title || suggestion.author
|
|
|
},
|
|
|
templates: {
|
|
|
suggestion: function(suggestion) {
|
|
|
return "<span class='entry " + suggestion.type + "'>"
|
|
|
+ "<span class='title'>" + suggestion.title + "</span>"
|
|
|
+ "<span class='fa fa-fw " + suggestion.iconClass + "'></span>"
|
|
|
+ "</span>"
|
|
|
;
|
|
|
},
|
|
|
empty: function() {
|
|
|
return "<span class='empty'></span>"
|
|
|
},
|
|
|
footer: function() {
|
|
|
return '<div class="branding">Powered by <img src="https:\/\/h.cowbay.org\/dist\/algolia-logo-light.svg" /></div>'
|
|
|
}
|
|
|
|
|
|
},
|
|
|
}
|
|
|
])
|
|
|
.on('autocomplete:selected', function(event, suggestion, dataset) {
|
|
|
window.location = (suggestion.url);
|
|
|
})
|
|
|
.keypress(function (event, suggestion) {
|
|
|
if (event.which == 13) {
|
|
|
window.location = (suggestion.url);
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
</html>
|