add auto fetch ssl certs

master
Eric Chang 4 years ago
parent 11ca254bed
commit 509ac048fc

@ -0,0 +1,298 @@
---
title: "auto fetch Wildcard ssl certs with lego + acme-dns ( Domain Register : Namecheap)"
date: 2021-08-26T12:08:43+08:00
noSummary: false
categories: ['筆記']
image: https://h.cowbay.org/images/post-default-8.jpg
tags: ['acme','acme-dns','lego','ssl']
author: "Eric Chang"
keywords:
- acme
- lego
---
### auto fetch Wildcard ssl certs with lego + acme-dns ( Domain Register : Namecheap)
自從用了 [leproxy](https://github.com/artyom/leproxy) 之後其實就很少在管ssl 憑證的問題,反正[leproxy ](https://github.com/artyom/leproxy)都會自動處理好
不過LAN裡面的機器越來越多每次看到警告說沒有加密的訊息就有點不爽之前用了很多方式去申請全域憑證申請倒是還好沒太多問題。但是一碰到要更新就都無法自動因為都會要求去修改DNS 的 TXT 或者是 CNAME 記錄。
一般來說如果是其他DNS 供應商大部分都會提供API那就還好。 BUT !! (對然生就是離不開這個BUT ...) 我們的域名是老闆在 iwantmyname 買的,一開始是給 webfaction 代管後來webfaction 被godaddy 買走,就轉到 namecheap 去(我也不知道為什麼不在godaddy 就好)。
<!--more-->
DNS 管理基本上都是大同小異啦可是namecheap 免費賬戶不提供 API 應該說要使用namecheap 提供的API ,需要滿足以下的條件
```
I want to enable API for my account. Are there any specific requirements?
We have certain requirements for activation to prevent system abuse. In order to have API enabled for your account, you should meet one of the following requirements:
- have at least 20 domains under your account;
- have at least $50 on your account balance;
- have at least $50 spent within the last 2 years.
```
之前問過老闆可不可以丟個50 鎂在賬戶裡面好讓我可以用API 去修改DNS 來自動取得SSL 憑證同樣地也不知道為什麼連50鎂也不給存...
於是過了一段每幾個月就憑證過期,需要手動更新的日子....想想實在不甘願本來已經想說去買一些一塊美金一年的domain 然後通通移轉到namecheap ,來滿足上面的第一個條件。但是這又要自己花錢(我已經自掏腰包很多了在這邊買LAB設備),最後決定還是用[lego](https://github.com/go-acme/lego) + [acme-dns](https://github.com/joohoi/acme-dns) 來做
其實前兩年就有玩過 lego ,但是當時應該是功能上還沒完整,這次在找 acme-dns 的文件時發現lego 一直有持續更新,所以這次才決定改用 lego + acme-dns 來達到「自動更新」 SSL 憑證的需求,底下就簡單說明一下設定步驟、內容
#### 取得 lego & acme-dns
lego 以及acme-dns 都是使用 golang 開發的這也是為什麼我選用這兩個組合的原因之一省去自己編譯還要安裝一堆有的沒的套件兩個套件都有prebuild binary package直接下載回來就可以了
##### lego
wget https://github.com/go-acme/lego/releases/download/v4.4.0/lego_v4.4.0_linux_amd64.tar.gz
##### acme-dns
wget https://github.com/joohoi/acme-dns/releases/download/v0.8/acme-dns_0.8_linux_amd64.tar.gz
解壓縮後取得執行檔
tar zxvf lego_v4.4.0_linux_amd64.tar.gz && sudo mv lego /usr/local/bin/
tar zxvf acme-dns_0.8_linux_amd64.tar.gz && sudo mv acme-dns /usr/local/bin/
---
##### Firewall 設定
firewall 上開啟port mapping ,把 UDP 53 轉給這臺跑 lego 的機器
如果這臺機器上有軟體已經佔用 53 port ,要想辦法先解決。
對,我說的就是那個超級討厭的 systemd-resolved
本機如果有開firewall ,記得要放行 udp 53
---
#### 設定acme-dns
```shell
#建立 acme-dns 目錄
mkdir -p /etc/acme-dns
mkdir -p /var/lib/acme-dns
#建立 acme-dns 設定檔
sudo vim /etc/acme-dns/config.cfg
```
config 的內容如下,順便補上一些自己的註解
```shell
#/etc/acme-dns/config.cfg
[general]
# DNS interface
# 本來預設是只有 :53 在某些VPS 上會出錯,所以改成 0.0.0.0:53
listen = "0.0.0.0:53"
protocol = "udp"
# domain name to serve the requests off of
# 不是要設定的 domain而是這臺機器要負責的sub domain
# 總之就是輸入 acme 再加上原本的domain
# 不想用 acme 當然也可以
domain = "acme.abc.com"
# zone name server
# ns1 再加上原本的 domain
# 一樣不想用ns1 也可以,後面記得作對應的修改
nsname = "ns1.abc.com"
# admin email address, where @ is substituted with .
# 管理者email , admin + 原本的 domain
nsadmin = "admin.abc.com"
# predefined records served in addition to the TXT
#
# 前面兩筆 A 記錄對應上面的 domain , nsname
# 後面則是這臺機器的 WAN IP
# 第三筆 是NS 記錄
# 這三筆記錄等一下要新增到namecheap 的DNS
records = [
"acme.abc.com. A 11.22.33.44",
"ns1.acme.abc.com. A 11.22.33.44",
"acme.abc.com. NS ns1.abc.com.",
]
debug = false
[database]
engine = "sqlite3"
connection = "/var/lib/acme-dns/acme-dns.db"
### 要記一下port ,等等會用到
[api]
api_domain = ""
ip = "127.0.0.1"
disable_registration = false
autocert_port = "80"
port = "9000"
tls = "none"
corsorigins = [
"*"
]
use_header = false
header_name = "X-Forwarded-For"
[logconfig]
loglevel = "debug"
logtype = "stdout"
logformat = "text"
```
編輯完後,存檔離開。
新增 acme-dns.service 的systemd config
```shell
sudo vim /etc/systemd/system/acme-dns.service
```
內容如下
```shell
# /etc/systemd/system/acme-dns.service
[Unit]
Description=ACMD DNS
After=network.target
[Service]
ExecStart=/usr/local/bin/acme-dns
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
存檔離開,並啟用 acme-dns service
```shell
sudo systemctl daemon-reload
sudo systemctl enable --now acme-dns.service
# 檢查一下狀態是否正常
sudo systemctl status acme-dns
# 底下這個指令如果沒有回傳任何訊息,是正常的
curl http://localhost:9000/health
```
#### 設定namecheap DNS 記錄
總共要新增兩筆A 記錄,一筆 NS 記錄 (目前),後面還會需要新增一筆 CNAME
domain
![20210826113826-image.png](https://raw.githubusercontent.com/changchichung/imagebed/main/20210826113826-image.png)
nsname
![20210826113946-image.png](https://raw.githubusercontent.com/changchichung/imagebed/main/20210826113946-image.png)
NS record
![20210826114027-image.png](https://raw.githubusercontent.com/changchichung/imagebed/main/20210826114027-image.png)
然後休息個五分鐘十分鐘的讓子彈飛一下等DNS生效
##### 透過lego 取得憑證
只要確認上面的防火牆設定、acme-dns 設定、以及 DNS 的修改生效之後剩下的lego 指令就很簡單了
https://go-acme.github.io/lego/dns/acme-dns/
```shell
# 第一個ACME_DNS_API_BASE是剛剛設定acme-dns API port
# 然後 ACME_DNS_STORAGE_PATH 是lego存放賬戶資料的地方
# 後面就是lego 的指令
ACME_DNS_API_BASE=http://localhost:9000 ACME_DNS_STORAGE_PATH=/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com run
```
執行完成後,會在目錄底下產生一個叫 .lego 的目錄,用來存放憑證檔案
```shell
2021-08-26 11:55:16 [minion@hqs058 ~]$ ls -la .lego/certificates/
total 28
drwx------ 2 minion sudo 4096 Aug 26 09:35 .
drwx------ 4 minion sudo 4096 Aug 26 09:33 ..
-rw------- 1 minion sudo 5325 Aug 26 09:35 _.abc.com.crt
-rw------- 1 minion sudo 3751 Aug 26 09:35 _.abc.com.issuer.crt
-rw------- 1 minion sudo 238 Aug 26 09:35 _.abc.com.json
-rw------- 1 minion sudo 227 Aug 26 09:35 _.abc.com.key
2021-08-26 11:58:22 [minion@hqs058 ~]$
```
沒錯,就這麼簡單!!
甚至於我要撤銷這些憑證也很簡單!!!
把最後面的 run 改成 revoke 就可以了!
```shell
ACME_DNS_API_BASE=http://localhost:9000 ACME_DNS_STORAGE_PATH=/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com revoke
2021/08/26 11:59:13 Trying to revoke certificate for domain *.abc.com
2021/08/26 11:59:14 Certificate was revoked.
2021/08/26 11:59:14 Certificate was archived for domain: *.abc.com
```
再來跑一次申請新憑證測試看看
```shell
ACME_DNS_API_BASE=http://localhost:9000 ACME_DNS_STORAGE_PATH=/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com run
2021/08/26 12:00:51 [INFO] [*.abc.com] acme: Obtaining bundled SAN certificate
2021/08/26 12:00:52 [INFO] [*.abc.com] AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/25150773810
2021/08/26 12:00:52 [INFO] [*.abc.com] acme: authorization already valid; skipping challenge
2021/08/26 12:00:52 [INFO] [*.abc.com] acme: Validations succeeded; requesting certificates
2021/08/26 12:00:53 [INFO] [*.abc.com] Server responded with a certificate.
```
同樣地會產生新的ssl 憑證
```shell
2021-08-26 12:00:53 [minion@hqs058 ~]$ ls -la .lego/certificates/
total 28
drwx------ 2 minion sudo 4096 Aug 26 12:00 .
drwx------ 5 minion sudo 4096 Aug 26 11:59 ..
-rw------- 1 minion sudo 5325 Aug 26 12:00 _.abc.com.crt
-rw------- 1 minion sudo 3751 Aug 26 12:00 _.abc.com.issuer.crt
-rw------- 1 minion sudo 238 Aug 26 12:00 _.abc.com.json
-rw------- 1 minion sudo 227 Aug 26 12:00 _.abc.com.key
2021-08-26 12:02:37 [minion@hqs058 ~]$
```
超方便的啊!!!!
後面要更新就把指令最後的 run 改成 renew
```shell
ACME_DNS_API_BASE=http://localhost:9000 ACME_DNS_STORAGE_PATH=/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com renew
2021/08/26 12:04:00 [*.abc.com] The certificate expires in 89 days, the number of days defined to perform the renewal is 30: no renewal.
```
因為是剛剛才要到的憑證,當然是不能更新啦...
把這個指令寫到 crontab ,以後時間到了就會自動更新憑證
後續再搭配 ansible 來抓新的憑證,派送到其他伺服器去
終於可以不用再為ssl 憑證煩惱了!!!

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -301,23 +297,15 @@ if (!doNotTrack) {
<div class="entry-container"> <div class="entry-container">
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>An sincerity so extremity he additions. Her yet <strong>there truth merit</strong>. Mrs all projecting favourable now unpleasing. Son law garden chatty temper. Oh children provided to mr elegance marriage strongly. Off can admiration prosperous now devonshire diminution law.</p>
<p>An sincerity so extremity he additions. Her yet <strong>there truth merit</strong>. Mrs all projecting favourable now unpleasing. Son law garden chatty temper. Oh children provided to mr elegance marriage strongly. Off can admiration prosperous now devonshire diminution law.</p>
<p>Received overcame oh sensible so at an. Formed do change merely to county it. <strong>Am separate contempt</strong> domestic to to oh. On relation my so addition branched. Put hearing cottage she norland letters equally prepare too. Replied exposed savings he no viewing as up. Soon body add him hill. No father living really people estate if. Mistake do produce beloved demesne if am pursuit.</p> <p>Received overcame oh sensible so at an. Formed do change merely to county it. <strong>Am separate contempt</strong> domestic to to oh. On relation my so addition branched. Put hearing cottage she norland letters equally prepare too. Replied exposed savings he no viewing as up. Soon body add him hill. No father living really people estate if. Mistake do produce beloved demesne if am pursuit.</p>
<p><img src="/img/about.jpg" alt="This is me"></p>
<p><img src="/img/about.jpg" alt="This is me" /></p>
<p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn&rsquo;t listen. She packed her seven versalia, put her initial into the belt and made herself on the way.</p> <p>The Big Oxmox advised her not to do so, because there were thousands of bad Commas, wild Question Marks and devious Semikoli, but the Little Blind Text didn&rsquo;t listen. She packed her seven versalia, put her initial into the belt and made herself on the way.</p>
<h4 id="education">Education</h4> <h4 id="education">Education</h4>
<ul> <ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li> <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li> <li>Aliquam tincidunt mauris eu risus.</li>
</ul> </ul>
<p>When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then</p> <p>When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then</p>
</article> </article>
@ -591,7 +579,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -603,7 +591,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -0,0 +1,777 @@
<!DOCTYPE html>
<html lang="en-us">
<head><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https:\/\/h.cowbay.org"
},
"articleSection" : "",
"name" : "auto fetch Wildcard ssl certs with lego \x2b acme-dns ( Domain Register : Namecheap)",
"headline" : "auto fetch Wildcard ssl certs with lego \x2b acme-dns ( Domain Register : Namecheap)",
"description" : "\x3ch3 id=\x22auto-fetch--wildcard-ssl-certs-with-lego--acme-dns--domain-register--namecheap\x22\x3eauto fetch Wildcard ssl certs with lego \x2b acme-dns ( Domain Register : Namecheap)\x3c\/h3\x3e\n\x3cp\x3e自從用了 \x3ca href=\x22https:\/\/github.com\/artyom\/leproxy\x22\x3eleproxy\x3c\/a\x3e 之後其實就很少在管ssl 憑證的問題,反正\x3ca href=\x22https:\/\/github.com\/artyom\/leproxy\x22\x3eleproxy \x3c\/a\x3e都會自動處理好\x3c\/p\x3e\n\x3cp\x3e不過LAN裡面的機器越來越多每次看到警告說沒有加密的訊息就有點不爽之前用了很多方式去申請全域憑證申請倒是還好沒太多問題。但是一碰到要更新就都無法自動因為都會要求去修改DNS 的 TXT 或者是 CNAME 記錄。\x3c\/p\x3e\n\x3cp\x3e一般來說如果是其他DNS 供應商大部分都會提供API那就還好。 BUT !! (對然生就是離不開這個BUT \x26hellip;) 我們的域名是老闆在 iwantmyname 買的,一開始是給 webfaction 代管後來webfaction 被godaddy 買走,就轉到 namecheap 去(我也不知道為什麼不在godaddy 就好)。\x3c\/p\x3e",
"inLanguage" : "en",
"author" : "Eric Chang",
"creator" : "Eric Chang",
"publisher": "Eric Chang",
"accountablePerson" : "Eric Chang",
"copyrightHolder" : "Eric Chang",
"copyrightYear" : "2021",
"datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/auto-fetch-wildcard-ssl-certs-acme-dns-lego\/",
"wordCount" : "744",
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-8.jpg"",
"keywords" : [ ""acme"",""acme-dns"",""lego"",""ssl"","Blog" ]
}
</script>
<title>auto fetch Wildcard ssl certs with lego &#43; acme-dns ( Domain Register : Namecheap) </title>
<meta name="description" content="some articles about job,food,passion sisters" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all,follow">
<meta name="googlebot" content="index,follow,snippet,archive">
<link rel="stylesheet" id="ct-tracks-google-fonts-css" href="https://fonts.googleapis.com/css?family=Raleway%3A400%2C700&amp;subset=latin%2Clatin-ext&amp;ver=4.7.2" type="text/css" media="all">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<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>
</head>
<body class="post-template-default single single-post single-format-standard ct-body singular singular-post not-front standard">
<div id="overflow-container" class="overflow-container">
<a class="skip-content" href="#main">Skip to content</a>
<header id="site-header" class="site-header" role="banner">
<div class='top-navigation'>
<div class='container'>
<div id="menu-secondary" class="menu-container menu-secondary" role="navigation">
<button id="toggle-secondary-navigation" class="toggle-secondary-navigation"><i class="fas fa-plus"></i></button>
<div class="menu">
<ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/linux">linux</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/proxmox">proxmox</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ps">ps</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/%E7%A2%8E%E5%BF%B5">碎念</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/%E7%AD%86%E8%A8%98">筆記</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/%E7%BE%A4%E6%9A%89">群暉</a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/%E9%9B%9C%E5%BF%B5">雜念</a>
</li>
</ul>
</div>
</div>
<ul class="social-media-icons">
<li>
<a href="full%20Social%20profile%20url%20in%20facebook" data-animate-hover="pulse" class="facebook" target="_blank">
<i class="fab fa-facebook-square" title="facebook"></i>
<span class="screen-reader-text">facebook</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20googleplus" data-animate-hover="pulse" class="gplus" target="_blank">
<i class="fab fa-google-plus-g" title="googleplus"></i>
<span class="screen-reader-text">googleplus</span>
</a>
</li>
<li>
<a href="chang0206" data-animate-hover="pulse" class="twitter" target="_blank">
<i class="fab fa-twitter-square" title="twitter"></i>
<span class="screen-reader-text">twitter</span>
</a>
</li>
<li>
<a href="chang0206" data-animate-hover="pulse" class="instagram" target="_blank">
<i class="fab fa-instagram" title="instagram"></i>
<span class="screen-reader-text">instagram</span>
</a>
</li>
<li>
<a href="mailto:mc@hotshraingmy.info" data-animate-hover="pulse" class="email">
<i class="fas fa-envelope" title="email"></i>
<span class="screen-reader-text">email</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20linkedin" data-animate-hover="pulse" class="linkedin" target="_blank">
<i class="fab fa-linkedin-in" title="linkedin"></i>
<span class="screen-reader-text">linkedin</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20stackoverflow" data-animate-hover="pulse" class="stackoverflow" target="_blank">
<i class="fab fa-stack-overflow" title="stackoverflow"></i>
<span class="screen-reader-text">stackoverflow</span>
</a>
</li>
<li>
<a href="changchichung" data-animate-hover="pulse" class="github" target="_blank">
<i class="fab fa-github" title="github"></i>
<span class="screen-reader-text">github</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20pinterest" data-animate-hover="pulse" class="pinterest" target="_blank">
<i class="fab fa-pinterest" title="pinterest"></i>
<span class="screen-reader-text">pinterest</span>
</a>
</li>
<li>
<a href="https://h.cowbay.org/index.xml" data-animate-hover="pulse" class="rss" target="_blank">
<i class="fas fa-rss" title="rss"></i>
<span class="screen-reader-text">rss</span>
</a>
</li>
</ul></div>
</div>
<div class="container">
<div id="title-info" class="title-info">
<div id='site-title' class='site-title'>
<a href="/"> MC部落 </a>
</div>
</div>
<button id="toggle-navigation" class="toggle-navigation">
<i class="fas fa-bars"></i>
</button>
<div id="menu-primary-tracks" class="menu-primary-tracks"></div>
<div id="menu-primary" class="menu-container menu-primary" role="navigation">
<p class="site-description">Whats the Worst That Could Happen?</p>
<div class="menu">
<ul id="menu-primary-items" class="menu-primary-items">
<li class='menu-item menu-item-type-custom menu-item-object-custom '>
<a href="https://h.cowbay.org/">Home</a>
</li>
<li class='menu-item menu-item-type-post_type menu-item-object-page '>
<a href="https://h.cowbay.org/about/">About</a>
</li>
<li class='menu-item menu-item-type-post_type menu-item-object-page '>
<a href="https://h.cowbay.org/contact/">Get in touch</a>
</li>
</ul>
</div>
</div>
</div>
</header>
<div id="main" class="main" role="main">
<div id="loop-container" class="loop-container">
<div class="post type-post status-publish format-standard has-post-thumbnail hentry category-design tag-design tag-standard-2 tag-tagalicious tag-travel entry full-without-featured odd excerpt-1">
<div class='featured-image lazy lazy-bg-image' data-background="https://h.cowbay.org/images/post-default-8.jpg">
</div>
<div class="entry-meta">
<span class="date">26 August</span> <span> / </span>
<span class="author">
<a href="https://github.com/changchichung" title="Posts by Eric Chang" rel="author">Eric Chang</a>
</span>
<span class="category">
<span> / </span>
<a href="/categories/%E7%AD%86%E8%A8%98">筆記</a>
</span>
</div>
<div class='entry-header'>
<h1 class='entry-title'> auto fetch Wildcard ssl certs with lego &#43; acme-dns ( Domain Register : Namecheap)</h1>
</div>
<div class="entry-container">
<div class="entry-content">
<article>
<h3 id="auto-fetch--wildcard-ssl-certs-with-lego--acme-dns--domain-register--namecheap">auto fetch Wildcard ssl certs with lego + acme-dns ( Domain Register : Namecheap)</h3>
<p>自從用了 <a href="https://github.com/artyom/leproxy">leproxy</a> 之後其實就很少在管ssl 憑證的問題,反正<a href="https://github.com/artyom/leproxy">leproxy </a>都會自動處理好</p>
<p>不過LAN裡面的機器越來越多每次看到警告說沒有加密的訊息就有點不爽之前用了很多方式去申請全域憑證申請倒是還好沒太多問題。但是一碰到要更新就都無法自動因為都會要求去修改DNS 的 TXT 或者是 CNAME 記錄。</p>
<p>一般來說如果是其他DNS 供應商大部分都會提供API那就還好。 BUT !! (對然生就是離不開這個BUT &hellip;) 我們的域名是老闆在 iwantmyname 買的,一開始是給 webfaction 代管後來webfaction 被godaddy 買走,就轉到 namecheap 去(我也不知道為什麼不在godaddy 就好)。</p>
<p>DNS 管理基本上都是大同小異啦可是namecheap 免費賬戶不提供 API 應該說要使用namecheap 提供的API ,需要滿足以下的條件</p>
<pre><code>I want to enable API for my account. Are there any specific requirements?
We have certain requirements for activation to prevent system abuse. In order to have API enabled for your account, you should meet one of the following requirements:
- have at least 20 domains under your account;
- have at least $50 on your account balance;
- have at least $50 spent within the last 2 years.
</code></pre><p>之前問過老闆可不可以丟個50 鎂在賬戶裡面好讓我可以用API 去修改DNS 來自動取得SSL 憑證同樣地也不知道為什麼連50鎂也不給存&hellip;</p>
<p>於是過了一段每幾個月就憑證過期,需要手動更新的日子&hellip;.想想實在不甘願本來已經想說去買一些一塊美金一年的domain 然後通通移轉到namecheap ,來滿足上面的第一個條件。但是這又要自己花錢(我已經自掏腰包很多了在這邊買LAB設備),最後決定還是用<a href="https://github.com/go-acme/lego">lego</a> + <a href="https://github.com/joohoi/acme-dns">acme-dns</a> 來做</p>
<p>其實前兩年就有玩過 lego ,但是當時應該是功能上還沒完整,這次在找 acme-dns 的文件時發現lego 一直有持續更新,所以這次才決定改用 lego + acme-dns 來達到「自動更新」 SSL 憑證的需求,底下就簡單說明一下設定步驟、內容</p>
<h4 id="取得-lego--acme-dns">取得 lego &amp; acme-dns</h4>
<p>lego 以及acme-dns 都是使用 golang 開發的這也是為什麼我選用這兩個組合的原因之一省去自己編譯還要安裝一堆有的沒的套件兩個套件都有prebuild binary package直接下載回來就可以了</p>
<h5 id="lego">lego</h5>
<p>wget <a href="https://github.com/go-acme/lego/releases/download/v4.4.0/lego_v4.4.0_linux_amd64.tar.gz">https://github.com/go-acme/lego/releases/download/v4.4.0/lego_v4.4.0_linux_amd64.tar.gz</a></p>
<h5 id="acme-dns">acme-dns</h5>
<p>wget <a href="https://github.com/joohoi/acme-dns/releases/download/v0.8/acme-dns_0.8_linux_amd64.tar.gz">https://github.com/joohoi/acme-dns/releases/download/v0.8/acme-dns_0.8_linux_amd64.tar.gz</a></p>
<p>解壓縮後取得執行檔</p>
<p>tar zxvf lego_v4.4.0_linux_amd64.tar.gz &amp;&amp; sudo mv lego /usr/local/bin/
tar zxvf acme-dns_0.8_linux_amd64.tar.gz &amp;&amp; sudo mv acme-dns /usr/local/bin/</p>
<hr>
<h5 id="firewall-設定">Firewall 設定</h5>
<p>firewall 上開啟port mapping ,把 UDP 53 轉給這臺跑 lego 的機器</p>
<p>如果這臺機器上有軟體已經佔用 53 port ,要想辦法先解決。</p>
<p>對,我說的就是那個超級討厭的 systemd-resolved</p>
<p>本機如果有開firewall ,記得要放行 udp 53</p>
<hr>
<h4 id="設定acme-dns">設定acme-dns</h4>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#75715e">#建立 acme-dns 目錄</span>
mkdir -p /etc/acme-dns
mkdir -p /var/lib/acme-dns
<span style="color:#75715e">#建立 acme-dns 設定檔</span>
sudo vim /etc/acme-dns/config.cfg
</code></pre></div><p>config 的內容如下,順便補上一些自己的註解</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#75715e">#/etc/acme-dns/config.cfg</span>
<span style="color:#f92672">[</span>general<span style="color:#f92672">]</span>
<span style="color:#75715e"># DNS interface</span>
<span style="color:#75715e"># 本來預設是只有 :53 在某些VPS 上會出錯,所以改成 0.0.0.0:53</span>
listen <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;0.0.0.0:53&#34;</span>
protocol <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;udp&#34;</span>
<span style="color:#75715e"># domain name to serve the requests off of</span>
<span style="color:#75715e"># 不是要設定的 domain而是這臺機器要負責的sub domain</span>
<span style="color:#75715e"># 總之就是輸入 acme 再加上原本的domain</span>
<span style="color:#75715e"># 不想用 acme 當然也可以</span>
domain <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;acme.abc.com&#34;</span>
<span style="color:#75715e"># zone name server</span>
<span style="color:#75715e"># ns1 再加上原本的 domain</span>
<span style="color:#75715e"># 一樣不想用ns1 也可以,後面記得作對應的修改</span>
nsname <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;ns1.abc.com&#34;</span>
<span style="color:#75715e"># admin email address, where @ is substituted with .</span>
<span style="color:#75715e"># 管理者email , admin + 原本的 domain</span>
nsadmin <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;admin.abc.com&#34;</span>
<span style="color:#75715e"># predefined records served in addition to the TXT</span>
#
<span style="color:#75715e"># 前面兩筆 A 記錄對應上面的 domain , nsname</span>
<span style="color:#75715e"># 後面則是這臺機器的 WAN IP</span>
<span style="color:#75715e"># 第三筆 是NS 記錄</span>
<span style="color:#75715e"># 這三筆記錄等一下要新增到namecheap 的DNS</span>
records <span style="color:#f92672">=</span> <span style="color:#f92672">[</span>
<span style="color:#e6db74">&#34;acme.abc.com. A 11.22.33.44&#34;</span>,
<span style="color:#e6db74">&#34;ns1.acme.abc.com. A 11.22.33.44&#34;</span>,
<span style="color:#e6db74">&#34;acme.abc.com. NS ns1.abc.com.&#34;</span>,
<span style="color:#f92672">]</span>
debug <span style="color:#f92672">=</span> false
<span style="color:#f92672">[</span>database<span style="color:#f92672">]</span>
engine <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;sqlite3&#34;</span>
connection <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;/var/lib/acme-dns/acme-dns.db&#34;</span>
<span style="color:#75715e">### 要記一下port ,等等會用到</span>
<span style="color:#f92672">[</span>api<span style="color:#f92672">]</span>
api_domain <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;&#34;</span>
ip <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;127.0.0.1&#34;</span>
disable_registration <span style="color:#f92672">=</span> false
autocert_port <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;80&#34;</span>
port <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;9000&#34;</span>
tls <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;none&#34;</span>
corsorigins <span style="color:#f92672">=</span> <span style="color:#f92672">[</span>
<span style="color:#e6db74">&#34;*&#34;</span>
<span style="color:#f92672">]</span>
use_header <span style="color:#f92672">=</span> false
header_name <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;X-Forwarded-For&#34;</span>
<span style="color:#f92672">[</span>logconfig<span style="color:#f92672">]</span>
loglevel <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;debug&#34;</span>
logtype <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;stdout&#34;</span>
logformat <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;text&#34;</span>
</code></pre></div><p>編輯完後,存檔離開。</p>
<p>新增 acme-dns.service 的systemd config</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">sudo vim /etc/systemd/system/acme-dns.service
</code></pre></div><p>內容如下</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#75715e"># /etc/systemd/system/acme-dns.service</span>
<span style="color:#f92672">[</span>Unit<span style="color:#f92672">]</span>
Description<span style="color:#f92672">=</span>ACMD DNS
After<span style="color:#f92672">=</span>network.target
<span style="color:#f92672">[</span>Service<span style="color:#f92672">]</span>
ExecStart<span style="color:#f92672">=</span>/usr/local/bin/acme-dns
Restart<span style="color:#f92672">=</span>on-failure
<span style="color:#f92672">[</span>Install<span style="color:#f92672">]</span>
WantedBy<span style="color:#f92672">=</span>multi-user.target
</code></pre></div><p>存檔離開,並啟用 acme-dns service</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">sudo systemctl daemon-reload
sudo systemctl enable --now acme-dns.service
<span style="color:#75715e"># 檢查一下狀態是否正常</span>
sudo systemctl status acme-dns
<span style="color:#75715e"># 底下這個指令如果沒有回傳任何訊息,是正常的</span>
curl http://localhost:9000/health
</code></pre></div><h4 id="設定namecheap-dns-記錄">設定namecheap DNS 記錄</h4>
<p>總共要新增兩筆A 記錄,一筆 NS 記錄 (目前),後面還會需要新增一筆 CNAME</p>
<p>domain</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210826113826-image.png" alt="20210826113826-image.png"></p>
<p>nsname</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210826113946-image.png" alt="20210826113946-image.png"></p>
<p>NS record</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210826114027-image.png" alt="20210826114027-image.png"></p>
<p>然後休息個五分鐘十分鐘的讓子彈飛一下等DNS生效</p>
<h5 id="透過lego-取得憑證">透過lego 取得憑證</h5>
<p>只要確認上面的防火牆設定、acme-dns 設定、以及 DNS 的修改生效之後剩下的lego 指令就很簡單了</p>
<p><a href="https://go-acme.github.io/lego/dns/acme-dns/">https://go-acme.github.io/lego/dns/acme-dns/</a></p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#75715e"># 第一個ACME_DNS_API_BASE是剛剛設定acme-dns API port</span>
<span style="color:#75715e"># 然後 ACME_DNS_STORAGE_PATH 是lego存放賬戶資料的地方</span>
<span style="color:#75715e"># 後面就是lego 的指令</span>
ACME_DNS_API_BASE<span style="color:#f92672">=</span>http://localhost:9000 ACME_DNS_STORAGE_PATH<span style="color:#f92672">=</span>/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com run
</code></pre></div><p>執行完成後,會在目錄底下產生一個叫 .lego 的目錄,用來存放憑證檔案</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">2021-08-26 11:55:16 <span style="color:#f92672">[</span>minion@hqs058 ~<span style="color:#f92672">]</span>$ ls -la .lego/certificates/
total <span style="color:#ae81ff">28</span>
drwx------ <span style="color:#ae81ff">2</span> minion sudo <span style="color:#ae81ff">4096</span> Aug <span style="color:#ae81ff">26</span> 09:35 .
drwx------ <span style="color:#ae81ff">4</span> minion sudo <span style="color:#ae81ff">4096</span> Aug <span style="color:#ae81ff">26</span> 09:33 ..
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">5325</span> Aug <span style="color:#ae81ff">26</span> 09:35 _.abc.com.crt
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">3751</span> Aug <span style="color:#ae81ff">26</span> 09:35 _.abc.com.issuer.crt
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">238</span> Aug <span style="color:#ae81ff">26</span> 09:35 _.abc.com.json
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">227</span> Aug <span style="color:#ae81ff">26</span> 09:35 _.abc.com.key
2021-08-26 11:58:22 <span style="color:#f92672">[</span>minion@hqs058 ~<span style="color:#f92672">]</span>$
</code></pre></div><p>沒錯,就這麼簡單!!</p>
<p>甚至於我要撤銷這些憑證也很簡單!!!</p>
<p>把最後面的 run 改成 revoke 就可以了!</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">ACME_DNS_API_BASE<span style="color:#f92672">=</span>http://localhost:9000 ACME_DNS_STORAGE_PATH<span style="color:#f92672">=</span>/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com revoke
2021/08/26 11:59:13 Trying to revoke certificate <span style="color:#66d9ef">for</span> domain *.abc.com
2021/08/26 11:59:14 Certificate was revoked.
2021/08/26 11:59:14 Certificate was archived <span style="color:#66d9ef">for</span> domain: *.abc.com
</code></pre></div><p>再來跑一次申請新憑證測試看看</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">ACME_DNS_API_BASE<span style="color:#f92672">=</span>http://localhost:9000 ACME_DNS_STORAGE_PATH<span style="color:#f92672">=</span>/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com run
2021/08/26 12:00:51 <span style="color:#f92672">[</span>INFO<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>*.abc.com<span style="color:#f92672">]</span> acme: Obtaining bundled SAN certificate
2021/08/26 12:00:52 <span style="color:#f92672">[</span>INFO<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>*.abc.com<span style="color:#f92672">]</span> AuthURL: https://acme-v02.api.letsencrypt.org/acme/authz-v3/25150773810
2021/08/26 12:00:52 <span style="color:#f92672">[</span>INFO<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>*.abc.com<span style="color:#f92672">]</span> acme: authorization already valid; skipping challenge
2021/08/26 12:00:52 <span style="color:#f92672">[</span>INFO<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>*.abc.com<span style="color:#f92672">]</span> acme: Validations succeeded; requesting certificates
2021/08/26 12:00:53 <span style="color:#f92672">[</span>INFO<span style="color:#f92672">]</span> <span style="color:#f92672">[</span>*.abc.com<span style="color:#f92672">]</span> Server responded with a certificate.
</code></pre></div><p>同樣地會產生新的ssl 憑證</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">2021-08-26 12:00:53 <span style="color:#f92672">[</span>minion@hqs058 ~<span style="color:#f92672">]</span>$ ls -la .lego/certificates/
total <span style="color:#ae81ff">28</span>
drwx------ <span style="color:#ae81ff">2</span> minion sudo <span style="color:#ae81ff">4096</span> Aug <span style="color:#ae81ff">26</span> 12:00 .
drwx------ <span style="color:#ae81ff">5</span> minion sudo <span style="color:#ae81ff">4096</span> Aug <span style="color:#ae81ff">26</span> 11:59 ..
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">5325</span> Aug <span style="color:#ae81ff">26</span> 12:00 _.abc.com.crt
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">3751</span> Aug <span style="color:#ae81ff">26</span> 12:00 _.abc.com.issuer.crt
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">238</span> Aug <span style="color:#ae81ff">26</span> 12:00 _.abc.com.json
-rw------- <span style="color:#ae81ff">1</span> minion sudo <span style="color:#ae81ff">227</span> Aug <span style="color:#ae81ff">26</span> 12:00 _.abc.com.key
2021-08-26 12:02:37 <span style="color:#f92672">[</span>minion@hqs058 ~<span style="color:#f92672">]</span>$
</code></pre></div><p>超方便的啊!!!!</p>
<p>後面要更新就把指令最後的 run 改成 renew</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">ACME_DNS_API_BASE<span style="color:#f92672">=</span>http://localhost:9000 ACME_DNS_STORAGE_PATH<span style="color:#f92672">=</span>/home/minion/.lego-acme-dns-accounts.json lego --email changch@abc.com --dns acme-dns --domains *.abc.com renew
2021/08/26 12:04:00 <span style="color:#f92672">[</span>*.abc.com<span style="color:#f92672">]</span> The certificate expires in <span style="color:#ae81ff">89</span> days, the number of days defined to perform the renewal is 30: no renewal.
</code></pre></div><p>因為是剛剛才要到的憑證,當然是不能更新啦&hellip;</p>
<p>把這個指令寫到 crontab ,以後時間到了就會自動更新憑證</p>
<p>後續再搭配 ansible 來抓新的憑證,派送到其他伺服器去</p>
<p>終於可以不用再為ssl 憑證煩惱了!!!</p>
</article>
</div>
<div class='entry-meta-bottom'>
<div class="entry-categories"><p><span>Categories</span>
<a href="/categories/%E7%AD%86%E8%A8%98" title="View all posts in 筆記">筆記</a>
</p>
</div>
<div class="entry-tags"><p><span>Tags</span>
<a href="/tags/acme" title="View all posts tagged acme">acme</a>
<a href="/tags/acme-dns" title="View all posts tagged acme-dns">acme-dns</a>
<a href="/tags/lego" title="View all posts tagged lego">lego</a>
<a href="/tags/ssl" title="View all posts tagged ssl">ssl</a>
</p></div> </div>
<div class="author-meta">
<div class="author">
<img alt='Eric Chang' src="https://www.gravatar.com/avatar/23f8ed94e007297499ac8df1641b3ff5?s=100&d=identicon" class='avatar avatar-72 photo' height='72' width='72'>
<span>
Written by:<a href="https://github.com/changchichung" title="Posts by Eric Chang" rel="author">Eric Chang</a> </span>
</div>
<div class="bio">
<p>塵世裡一個迷途小書僮</p>
<a class="facebook" target="_blank"
href="full%20Social%20profile%20url%20in%20facebook">
<i class="fab fa-facebook-f"
title="facebook icon"></i>
</a>
<a class="googleplus" target="_blank"
href="full%20profile%20url%20in%20googleplus">
<i class="fab fa-google-plus-g"
title="googleplus icon"></i>
</a>
<a class="twitter" target="_blank"
href="chang0206">
<i class="fab fa-twitter-square"
title="twitter icon"></i>
</a>
<a class="linkedin" target="_blank"
href="full%20profile%20url%20in%20linkedin">
<i class="fab fa-linkedin"
title="linkedin icon"></i>
</a>
<a class="email" target="_blank"
href="mailto:mc@hotshraingmy.info">
<i class="fas fa-envelope"
title="email icon"></i>
</a>
<a class="instagram" target="_blank"
href="chang0206">
<i class="fab fa-instagram"
title="instagram icon"></i>
</a>
<a class="stackoverflow" target="_blank"
href="full%20profile%20url%20in%20stackoverflow">
<i class="fab fa-stack-overflow"
title="stackoverflow icon"></i>
</a>
<a class="github" target="_blank"
href="changchichung">
<i class="fab fa-github"
title="github icon"></i>
</a>
<a class="pinterest" target="_blank"
href="full%20profile%20url%20in%20pinterest">
<i class="fab fa-pinterest"
title="pinterest icon"></i>
</a>
</div>
</div>
</div>
</div>
<section id="comments" class="comments">
<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>
</section>
</div>
</div>
<footer id="site-footer" class="site-footer" role="contentinfo">
<h1>
<a href=""> MC部落 </a>
</h1>
<p class="site-description">Whats the Worst That Could Happen?</p>
<div id="menu-footer" class="menu-container menu-footer" role="navigation">
<div class="menu">
<ul id="menu-footer-items" class="menu-footer-items">
</ul>
</div> </div>
<ul class="social-media-icons">
<li>
<a class="facebook" target="_blank"
href="full%20Social%20profile%20url%20in%20facebook" >
<i class="fab fa-facebook-f" title="facebook"></i>
<span class="screen-reader-text">facebook</span>
</a>
</li>
<li>
<a class="googleplus" target="_blank"
href="full%20profile%20url%20in%20googleplus" >
<i class="fab fa-google-plus-g" title="googleplus"></i>
<span class="screen-reader-text">googleplus</span>
</a>
</li>
<li>
<a href="chang0206" class="twitter" target="_blank">
<i class="fab fa-twitter-square" title="twitter"></i>
<span class="screen-reader-text">twitter</span>
</a>
</li>
<li>
<a href="chang0206" class="instagram" target="_blank">
<i class="fab fa-instagram" title="instagram"></i>
<span class="screen-reader-text">instagram</span>
</a>
</li>
<li>
<a href="mailto:mc@hotshraingmy.info" class="email">
<i class="fas fa-envelope" title="email"></i>
<span class="screen-reader-text">email</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20linkedin" class="linkedin" target="_blank">
<i class="fab fa-linkedin-in" title="linkedin"></i>
<span class="screen-reader-text">linkedin</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20stackoverflow" class="stackoverflow" target="_blank">
<i class="fab fa-stack-overflow" title="stackoverflow"></i>
<span class="screen-reader-text">stackoverflow</span>
</a>
</li>
<li>
<a href="changchichung" class="github" target="_blank">
<i class="fab fa-github" title="github"></i>
<span class="screen-reader-text">github</span>
</a>
</li>
<li>
<a href="full%20profile%20url%20in%20pinterest" class="pinterest" target="_blank">
<i class="fab fa-pinterest" title="pinterest"></i>
<span class="screen-reader-text">pinterest</span>
</a>
</li>
<li>
<a href="https://h.cowbay.org/index.xml" data-animate-hover="pulse" class="rss" target="_blank">
<i class="fas fa-rss" title="rss"></i>
<span class="screen-reader-text">rss</span>
</a>
</li>
</ul> <div class="design-credit">
<p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
<p>A port of Tracks by Compete Themes.</p>
</div>
</footer>
</div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body>
</html>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,16 +331,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p> <p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p>
<p>所以在每次執行的時候,都要加入 tee 的指令</p> <p>所以在每次執行的時候,都要加入 tee 的指令</p>
<p>像是</p> <p>像是</p>
<pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log <pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
</code></pre> </code></pre><p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>反正也沒有人關心結果怎樣 (攤手</p> <p>反正也沒有人關心結果怎樣 (攤手</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/another-way-to-keep-ansible-log/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/another-way-to-keep-ansible-log/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -401,11 +391,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為工作上的需要要修改client端的 /etc/environment 檔案</p> <p>因為工作上的需要要修改client端的 /etc/environment 檔案</p>
<p>在有權限使用proxy 服務的user的環境中加入proxy 的設定</p> <p>在有權限使用proxy 服務的user的環境中加入proxy 的設定</p>
<p>原本的清單中有host/user/ip 這幾個值可以拿來判斷</p> <p>原本的清單中有host/user/ip 這幾個值可以拿來判斷</p>
<p>proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment</p> <p>proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -462,9 +449,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>在ansible中關於如何引用自定義的變數一直讓我很頭疼</p> <p>在ansible中關於如何引用自定義的變數一直讓我很頭疼</p>
<p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p> <p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p>
<p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p> <p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -596,7 +581,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -608,6 +593,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>ansible on MC部落</title> <title>ansible on MC部落</title>
@ -18,16 +18,10 @@
<guid>https://h.cowbay.org/post/another-way-to-keep-ansible-log/</guid> <guid>https://h.cowbay.org/post/another-way-to-keep-ansible-log/</guid>
<description>&lt;p&gt;之前為了能夠在執行完 ansible playbook 後能有個log 可以看&lt;/p&gt; <description>&lt;p&gt;之前為了能夠在執行完 ansible playbook 後能有個log 可以看&lt;/p&gt;
&lt;p&gt;所以在每次執行的時候,都要加入 tee 的指令&lt;/p&gt; &lt;p&gt;所以在每次執行的時候,都要加入 tee 的指令&lt;/p&gt;
&lt;p&gt;像是&lt;/p&gt; &lt;p&gt;像是&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log &lt;pre&gt;&lt;code&gt;ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
&lt;/code&gt;&lt;/pre&gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;一直都是放在crontab 裡面執行,也就沒有去管他&lt;/p&gt;
&lt;p&gt;一直都是放在crontab 裡面執行,也就沒有去管他&lt;/p&gt;
&lt;p&gt;反正也沒有人關心結果怎樣 (攤手&lt;/p&gt;</description> &lt;p&gt;反正也沒有人關心結果怎樣 (攤手&lt;/p&gt;</description>
</item> </item>
@ -38,11 +32,8 @@
<guid>https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/</guid> <guid>https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/</guid>
<description>&lt;p&gt;因為工作上的需要要修改client端的 /etc/environment 檔案&lt;/p&gt; <description>&lt;p&gt;因為工作上的需要要修改client端的 /etc/environment 檔案&lt;/p&gt;
&lt;p&gt;在有權限使用proxy 服務的user的環境中加入proxy 的設定&lt;/p&gt; &lt;p&gt;在有權限使用proxy 服務的user的環境中加入proxy 的設定&lt;/p&gt;
&lt;p&gt;原本的清單中有host/user/ip 這幾個值可以拿來判斷&lt;/p&gt; &lt;p&gt;原本的清單中有host/user/ip 這幾個值可以拿來判斷&lt;/p&gt;
&lt;p&gt;proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment&lt;/p&gt;</description> &lt;p&gt;proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment&lt;/p&gt;</description>
</item> </item>
@ -53,9 +44,7 @@
<guid>https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/</guid>
<description>&lt;p&gt;在ansible中關於如何引用自定義的變數一直讓我很頭疼&lt;/p&gt; <description>&lt;p&gt;在ansible中關於如何引用自定義的變數一直讓我很頭疼&lt;/p&gt;
&lt;p&gt;尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數&lt;/p&gt; &lt;p&gt;尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數&lt;/p&gt;
&lt;p&gt;這次還是用selectattr 來處理,希望下次能夠記得&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;這次還是用selectattr 來處理,希望下次能夠記得&amp;hellip;&lt;/p&gt;</description>
</item> </item>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Categories on MC部落</title> <title>Categories on MC部落</title>
@ -6,7 +6,7 @@
<description>Recent content in Categories on MC部落</description> <description>Recent content in Categories on MC部落</description>
<generator>Hugo -- gohugo.io</generator> <generator>Hugo -- gohugo.io</generator>
<language>en-us</language> <language>en-us</language>
<lastBuildDate>Tue, 20 Jul 2021 09:19:47 +0800</lastBuildDate> <lastBuildDate>Thu, 26 Aug 2021 12:08:43 +0800</lastBuildDate>
<atom:link href="https://h.cowbay.org/categories/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://h.cowbay.org/categories/index.xml" rel="self" type="application/rss+xml" />
@ -14,7 +14,7 @@
<item> <item>
<title>筆記</title> <title>筆記</title>
<link>https://h.cowbay.org/categories/%E7%AD%86%E8%A8%98/</link> <link>https://h.cowbay.org/categories/%E7%AD%86%E8%A8%98/</link>
<pubDate>Tue, 20 Jul 2021 09:19:47 +0800</pubDate> <pubDate>Thu, 26 Aug 2021 12:08:43 +0800</pubDate>
<guid>https://h.cowbay.org/categories/%E7%AD%86%E8%A8%98/</guid> <guid>https://h.cowbay.org/categories/%E7%AD%86%E8%A8%98/</guid>
<description></description> <description></description>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,11 +331,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。</p> <p>工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。</p>
<p>以前都是傻傻的用 scp 傳檔案</p> <p>以前都是傻傻的用 scp 傳檔案</p>
<p>之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行</p> <p>之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行</p>
<p>早上研究了一下,順便做個筆記。</p> <p>早上研究了一下,順便做個筆記。</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -471,7 +464,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -483,6 +476,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>linux on MC部落</title> <title>linux on MC部落</title>
@ -18,11 +18,8 @@
<guid>https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/</guid> <guid>https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/</guid>
<description>&lt;p&gt;工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。&lt;/p&gt; <description>&lt;p&gt;工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。&lt;/p&gt;
&lt;p&gt;以前都是傻傻的用 scp 傳檔案&lt;/p&gt; &lt;p&gt;以前都是傻傻的用 scp 傳檔案&lt;/p&gt;
&lt;p&gt;之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行&lt;/p&gt; &lt;p&gt;之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行&lt;/p&gt;
&lt;p&gt;早上研究了一下,順便做個筆記。&lt;/p&gt;</description> &lt;p&gt;早上研究了一下,順便做個筆記。&lt;/p&gt;</description>
</item> </item>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,15 +331,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前幾天接的一個case</p> <p>前幾天接的一個case</p>
<p>因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)</p> <p>因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)</p>
<p>改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)</p> <p>改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)</p>
<p>storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C</p> <p>storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C</p>
<p>既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡</p> <p>既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡</p>
<p>一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡</p> <p>一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -475,7 +466,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -487,6 +478,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Proxmox on MC部落</title> <title>Proxmox on MC部落</title>
@ -18,15 +18,10 @@
<guid>https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/</guid> <guid>https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/</guid>
<description>&lt;p&gt;前幾天接的一個case&lt;/p&gt; <description>&lt;p&gt;前幾天接的一個case&lt;/p&gt;
&lt;p&gt;因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)&lt;/p&gt; &lt;p&gt;因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)&lt;/p&gt;
&lt;p&gt;改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)&lt;/p&gt; &lt;p&gt;改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)&lt;/p&gt;
&lt;p&gt;storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C&lt;/p&gt; &lt;p&gt;storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C&lt;/p&gt;
&lt;p&gt;既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡&lt;/p&gt; &lt;p&gt;既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡&lt;/p&gt;
&lt;p&gt;一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡&lt;/p&gt;</description> &lt;p&gt;一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡&lt;/p&gt;</description>
</item> </item>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -410,7 +406,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -422,6 +418,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>PS on MC部落</title> <title>PS on MC部落</title>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,13 +331,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在做一台老機器的P2V</p> <p>最近在做一台老機器的P2V</p>
<p>偏偏user說不能關機所以我用dd + ssh 做線上移轉</p> <p>偏偏user說不能關機所以我用dd + ssh 做線上移轉</p>
<p>這部份有空再來寫</p> <p>這部份有空再來寫</p>
<p>只是因為原來的設定有用mdadm 做raid1</p> <p>只是因為原來的設定有用mdadm 做raid1</p>
<p>這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機</p> <p>這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -473,7 +465,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -485,6 +477,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>碎念 on MC部落</title> <title>碎念 on MC部落</title>
@ -18,13 +18,9 @@
<guid>https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/</guid> <guid>https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/</guid>
<description>&lt;p&gt;最近在做一台老機器的P2V&lt;/p&gt; <description>&lt;p&gt;最近在做一台老機器的P2V&lt;/p&gt;
&lt;p&gt;偏偏user說不能關機所以我用dd + ssh 做線上移轉&lt;/p&gt; &lt;p&gt;偏偏user說不能關機所以我用dd + ssh 做線上移轉&lt;/p&gt;
&lt;p&gt;這部份有空再來寫&lt;/p&gt; &lt;p&gt;這部份有空再來寫&lt;/p&gt;
&lt;p&gt;只是因為原來的設定有用mdadm 做raid1&lt;/p&gt; &lt;p&gt;只是因為原來的設定有用mdadm 做raid1&lt;/p&gt;
&lt;p&gt;這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機&lt;/p&gt;</description> &lt;p&gt;這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機&lt;/p&gt;</description>
</item> </item>

@ -21,8 +21,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/categories\/%E7%AD%86%E8%A8%98\/", "url" : "https:\/\/h.cowbay.org\/categories\/%E7%AD%86%E8%A8%98\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,9 +331,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案</p> <p>最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案</p>
<p>之前是用 gohttpd 來做</p> <p>之前是用 gohttpd 來做</p>
<p>可是不支援線上編輯 yaml 檔案</p> <p>可是不支援線上編輯 yaml 檔案</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/cloudcmd-web-file-manager/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/cloudcmd-web-file-manager/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -394,7 +388,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點</p> <p>感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點</p>
<p>就把系統弄起來玩玩看順便建立ansible 的playbook</p> <p>就把系統弄起來玩玩看順便建立ansible 的playbook</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -451,7 +444,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。</p> <p>最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。</p>
<p>Breaks here</p> <p>Breaks here</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -508,15 +500,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題</p> <p>之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題</p>
<p>也不用煩惱怎麼去更新一堆有的沒的</p> <p>也不用煩惱怎麼去更新一堆有的沒的</p>
<p>不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況</p> <p>不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況</p>
<p>雖然可以從caddy 上面取得這些檔案</p> <p>雖然可以從caddy 上面取得這些檔案</p>
<p>但是基本上這些檔案都是綁定一個特定的hostname</p> <p>但是基本上這些檔案都是綁定一個特定的hostname</p>
<p>可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )</p> <p>可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -573,15 +560,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>手機上的廣告越來越討厭了</p> <p>手機上的廣告越來越討厭了</p>
<p>但是用手機看頁面、影片的機會越來越高</p> <p>但是用手機看頁面、影片的機會越來越高</p>
<p>所以一直想看看有沒有什麼方式可以解決這個問題</p> <p>所以一直想看看有沒有什麼方式可以解決這個問題</p>
<p>不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉</p> <p>不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉</p>
<p>在github上面看到有個專案是 wireguard + pihole</p> <p>在github上面看到有個專案是 wireguard + pihole</p>
<p>滿有趣的,就來研究一下</p> <p>滿有趣的,就來研究一下</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -638,25 +620,15 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在玩ansible + openwrt + wireguard</p> <p>最近在玩ansible + openwrt + wireguard</p>
<p>ansible 腳本寫好之後可以把config 佈署到 openwrt 上</p> <p>ansible 腳本寫好之後可以把config 佈署到 openwrt 上</p>
<p>當然前提是最好用同樣的機器不同的機器在config 上會有一些差異</p> <p>當然前提是最好用同樣的機器不同的機器在config 上會有一些差異</p>
<p>但是這些差異常常就會造成無法連線、無法使用的狀況</p> <p>但是這些差異常常就會造成無法連線、無法使用的狀況</p>
<p>BTW 我是用 ubiquiti 的 edgerouter X 來做</p> <p>BTW 我是用 ubiquiti 的 edgerouter X 來做</p>
<p>都弄好之後就想說來跑個iperf3 測試一下連線速度</p> <p>都弄好之後就想說來跑個iperf3 測試一下連線速度</p>
<p>也好和之前做的 IPSEC 比較一下</p> <p>也好和之前做的 IPSEC 比較一下</p>
<p>結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config</p> <p>結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config</p>
<p>但是有一台edgerouter X 的VPN 連接速度就是特別慢</p> <p>但是有一台edgerouter X 的VPN 連接速度就是特別慢</p>
<p>而且速度都剛好卡在 99.X Mb 左右</p> <p>而且速度都剛好卡在 99.X Mb 左右</p>
<p>就讓我很納悶了&hellip;</p> <p>就讓我很納悶了&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/check-port-speed-in-openwrt/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/check-port-speed-in-openwrt/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -713,19 +685,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>上禮拜某天在開會的時候LINE不斷傳來訊息</p> <p>上禮拜某天在開會的時候LINE不斷傳來訊息</p>
<p>不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了</p> <p>不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了</p>
<p>看來大概有啥事發生</p> <p>看來大概有啥事發生</p>
<p>不過畢竟不是正職的工作,就先放著吧</p> <p>不過畢竟不是正職的工作,就先放著吧</p>
<p>後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我</p> <p>後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我</p>
<p>叫我趕快連進去看</p> <p>叫我趕快連進去看</p>
<p>是說,啊我又沒跟人家簽維護,趕什麼趕&hellip;</p> <p>是說,啊我又沒跟人家簽維護,趕什麼趕&hellip;</p>
<p>總之,開完會後就了解一下狀況</p> <p>總之,開完會後就了解一下狀況</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/debian-buster-server-been-hacked/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/debian-buster-server-been-hacked/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -782,13 +747,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)</p> <p>工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)</p>
<p>結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了</p> <p>結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了</p>
<p>手動下指令也啟動不了</p> <p>手動下指令也啟動不了</p>
<p>查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包</p> <p>查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包</p>
<p>看來就連kernel 最好都不要自動升級&hellip;</p> <p>看來就連kernel 最好都不要自動升級&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -845,9 +806,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>ubuntu 18.04 預設移掉了 /etc/rc.local 的功能</p> <p>ubuntu 18.04 預設移掉了 /etc/rc.local 的功能</p>
<p>變成要用 systemd 的方式來運作,可是有點難用…</p> <p>變成要用 systemd 的方式來運作,可是有點難用…</p>
<p>紀錄一下步驟,再來研究怎麼整合到 preseed 裡面</p> <p>紀錄一下步驟,再來研究怎麼整合到 preseed 裡面</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-preseeds/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-preseeds/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -904,11 +863,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04</p> <p>這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04</p>
<p>在安裝完成後,會發出郵件通知管理者已經安裝完成</p> <p>在安裝完成後,會發出郵件通知管理者已經安裝完成</p>
<p>可是某次ansible 更新之後,反而沒辦法安裝完成</p> <p>可是某次ansible 更新之後,反而沒辦法安裝完成</p>
<p>這次順手修改一下同時更新了ansible 的template</p> <p>這次順手修改一下同時更新了ansible 的template</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1404-preseed/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1404-preseed/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -965,15 +921,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>ubuntu 18.04 的 DNS 設定很煩</p> <p>ubuntu 18.04 的 DNS 設定很煩</p>
<p>系統預設會用NetworkManager 去管理</p> <p>系統預設會用NetworkManager 去管理</p>
<p>然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式</p> <p>然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式</p>
<p>之前都是很粗暴的停用 NetworkManager</p> <p>之前都是很粗暴的停用 NetworkManager</p>
<p>但是用筆電的user 又需要用 NetworkManager 來管理無線網路</p> <p>但是用筆電的user 又需要用 NetworkManager 來管理無線網路</p>
<p>今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf</p> <p>今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1029,16 +980,11 @@ if (!doNotTrack) {
</div> </div>
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 <sup>4</sup>&frasl;<sub>17</sub></p> <p>早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 4/17</p>
<p>想說快到期了,看看能不能線上申請展延</p> <p>想說快到期了,看看能不能線上申請展延</p>
<p>結果辦公室沒有Linux 可以用的讀卡機</p> <p>結果辦公室沒有Linux 可以用的讀卡機</p>
<p>OOXX 咧我們可是號稱全Linux 環境捏!</p> <p>OOXX 咧我們可是號稱全Linux 環境捏!</p>
<p>結果居然沒有對應的硬體!?</p> <p>結果居然沒有對應的硬體!?</p>
<p>於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!</p> <p>於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1095,11 +1041,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+</p> <p>前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+</p>
<p>詳情請看 <a href="https://h.cowbay.org/post/first-try-synology-ha/">https://h.cowbay.org/post/first-try-synology-ha/</a></p> <p>詳情請看 <a href="https://h.cowbay.org/post/first-try-synology-ha/">https://h.cowbay.org/post/first-try-synology-ha/</a></p>
<p>今天趁尾牙前夕,手邊沒啥要緊事</p> <p>今天趁尾牙前夕,手邊沒啥要緊事</p>
<p>就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境</p> <p>就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/proxmox-with-synology-high-availability/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/proxmox-with-synology-high-availability/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1156,15 +1099,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了</p> <p>上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了</p>
<p>原因應該就是之前的 intel c2000 series cpu 的 bug</p> <p>原因應該就是之前的 intel c2000 series cpu 的 bug</p>
<p>只是不知道為什麼這台兩三年來都沒有關機的NAS</p> <p>只是不知道為什麼這台兩三年來都沒有關機的NAS</p>
<p>比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)</p> <p>比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)</p>
<p>趁著這次機會,看看網路上說的換電阻大法有沒有用!</p> <p>趁著這次機會,看看網路上說的換電阻大法有沒有用!</p>
<p>如果有用,就拿這兩台來玩玩 synology high availability !</p> <p>如果有用,就拿這兩台來玩玩 synology high availability !</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/first-try-synology-ha/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/first-try-synology-ha/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1221,11 +1159,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench</p> <p>昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench</p>
<p>分數大概如何,想要跟他的筆電做個比較</p> <p>分數大概如何,想要跟他的筆電做個比較</p>
<p>之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本</p> <p>之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本</p>
<p>對於pgbench 跑分會有多大的影響</p> <p>對於pgbench 跑分會有多大的影響</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-pgbench-benchmark/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-pgbench-benchmark/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1282,9 +1217,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!</p> <p>2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!</p>
<p>因為群暉的文件在最關鍵的一步寫得亂七八糟!</p> <p>因為群暉的文件在最關鍵的一步寫得亂七八糟!</p>
<p>所以在這邊紀錄一下我操作的步驟!</p> <p>所以在這邊紀錄一下我操作的步驟!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1341,11 +1274,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天在寫一支客製化 firefox 的playbook</p> <p>今天在寫一支客製化 firefox 的playbook</p>
<p>因為firefox 會給每個user 建立一個由亂數字串組成的default profile</p> <p>因為firefox 會給每個user 建立一個由亂數字串組成的default profile</p>
<p>所以每個user的 default profile 都不同</p> <p>所以每個user的 default profile 都不同</p>
<p>也因此在用register處理的時候碰到了一些問題</p> <p>也因此在用register處理的時候碰到了一些問題</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-get-value-from-loop-register/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-get-value-from-loop-register/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1402,13 +1332,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent</p> <p>正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent</p>
<p>總之就是在寫一隻ansible playbook</p> <p>總之就是在寫一隻ansible playbook</p>
<p>目的是用來安裝、設定 firefox</p> <p>目的是用來安裝、設定 firefox</p>
<p>包含安裝 firefox addon</p> <p>包含安裝 firefox addon</p>
<p>但是一開始在執行的時候,碰到了一些錯誤</p> <p>但是一開始在執行的時候,碰到了一些錯誤</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-ssh-forwardagent/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-ssh-forwardagent/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1465,15 +1391,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面</p> <p>老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面</p>
<p>但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)</p> <p>但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)</p>
<p>在找資料的時候發現了這個postgresql 的 pg_prewarm extension</p> <p>在找資料的時候發現了這個postgresql 的 pg_prewarm extension</p>
<p>好像有點意思?就來測試看看吧!</p> <p>好像有點意思?就來測試看看吧!</p>
<p>只是目前還不知道該怎麼解讀測試的數據就是了&hellip;</p> <p>只是目前還不知道該怎麼解讀測試的數據就是了&hellip;</p>
<p>幹!林北真的不是 DBA 啦 =.=</p> <p>幹!林北真的不是 DBA 啦 =.=</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/test-pg_prewarm/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/test-pg_prewarm/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1530,9 +1451,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>剛剛在跑一個修改過的playbook卻發現一個詭異的狀況</p> <p>剛剛在跑一個修改過的playbook卻發現一個詭異的狀況</p>
<p>在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄</p> <p>在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄</p>
<p>怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤</p> <p>怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1589,11 +1508,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這幾天在ansible 寫了一份新的playbook給developer 用</p> <p>這幾天在ansible 寫了一份新的playbook給developer 用</p>
<p>然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon</p> <p>然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon</p>
<p>我才發現原來之前的寫法不能用在 ubuntu 18.04 上</p> <p>我才發現原來之前的寫法不能用在 ubuntu 18.04 上</p>
<p>只好又弄了一份出來</p> <p>只好又弄了一份出來</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1650,19 +1566,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04</p> <p>最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04</p>
<p>因為公司政策的關係所以現在要連接internet ,需要申請</p> <p>因為公司政策的關係所以現在要連接internet ,需要申請</p>
<p>然後 user 再去系統的proxy 設定新增一個 PAC 檔</p> <p>然後 user 再去系統的proxy 設定新增一個 PAC 檔</p>
<p>但是這個動作其實是去叫NetworkManager 這個服務</p> <p>但是這個動作其實是去叫NetworkManager 這個服務</p>
<p>可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定</p> <p>可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定</p>
<p>所以想試試看有沒有辦法不使用 NetworkManager 服務</p> <p>所以想試試看有沒有辦法不使用 NetworkManager 服務</p>
<p>又能夠在 user level 修改 proxy 參數</p> <p>又能夠在 user level 修改 proxy 參數</p>
<p>就想到了用 dconf 來做</p> <p>就想到了用 dconf 來做</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1719,11 +1628,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案</p> <p>最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案</p>
<p>就不小心發現了這個 streisand</p> <p>就不小心發現了這個 streisand</p>
<p><a href="https://github.com/StreisandEffect/streisand">https://github.com/StreisandEffect/streisand</a></p> <p><a href="https://github.com/StreisandEffect/streisand">https://github.com/StreisandEffect/streisand</a></p>
<p>玩了一下發現這根本就是終極的VPN Server solution ..</p> <p>玩了一下發現這根本就是終極的VPN Server solution ..</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1780,15 +1686,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近都在弄postgresql</p> <p>最近都在弄postgresql</p>
<p>備份、還原測試得差不多了,就等著看到時候要用什麼方式</p> <p>備份、還原測試得差不多了,就等著看到時候要用什麼方式</p>
<p>前幾天看到 pg_auto_failover 這個postgresql 的extension</p> <p>前幾天看到 pg_auto_failover 這個postgresql 的extension</p>
<p><a href="https://github.com/citusdata/pg_auto_failover">https://github.com/citusdata/pg_auto_failover</a></p> <p><a href="https://github.com/citusdata/pg_auto_failover">https://github.com/citusdata/pg_auto_failover</a></p>
<p>感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA</p> <p>感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA</p>
<p>不過,反正當作練功嘛,多測試一套也不錯!</p> <p>不過,反正當作練功嘛,多測試一套也不錯!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -1902,9 +1803,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前面測試了用pgbarman / pgbackrest 來備份 postgresql</p> <p>前面測試了用pgbarman / pgbackrest 來備份 postgresql</p>
<p>這次改從system file level 來下手</p> <p>這次改從system file level 來下手</p>
<p>採用zfs 的快照來備份、還原postgresql 資料庫</p> <p>採用zfs 的快照來備份、還原postgresql 資料庫</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2071,11 +1970,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>很久以前就有看到這個用來備份postgresql 的 pgbarman</p> <p>很久以前就有看到這個用來備份postgresql 的 pgbarman</p>
<p><a href="https://www.pgbarman.org/">https://www.pgbarman.org/</a></p> <p><a href="https://www.pgbarman.org/">https://www.pgbarman.org/</a></p>
<p>前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看</p> <p>前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看</p>
<p>不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&hellip;</p> <p>不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2132,11 +2028,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為老闆說要試試看用GPU 來跑postgresql 威力</p> <p>因為老闆說要試試看用GPU 來跑postgresql 威力</p>
<p>手邊剛好有一張 geforce gt 720</p> <p>手邊剛好有一張 geforce gt 720</p>
<p>一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援</p> <p>一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援</p>
<p>就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&hellip;</p> <p>就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2193,17 +2086,11 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立</p> <p>最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立</p>
<p>想說再打個VPN tunnel 來當跳板連 ptt 好了</p> <p>想說再打個VPN tunnel 來當跳板連 ptt 好了</p>
<p>因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境</p> <p>因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境</p>
<p>本來是在vultr 的VPS上面建立這個tunnel</p> <p>本來是在vultr 的VPS上面建立這個tunnel</p>
<p>但是那台VPS連去ptt 很頓,卡卡的</p> <p>但是那台VPS連去ptt 很頓,卡卡的</p>
<p>所以改用google cloud platform 的free tier 來做</p> <p>所以改用google cloud platform 的free tier 來做</p>
<p>反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態</p> <p>反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2260,15 +2147,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN</p> <p>因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN</p>
<p>雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了</p> <p>雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了</p>
<p>完全沒辦法了解當時設計的邏輯造成後續debug 困難</p> <p>完全沒辦法了解當時設計的邏輯造成後續debug 困難</p>
<p>可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌</p> <p>可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌</p>
<p>之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點</p> <p>之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點</p>
<p>這次試試看躲在gateway後面看看能不能建立多點的VPN環境</p> <p>這次試試看躲在gateway後面看看能不能建立多點的VPN環境</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2325,23 +2207,14 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt</p> <p>之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt</p>
<p>然後用strongswan 來打 IPSEC site to site VPN</p> <p>然後用strongswan 來打 IPSEC site to site VPN</p>
<p>config 看起來不是很難 (只是看起來)</p> <p>config 看起來不是很難 (只是看起來)</p>
<p>但是實際上已經找不到當初的文件</p> <p>但是實際上已經找不到當初的文件</p>
<p>所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)</p> <p>所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)</p>
<p>後來採購了兩台edgerouter X 做測試</p> <p>後來採購了兩台edgerouter X 做測試</p>
<p>也用openvpn 成功的建立了 site to site VPN</p> <p>也用openvpn 成功的建立了 site to site VPN</p>
<p>本來想說 openvpn 已經夠簡單了</p> <p>本來想說 openvpn 已經夠簡單了</p>
<p>今天看到文章說用wireguard 可以更簡單</p> <p>今天看到文章說用wireguard 可以更簡單</p>
<p>於是研究了一下,發現還真的很簡單!</p> <p>於是研究了一下,發現還真的很簡單!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2398,19 +2271,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近有個任務需要大量安裝client</p> <p>最近有個任務需要大量安裝client</p>
<p>想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot</p> <p>想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot</p>
<p>然後選擇OS版本就可以自動進行安裝</p> <p>然後選擇OS版本就可以自動進行安裝</p>
<p>安裝完成後會自動重新開機接著就用ansible來做user環境設定</p> <p>安裝完成後會自動重新開機接著就用ansible來做user環境設定</p>
<p>PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了</p> <p>PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了</p>
<p>可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機</p> <p>可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機</p>
<p>就送出一封郵件來通知我說已經完成安裝可以執行ansible 了</p> <p>就送出一封郵件來通知我說已經完成安裝可以執行ansible 了</p>
<p>看似很簡單的一件事情,卻搞了我兩天&hellip;.</p> <p>看似很簡單的一件事情,卻搞了我兩天&hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2467,13 +2333,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體</p> <p>之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體</p>
<p>但是如果要過 internet 就會碰到各種開port的問題</p> <p>但是如果要過 internet 就會碰到各種開port的問題</p>
<p>在這種環境下,就有了當時 teamviewer 的橫空出世</p> <p>在這種環境下,就有了當時 teamviewer 的橫空出世</p>
<p>解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多</p> <p>解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多</p>
<p>只要下載teamviewer被控端開啟後報ID 給協助者就好了</p> <p>只要下載teamviewer被控端開啟後報ID 給協助者就好了</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/remote-management-system-meshcentral/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/remote-management-system-meshcentral/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2530,7 +2392,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致</p> <p>最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致</p>
<p>有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&hellip;.</p> <p>有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-timezone-in-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-timezone-in-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2587,13 +2448,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&hellip;.</p> <p>最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&hellip;.</p>
<p>然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著</p> <p>然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著</p>
<p>所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!</p> <p>所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!</p>
<p>也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了</p> <p>也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了</p>
<p>然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!</p> <p>然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/inx-collect-detail-hardware-info/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/inx-collect-detail-hardware-info/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2650,11 +2507,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案</p> <p>今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案</p>
<p>居然不知為何自己產生了,在我記憶中沒有去執行過那個指令</p> <p>居然不知為何自己產生了,在我記憶中沒有去執行過那個指令</p>
<p>翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)</p> <p>翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)</p>
<p>所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份</p> <p>所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/log-all-bash-commands/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/log-all-bash-commands/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2711,9 +2565,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試</p> <p>今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試</p>
<p>想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate</p> <p>想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate</p>
<p>可是一直出現device busy的錯誤訊息</p> <p>可是一直出現device busy的錯誤訊息</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2770,7 +2622,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。</p> <p>公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。</p>
<p>看起來不難搞,事實上&hellip;..</p> <p>看起來不難搞,事實上&hellip;..</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-cent62-using-rsync/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-cent62-using-rsync/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2827,11 +2678,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook</p> <p>最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook</p>
<p>因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體</p> <p>因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體</p>
<p>可以很簡單快速的備份、恢復系統狀態</p> <p>可以很簡單快速的備份、恢復系統狀態</p>
<p>可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&hellip;.</p> <p>可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2888,7 +2736,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>買了一張 DELL 6/iR 低階的raid 卡</p> <p>買了一張 DELL 6/iR 低階的raid 卡</p>
<p>來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&hellip;</p> <p>來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -2945,9 +2792,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上</p> <p>最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上</p>
<p>因為新開的機器大部分都是在proxmox上所以很少碰實體機器了</p> <p>因為新開的機器大部分都是在proxmox上所以很少碰實體機器了</p>
<p>結果在安裝過程中做raid碰到一些問題來紀錄一下</p> <p>結果在安裝過程中做raid碰到一些問題來紀錄一下</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3004,11 +2849,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp; Server Backup</p> <p>這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp; Server Backup</p>
<p>因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10</p> <p>因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10</p>
<p>然後把Freenas 安裝在隨身碟上</p> <p>然後把Freenas 安裝在隨身碟上</p>
<p>不過會一直出現Smartd failed to start 的錯誤訊息</p> <p>不過會一直出現Smartd failed to start 的錯誤訊息</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3065,11 +2907,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為工作的關係現在很多時間都花在VIM的操作上</p> <p>因為工作的關係現在很多時間都花在VIM的操作上</p>
<p>所以之前花了滿多時間調整出一個適合自己的VIM環境</p> <p>所以之前花了滿多時間調整出一個適合自己的VIM環境</p>
<p>原本的作法是把這個設定好的環境丟到自己建立的gitea 上面</p> <p>原本的作法是把這個設定好的環境丟到自己建立的gitea 上面</p>
<p>然後每到一台新的機器就要去clone 下來</p> <p>然後每到一台新的機器就要去clone 下來</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/create-portable-vim-environment/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/create-portable-vim-environment/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3126,21 +2965,13 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>想做一個 10G 的 LAB 環境出來已經很久了。</p> <p>想做一個 10G 的 LAB 環境出來已經很久了。</p>
<p>只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜</p> <p>只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜</p>
<p>如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)</p> <p>如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)</p>
<p>所以一直沒有付諸行動。</p> <p>所以一直沒有付諸行動。</p>
<p>硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)</p> <p>硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)</p>
<p>聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位</p> <p>聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位</p>
<p>就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線</p> <p>就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線</p>
<p>就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到</p> <p>就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到</p>
<p>今天就花了點時間測試一下</p> <p>今天就花了點時間測試一下</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3197,9 +3028,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>在上一篇 <a href="https://h.cowbay.org/post/ansible-selectattr/">Ansible how to use &lsquo;list&rsquo; in yaml file </a></p> <p>在上一篇 <a href="https://h.cowbay.org/post/ansible-selectattr/">Ansible how to use &lsquo;list&rsquo; in yaml file </a></p>
<p>有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單</p> <p>有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單</p>
<p>不過就是有點醜</p> <p>不過就是有點醜</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-filter/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-filter/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3256,11 +3085,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這幾天在玩ansible 時,碰到一個問題</p> <p>這幾天在玩ansible 時,碰到一個問題</p>
<p>假如我有個yaml檔作為資料來源檔名是 abc.yml</p> <p>假如我有個yaml檔作為資料來源檔名是 abc.yml</p>
<p>大概長這樣</p> <p>大概長這樣</p>
<pre><code> &quot;teams&quot;: [ <pre><code> &quot;teams&quot;: [
{ {
&quot;chinese_name&quot;: &quot;TEAM1&quot;, &quot;chinese_name&quot;: &quot;TEAM1&quot;,
@ -3354,11 +3180,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在測試metabase記得幾個月前就有測試過</p> <p>最近在測試metabase記得幾個月前就有測試過</p>
<p>但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的</p> <p>但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的</p>
<p>所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)</p> <p>所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)</p>
<p>不過呢,很討厭的是,一進去就發現語系採用的是簡體中文</p> <p>不過呢,很討厭的是,一進去就發現語系採用的是簡體中文</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-preferred-language-in-firefox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-preferred-language-in-firefox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3415,11 +3238,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為工作上的需求有個資料庫需要開放給不同team的人去存取</p> <p>因為工作上的需求有個資料庫需要開放給不同team的人去存取</p>
<p>雖然都是在同一台機器上的同一個資料庫</p> <p>雖然都是在同一台機器上的同一個資料庫</p>
<p>但是希望能夠不同team的人用不同的資料庫使用者</p> <p>但是希望能夠不同team的人用不同的資料庫使用者</p>
<p>這樣萬一出事,會比較好抓兇手??</p> <p>這樣萬一出事,會比較好抓兇手??</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/copy_role_in_pgsql/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/copy_role_in_pgsql/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3476,17 +3296,11 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這是發生在一個夜黑風高的寂寥深夜&hellip;.. ( What The FXXX &hellip; )</p> <p>這是發生在一個夜黑風高的寂寥深夜&hellip;.. ( What The FXXX &hellip; )</p>
<p>來到這個環境之後,有一個很詭異的狀況一直困擾著我</p> <p>來到這個環境之後,有一個很詭異的狀況一直困擾著我</p>
<p>在每個分公司都會有一台伺服器作為KVM Host</p> <p>在每個分公司都會有一台伺服器作為KVM Host</p>
<p>上面跑兩台VM一台作為ansible controller (目前沒作用)</p> <p>上面跑兩台VM一台作為ansible controller (目前沒作用)</p>
<p>另一台作為這邊所謂的 &ldquo;Build Server&rdquo;</p> <p>另一台作為這邊所謂的 &ldquo;Build Server&rdquo;</p>
<p>用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)</p> <p>用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)</p>
<p>問題就發生在這台 Build Server 上&hellip;</p> <p>問題就發生在這台 Build Server 上&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/weird-client-server-connection/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/weird-client-server-connection/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3602,22 +3416,14 @@ if (!doNotTrack) {
</div> </div>
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>Bookstack 是一套非常好用的線上&rdquo;筆記&rdquo;系統</p> <p>Bookstack 是一套非常好用的線上&quot;筆記&quot;系統</p>
<p>他用圖書館/書本的概念,讓使用者可以建立自己的&quot;圖書館&rdquo;</p>
<p>他用圖書館/書本的概念,讓使用者可以建立自己的&rdquo;圖書館&rdquo;</p> <p>同時在圖書館內建立不同的&quot;書籍&rdquo;</p>
<p>同時在圖書館內建立不同的&rdquo;書籍&rdquo;</p>
<p>而且支援 Markdown 語法</p> <p>而且支援 Markdown 語法</p>
<p>其他的方式像是在nextcloud上編輯 md檔案(字體太小)</p> <p>其他的方式像是在nextcloud上編輯 md檔案(字體太小)</p>
<p>或者是boostnote(只能在本機)</p> <p>或者是boostnote(只能在本機)</p>
<p>都或多或少有點小缺點</p> <p>都或多或少有點小缺點</p>
<p>Bookstack則是沒有這些問題不過就是系統「大」了點&hellip;</p> <p>Bookstack則是沒有這些問題不過就是系統「大」了點&hellip;</p>
<p>不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)</p> <p>不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/bookstack-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/bookstack-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -3675,16 +3481,11 @@ if (!doNotTrack) {
<article> <article>
<p>公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file <p>公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file
之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來</p> 之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來</p>
<p>這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體 <p>這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體
像是這篇</p> 像是這篇</p>
<p><a href="https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux">https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux</a></p> <p><a href="https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux">https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux</a></p>
<p>或者是這篇</p> <p>或者是這篇</p>
<p><a href="https://www.maketecheasier.com/mount-google-drive-ubuntu/">https://www.maketecheasier.com/mount-google-drive-ubuntu/</a></p> <p><a href="https://www.maketecheasier.com/mount-google-drive-ubuntu/">https://www.maketecheasier.com/mount-google-drive-ubuntu/</a></p>
<p>但是手邊的伺服器原則上除非有必要不然都沒有開放internet <p>但是手邊的伺服器原則上除非有必要不然都沒有開放internet
所以導致明明檔案就在那邊,但是要取得就是很麻煩</p> 所以導致明明檔案就在那邊,但是要取得就是很麻煩</p>
@ -3817,7 +3618,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -3829,6 +3630,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>筆記 on MC部落</title> <title>筆記 on MC部落</title>
@ -6,11 +6,23 @@
<description>Recent content in 筆記 on MC部落</description> <description>Recent content in 筆記 on MC部落</description>
<generator>Hugo -- gohugo.io</generator> <generator>Hugo -- gohugo.io</generator>
<language>en-us</language> <language>en-us</language>
<lastBuildDate>Tue, 20 Jul 2021 09:19:47 +0800</lastBuildDate> <lastBuildDate>Thu, 26 Aug 2021 12:08:43 +0800</lastBuildDate>
<atom:link href="https://h.cowbay.org/categories/%E7%AD%86%E8%A8%98/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://h.cowbay.org/categories/%E7%AD%86%E8%A8%98/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>auto fetch Wildcard ssl certs with lego &#43; acme-dns ( Domain Register : Namecheap)</title>
<link>https://h.cowbay.org/auto-fetch-wildcard-ssl-certs-acme-dns-lego/</link>
<pubDate>Thu, 26 Aug 2021 12:08:43 +0800</pubDate>
<guid>https://h.cowbay.org/auto-fetch-wildcard-ssl-certs-acme-dns-lego/</guid>
<description>&lt;h3 id=&#34;auto-fetch--wildcard-ssl-certs-with-lego--acme-dns--domain-register--namecheap&#34;&gt;auto fetch Wildcard ssl certs with lego + acme-dns ( Domain Register : Namecheap)&lt;/h3&gt;
&lt;p&gt;自從用了 &lt;a href=&#34;https://github.com/artyom/leproxy&#34;&gt;leproxy&lt;/a&gt; 之後其實就很少在管ssl 憑證的問題,反正&lt;a href=&#34;https://github.com/artyom/leproxy&#34;&gt;leproxy &lt;/a&gt;都會自動處理好&lt;/p&gt;
&lt;p&gt;不過LAN裡面的機器越來越多每次看到警告說沒有加密的訊息就有點不爽之前用了很多方式去申請全域憑證申請倒是還好沒太多問題。但是一碰到要更新就都無法自動因為都會要求去修改DNS 的 TXT 或者是 CNAME 記錄。&lt;/p&gt;
&lt;p&gt;一般來說如果是其他DNS 供應商大部分都會提供API那就還好。 BUT !! (對然生就是離不開這個BUT &amp;hellip;) 我們的域名是老闆在 iwantmyname 買的,一開始是給 webfaction 代管後來webfaction 被godaddy 買走,就轉到 namecheap 去(我也不知道為什麼不在godaddy 就好)。&lt;/p&gt;</description>
</item>
<item> <item>
<title>[筆記] WEB 檔案管理 Cloudcmd Web File Manager</title> <title>[筆記] WEB 檔案管理 Cloudcmd Web File Manager</title>
<link>https://h.cowbay.org/post/cloudcmd-web-file-manager/</link> <link>https://h.cowbay.org/post/cloudcmd-web-file-manager/</link>
@ -18,9 +30,7 @@
<guid>https://h.cowbay.org/post/cloudcmd-web-file-manager/</guid> <guid>https://h.cowbay.org/post/cloudcmd-web-file-manager/</guid>
<description>&lt;p&gt;最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案&lt;/p&gt; <description>&lt;p&gt;最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案&lt;/p&gt;
&lt;p&gt;之前是用 gohttpd 來做&lt;/p&gt; &lt;p&gt;之前是用 gohttpd 來做&lt;/p&gt;
&lt;p&gt;可是不支援線上編輯 yaml 檔案&lt;/p&gt;</description> &lt;p&gt;可是不支援線上編輯 yaml 檔案&lt;/p&gt;</description>
</item> </item>
@ -31,7 +41,6 @@
<guid>https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/</guid> <guid>https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/</guid>
<description>&lt;p&gt;感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點&lt;/p&gt; <description>&lt;p&gt;感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點&lt;/p&gt;
&lt;p&gt;就把系統弄起來玩玩看順便建立ansible 的playbook&lt;/p&gt;</description> &lt;p&gt;就把系統弄起來玩玩看順便建立ansible 的playbook&lt;/p&gt;</description>
</item> </item>
@ -42,7 +51,6 @@
<guid>https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/</guid> <guid>https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/</guid>
<description>&lt;p&gt;最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。&lt;/p&gt; <description>&lt;p&gt;最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。&lt;/p&gt;
&lt;p&gt;Breaks here&lt;/p&gt;</description> &lt;p&gt;Breaks here&lt;/p&gt;</description>
</item> </item>
@ -53,15 +61,10 @@
<guid>https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/</guid> <guid>https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/</guid>
<description>&lt;p&gt;之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題&lt;/p&gt; <description>&lt;p&gt;之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題&lt;/p&gt;
&lt;p&gt;也不用煩惱怎麼去更新一堆有的沒的&lt;/p&gt; &lt;p&gt;也不用煩惱怎麼去更新一堆有的沒的&lt;/p&gt;
&lt;p&gt;不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況&lt;/p&gt; &lt;p&gt;不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況&lt;/p&gt;
&lt;p&gt;雖然可以從caddy 上面取得這些檔案&lt;/p&gt; &lt;p&gt;雖然可以從caddy 上面取得這些檔案&lt;/p&gt;
&lt;p&gt;但是基本上這些檔案都是綁定一個特定的hostname&lt;/p&gt; &lt;p&gt;但是基本上這些檔案都是綁定一個特定的hostname&lt;/p&gt;
&lt;p&gt;可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )&lt;/p&gt;</description> &lt;p&gt;可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )&lt;/p&gt;</description>
</item> </item>
@ -72,15 +75,10 @@
<guid>https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/</guid> <guid>https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/</guid>
<description>&lt;p&gt;手機上的廣告越來越討厭了&lt;/p&gt; <description>&lt;p&gt;手機上的廣告越來越討厭了&lt;/p&gt;
&lt;p&gt;但是用手機看頁面、影片的機會越來越高&lt;/p&gt; &lt;p&gt;但是用手機看頁面、影片的機會越來越高&lt;/p&gt;
&lt;p&gt;所以一直想看看有沒有什麼方式可以解決這個問題&lt;/p&gt; &lt;p&gt;所以一直想看看有沒有什麼方式可以解決這個問題&lt;/p&gt;
&lt;p&gt;不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉&lt;/p&gt; &lt;p&gt;不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉&lt;/p&gt;
&lt;p&gt;在github上面看到有個專案是 wireguard + pihole&lt;/p&gt; &lt;p&gt;在github上面看到有個專案是 wireguard + pihole&lt;/p&gt;
&lt;p&gt;滿有趣的,就來研究一下&lt;/p&gt;</description> &lt;p&gt;滿有趣的,就來研究一下&lt;/p&gt;</description>
</item> </item>
@ -91,25 +89,15 @@
<guid>https://h.cowbay.org/post/check-port-speed-in-openwrt/</guid> <guid>https://h.cowbay.org/post/check-port-speed-in-openwrt/</guid>
<description>&lt;p&gt;最近在玩ansible + openwrt + wireguard&lt;/p&gt; <description>&lt;p&gt;最近在玩ansible + openwrt + wireguard&lt;/p&gt;
&lt;p&gt;ansible 腳本寫好之後可以把config 佈署到 openwrt 上&lt;/p&gt; &lt;p&gt;ansible 腳本寫好之後可以把config 佈署到 openwrt 上&lt;/p&gt;
&lt;p&gt;當然前提是最好用同樣的機器不同的機器在config 上會有一些差異&lt;/p&gt; &lt;p&gt;當然前提是最好用同樣的機器不同的機器在config 上會有一些差異&lt;/p&gt;
&lt;p&gt;但是這些差異常常就會造成無法連線、無法使用的狀況&lt;/p&gt; &lt;p&gt;但是這些差異常常就會造成無法連線、無法使用的狀況&lt;/p&gt;
&lt;p&gt;BTW 我是用 ubiquiti 的 edgerouter X 來做&lt;/p&gt; &lt;p&gt;BTW 我是用 ubiquiti 的 edgerouter X 來做&lt;/p&gt;
&lt;p&gt;都弄好之後就想說來跑個iperf3 測試一下連線速度&lt;/p&gt; &lt;p&gt;都弄好之後就想說來跑個iperf3 測試一下連線速度&lt;/p&gt;
&lt;p&gt;也好和之前做的 IPSEC 比較一下&lt;/p&gt; &lt;p&gt;也好和之前做的 IPSEC 比較一下&lt;/p&gt;
&lt;p&gt;結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config&lt;/p&gt; &lt;p&gt;結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config&lt;/p&gt;
&lt;p&gt;但是有一台edgerouter X 的VPN 連接速度就是特別慢&lt;/p&gt; &lt;p&gt;但是有一台edgerouter X 的VPN 連接速度就是特別慢&lt;/p&gt;
&lt;p&gt;而且速度都剛好卡在 99.X Mb 左右&lt;/p&gt; &lt;p&gt;而且速度都剛好卡在 99.X Mb 左右&lt;/p&gt;
&lt;p&gt;就讓我很納悶了&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;就讓我很納悶了&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -120,19 +108,12 @@
<guid>https://h.cowbay.org/post/debian-buster-server-been-hacked/</guid> <guid>https://h.cowbay.org/post/debian-buster-server-been-hacked/</guid>
<description>&lt;p&gt;上禮拜某天在開會的時候LINE不斷傳來訊息&lt;/p&gt; <description>&lt;p&gt;上禮拜某天在開會的時候LINE不斷傳來訊息&lt;/p&gt;
&lt;p&gt;不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了&lt;/p&gt; &lt;p&gt;不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了&lt;/p&gt;
&lt;p&gt;看來大概有啥事發生&lt;/p&gt; &lt;p&gt;看來大概有啥事發生&lt;/p&gt;
&lt;p&gt;不過畢竟不是正職的工作,就先放著吧&lt;/p&gt; &lt;p&gt;不過畢竟不是正職的工作,就先放著吧&lt;/p&gt;
&lt;p&gt;後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我&lt;/p&gt; &lt;p&gt;後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我&lt;/p&gt;
&lt;p&gt;叫我趕快連進去看&lt;/p&gt; &lt;p&gt;叫我趕快連進去看&lt;/p&gt;
&lt;p&gt;是說,啊我又沒跟人家簽維護,趕什麼趕&amp;hellip;&lt;/p&gt; &lt;p&gt;是說,啊我又沒跟人家簽維護,趕什麼趕&amp;hellip;&lt;/p&gt;
&lt;p&gt;總之,開完會後就了解一下狀況&lt;/p&gt;</description> &lt;p&gt;總之,開完會後就了解一下狀況&lt;/p&gt;</description>
</item> </item>
@ -143,13 +124,9 @@
<guid>https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/</guid> <guid>https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/</guid>
<description>&lt;p&gt;工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)&lt;/p&gt; <description>&lt;p&gt;工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)&lt;/p&gt;
&lt;p&gt;結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了&lt;/p&gt; &lt;p&gt;結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了&lt;/p&gt;
&lt;p&gt;手動下指令也啟動不了&lt;/p&gt; &lt;p&gt;手動下指令也啟動不了&lt;/p&gt;
&lt;p&gt;查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包&lt;/p&gt; &lt;p&gt;查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包&lt;/p&gt;
&lt;p&gt;看來就連kernel 最好都不要自動升級&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;看來就連kernel 最好都不要自動升級&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -160,9 +137,7 @@
<guid>https://h.cowbay.org/post/ubuntu-1804-preseeds/</guid> <guid>https://h.cowbay.org/post/ubuntu-1804-preseeds/</guid>
<description>&lt;p&gt;ubuntu 18.04 預設移掉了 /etc/rc.local 的功能&lt;/p&gt; <description>&lt;p&gt;ubuntu 18.04 預設移掉了 /etc/rc.local 的功能&lt;/p&gt;
&lt;p&gt;變成要用 systemd 的方式來運作,可是有點難用…&lt;/p&gt; &lt;p&gt;變成要用 systemd 的方式來運作,可是有點難用…&lt;/p&gt;
&lt;p&gt;紀錄一下步驟,再來研究怎麼整合到 preseed 裡面&lt;/p&gt;</description> &lt;p&gt;紀錄一下步驟,再來研究怎麼整合到 preseed 裡面&lt;/p&gt;</description>
</item> </item>
@ -173,11 +148,8 @@
<guid>https://h.cowbay.org/post/ubuntu-1404-preseed/</guid> <guid>https://h.cowbay.org/post/ubuntu-1404-preseed/</guid>
<description>&lt;p&gt;這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04&lt;/p&gt; <description>&lt;p&gt;這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04&lt;/p&gt;
&lt;p&gt;在安裝完成後,會發出郵件通知管理者已經安裝完成&lt;/p&gt; &lt;p&gt;在安裝完成後,會發出郵件通知管理者已經安裝完成&lt;/p&gt;
&lt;p&gt;可是某次ansible 更新之後,反而沒辦法安裝完成&lt;/p&gt; &lt;p&gt;可是某次ansible 更新之後,反而沒辦法安裝完成&lt;/p&gt;
&lt;p&gt;這次順手修改一下同時更新了ansible 的template&lt;/p&gt;</description> &lt;p&gt;這次順手修改一下同時更新了ansible 的template&lt;/p&gt;</description>
</item> </item>
@ -188,15 +160,10 @@
<guid>https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/</guid> <guid>https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/</guid>
<description>&lt;p&gt;ubuntu 18.04 的 DNS 設定很煩&lt;/p&gt; <description>&lt;p&gt;ubuntu 18.04 的 DNS 設定很煩&lt;/p&gt;
&lt;p&gt;系統預設會用NetworkManager 去管理&lt;/p&gt; &lt;p&gt;系統預設會用NetworkManager 去管理&lt;/p&gt;
&lt;p&gt;然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式&lt;/p&gt; &lt;p&gt;然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式&lt;/p&gt;
&lt;p&gt;之前都是很粗暴的停用 NetworkManager&lt;/p&gt; &lt;p&gt;之前都是很粗暴的停用 NetworkManager&lt;/p&gt;
&lt;p&gt;但是用筆電的user 又需要用 NetworkManager 來管理無線網路&lt;/p&gt; &lt;p&gt;但是用筆電的user 又需要用 NetworkManager 來管理無線網路&lt;/p&gt;
&lt;p&gt;今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf&lt;/p&gt;</description> &lt;p&gt;今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf&lt;/p&gt;</description>
</item> </item>
@ -206,16 +173,11 @@
<pubDate>Wed, 19 Feb 2020 16:22:38 +0800</pubDate> <pubDate>Wed, 19 Feb 2020 16:22:38 +0800</pubDate>
<guid>https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/</guid>
<description>&lt;p&gt;早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 &lt;sup&gt;4&lt;/sup&gt;&amp;frasl;&lt;sub&gt;17&lt;/sub&gt;&lt;/p&gt; <description>&lt;p&gt;早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 4/17&lt;/p&gt;
&lt;p&gt;想說快到期了,看看能不能線上申請展延&lt;/p&gt; &lt;p&gt;想說快到期了,看看能不能線上申請展延&lt;/p&gt;
&lt;p&gt;結果辦公室沒有Linux 可以用的讀卡機&lt;/p&gt; &lt;p&gt;結果辦公室沒有Linux 可以用的讀卡機&lt;/p&gt;
&lt;p&gt;OOXX 咧我們可是號稱全Linux 環境捏!&lt;/p&gt; &lt;p&gt;OOXX 咧我們可是號稱全Linux 環境捏!&lt;/p&gt;
&lt;p&gt;結果居然沒有對應的硬體!?&lt;/p&gt; &lt;p&gt;結果居然沒有對應的硬體!?&lt;/p&gt;
&lt;p&gt;於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!&lt;/p&gt;</description> &lt;p&gt;於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!&lt;/p&gt;</description>
</item> </item>
@ -226,11 +188,8 @@
<guid>https://h.cowbay.org/post/proxmox-with-synology-high-availability/</guid> <guid>https://h.cowbay.org/post/proxmox-with-synology-high-availability/</guid>
<description>&lt;p&gt;前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+&lt;/p&gt; <description>&lt;p&gt;前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+&lt;/p&gt;
&lt;p&gt;詳情請看 &lt;a href=&#34;https://h.cowbay.org/post/first-try-synology-ha/&#34;&gt;https://h.cowbay.org/post/first-try-synology-ha/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;詳情請看 &lt;a href=&#34;https://h.cowbay.org/post/first-try-synology-ha/&#34;&gt;https://h.cowbay.org/post/first-try-synology-ha/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;今天趁尾牙前夕,手邊沒啥要緊事&lt;/p&gt; &lt;p&gt;今天趁尾牙前夕,手邊沒啥要緊事&lt;/p&gt;
&lt;p&gt;就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境&lt;/p&gt;</description> &lt;p&gt;就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境&lt;/p&gt;</description>
</item> </item>
@ -241,15 +200,10 @@
<guid>https://h.cowbay.org/post/first-try-synology-ha/</guid> <guid>https://h.cowbay.org/post/first-try-synology-ha/</guid>
<description>&lt;p&gt;上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了&lt;/p&gt; <description>&lt;p&gt;上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了&lt;/p&gt;
&lt;p&gt;原因應該就是之前的 intel c2000 series cpu 的 bug&lt;/p&gt; &lt;p&gt;原因應該就是之前的 intel c2000 series cpu 的 bug&lt;/p&gt;
&lt;p&gt;只是不知道為什麼這台兩三年來都沒有關機的NAS&lt;/p&gt; &lt;p&gt;只是不知道為什麼這台兩三年來都沒有關機的NAS&lt;/p&gt;
&lt;p&gt;比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)&lt;/p&gt; &lt;p&gt;比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)&lt;/p&gt;
&lt;p&gt;趁著這次機會,看看網路上說的換電阻大法有沒有用!&lt;/p&gt; &lt;p&gt;趁著這次機會,看看網路上說的換電阻大法有沒有用!&lt;/p&gt;
&lt;p&gt;如果有用,就拿這兩台來玩玩 synology high availability !&lt;/p&gt;</description> &lt;p&gt;如果有用,就拿這兩台來玩玩 synology high availability !&lt;/p&gt;</description>
</item> </item>
@ -260,11 +214,8 @@
<guid>https://h.cowbay.org/post/postgresql-pgbench-benchmark/</guid> <guid>https://h.cowbay.org/post/postgresql-pgbench-benchmark/</guid>
<description>&lt;p&gt;昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench&lt;/p&gt; <description>&lt;p&gt;昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench&lt;/p&gt;
&lt;p&gt;分數大概如何,想要跟他的筆電做個比較&lt;/p&gt; &lt;p&gt;分數大概如何,想要跟他的筆電做個比較&lt;/p&gt;
&lt;p&gt;之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本&lt;/p&gt; &lt;p&gt;之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本&lt;/p&gt;
&lt;p&gt;對於pgbench 跑分會有多大的影響&lt;/p&gt;</description> &lt;p&gt;對於pgbench 跑分會有多大的影響&lt;/p&gt;</description>
</item> </item>
@ -275,9 +226,7 @@
<guid>https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/</guid> <guid>https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/</guid>
<description>&lt;p&gt;2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!&lt;/p&gt; <description>&lt;p&gt;2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!&lt;/p&gt;
&lt;p&gt;因為群暉的文件在最關鍵的一步寫得亂七八糟!&lt;/p&gt; &lt;p&gt;因為群暉的文件在最關鍵的一步寫得亂七八糟!&lt;/p&gt;
&lt;p&gt;所以在這邊紀錄一下我操作的步驟!&lt;/p&gt;</description> &lt;p&gt;所以在這邊紀錄一下我操作的步驟!&lt;/p&gt;</description>
</item> </item>
@ -288,11 +237,8 @@
<guid>https://h.cowbay.org/post/ansible-get-value-from-loop-register/</guid> <guid>https://h.cowbay.org/post/ansible-get-value-from-loop-register/</guid>
<description>&lt;p&gt;今天在寫一支客製化 firefox 的playbook&lt;/p&gt; <description>&lt;p&gt;今天在寫一支客製化 firefox 的playbook&lt;/p&gt;
&lt;p&gt;因為firefox 會給每個user 建立一個由亂數字串組成的default profile&lt;/p&gt; &lt;p&gt;因為firefox 會給每個user 建立一個由亂數字串組成的default profile&lt;/p&gt;
&lt;p&gt;所以每個user的 default profile 都不同&lt;/p&gt; &lt;p&gt;所以每個user的 default profile 都不同&lt;/p&gt;
&lt;p&gt;也因此在用register處理的時候碰到了一些問題&lt;/p&gt;</description> &lt;p&gt;也因此在用register處理的時候碰到了一些問題&lt;/p&gt;</description>
</item> </item>
@ -303,13 +249,9 @@
<guid>https://h.cowbay.org/post/ansible-ssh-forwardagent/</guid> <guid>https://h.cowbay.org/post/ansible-ssh-forwardagent/</guid>
<description>&lt;p&gt;正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent&lt;/p&gt; <description>&lt;p&gt;正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent&lt;/p&gt;
&lt;p&gt;總之就是在寫一隻ansible playbook&lt;/p&gt; &lt;p&gt;總之就是在寫一隻ansible playbook&lt;/p&gt;
&lt;p&gt;目的是用來安裝、設定 firefox&lt;/p&gt; &lt;p&gt;目的是用來安裝、設定 firefox&lt;/p&gt;
&lt;p&gt;包含安裝 firefox addon&lt;/p&gt; &lt;p&gt;包含安裝 firefox addon&lt;/p&gt;
&lt;p&gt;但是一開始在執行的時候,碰到了一些錯誤&lt;/p&gt;</description> &lt;p&gt;但是一開始在執行的時候,碰到了一些錯誤&lt;/p&gt;</description>
</item> </item>
@ -320,15 +262,10 @@
<guid>https://h.cowbay.org/post/test-pg_prewarm/</guid> <guid>https://h.cowbay.org/post/test-pg_prewarm/</guid>
<description>&lt;p&gt;老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面&lt;/p&gt; <description>&lt;p&gt;老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面&lt;/p&gt;
&lt;p&gt;但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)&lt;/p&gt; &lt;p&gt;但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)&lt;/p&gt;
&lt;p&gt;在找資料的時候發現了這個postgresql 的 pg_prewarm extension&lt;/p&gt; &lt;p&gt;在找資料的時候發現了這個postgresql 的 pg_prewarm extension&lt;/p&gt;
&lt;p&gt;好像有點意思?就來測試看看吧!&lt;/p&gt; &lt;p&gt;好像有點意思?就來測試看看吧!&lt;/p&gt;
&lt;p&gt;只是目前還不知道該怎麼解讀測試的數據就是了&amp;hellip;&lt;/p&gt; &lt;p&gt;只是目前還不知道該怎麼解讀測試的數據就是了&amp;hellip;&lt;/p&gt;
&lt;p&gt;幹!林北真的不是 DBA 啦 =.=&lt;/p&gt;</description> &lt;p&gt;幹!林北真的不是 DBA 啦 =.=&lt;/p&gt;</description>
</item> </item>
@ -339,9 +276,7 @@
<guid>https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/</guid> <guid>https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/</guid>
<description>&lt;p&gt;剛剛在跑一個修改過的playbook卻發現一個詭異的狀況&lt;/p&gt; <description>&lt;p&gt;剛剛在跑一個修改過的playbook卻發現一個詭異的狀況&lt;/p&gt;
&lt;p&gt;在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄&lt;/p&gt; &lt;p&gt;在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄&lt;/p&gt;
&lt;p&gt;怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤&lt;/p&gt;</description> &lt;p&gt;怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤&lt;/p&gt;</description>
</item> </item>
@ -352,11 +287,8 @@
<guid>https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/</guid> <guid>https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/</guid>
<description>&lt;p&gt;這幾天在ansible 寫了一份新的playbook給developer 用&lt;/p&gt; <description>&lt;p&gt;這幾天在ansible 寫了一份新的playbook給developer 用&lt;/p&gt;
&lt;p&gt;然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon&lt;/p&gt; &lt;p&gt;然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon&lt;/p&gt;
&lt;p&gt;我才發現原來之前的寫法不能用在 ubuntu 18.04 上&lt;/p&gt; &lt;p&gt;我才發現原來之前的寫法不能用在 ubuntu 18.04 上&lt;/p&gt;
&lt;p&gt;只好又弄了一份出來&lt;/p&gt;</description> &lt;p&gt;只好又弄了一份出來&lt;/p&gt;</description>
</item> </item>
@ -367,19 +299,12 @@
<guid>https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/</guid> <guid>https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/</guid>
<description>&lt;p&gt;最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04&lt;/p&gt; <description>&lt;p&gt;最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04&lt;/p&gt;
&lt;p&gt;因為公司政策的關係所以現在要連接internet ,需要申請&lt;/p&gt; &lt;p&gt;因為公司政策的關係所以現在要連接internet ,需要申請&lt;/p&gt;
&lt;p&gt;然後 user 再去系統的proxy 設定新增一個 PAC 檔&lt;/p&gt; &lt;p&gt;然後 user 再去系統的proxy 設定新增一個 PAC 檔&lt;/p&gt;
&lt;p&gt;但是這個動作其實是去叫NetworkManager 這個服務&lt;/p&gt; &lt;p&gt;但是這個動作其實是去叫NetworkManager 這個服務&lt;/p&gt;
&lt;p&gt;可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定&lt;/p&gt; &lt;p&gt;可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定&lt;/p&gt;
&lt;p&gt;所以想試試看有沒有辦法不使用 NetworkManager 服務&lt;/p&gt; &lt;p&gt;所以想試試看有沒有辦法不使用 NetworkManager 服務&lt;/p&gt;
&lt;p&gt;又能夠在 user level 修改 proxy 參數&lt;/p&gt; &lt;p&gt;又能夠在 user level 修改 proxy 參數&lt;/p&gt;
&lt;p&gt;就想到了用 dconf 來做&lt;/p&gt;</description> &lt;p&gt;就想到了用 dconf 來做&lt;/p&gt;</description>
</item> </item>
@ -390,11 +315,8 @@
<guid>https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/</guid> <guid>https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/</guid>
<description>&lt;p&gt;最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案&lt;/p&gt; <description>&lt;p&gt;最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案&lt;/p&gt;
&lt;p&gt;就不小心發現了這個 streisand&lt;/p&gt; &lt;p&gt;就不小心發現了這個 streisand&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/StreisandEffect/streisand&#34;&gt;https://github.com/StreisandEffect/streisand&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://github.com/StreisandEffect/streisand&#34;&gt;https://github.com/StreisandEffect/streisand&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;玩了一下發現這根本就是終極的VPN Server solution ..&lt;/p&gt;</description> &lt;p&gt;玩了一下發現這根本就是終極的VPN Server solution ..&lt;/p&gt;</description>
</item> </item>
@ -405,15 +327,10 @@
<guid>https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/</guid> <guid>https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/</guid>
<description>&lt;p&gt;最近都在弄postgresql&lt;/p&gt; <description>&lt;p&gt;最近都在弄postgresql&lt;/p&gt;
&lt;p&gt;備份、還原測試得差不多了,就等著看到時候要用什麼方式&lt;/p&gt; &lt;p&gt;備份、還原測試得差不多了,就等著看到時候要用什麼方式&lt;/p&gt;
&lt;p&gt;前幾天看到 pg_auto_failover 這個postgresql 的extension&lt;/p&gt; &lt;p&gt;前幾天看到 pg_auto_failover 這個postgresql 的extension&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/citusdata/pg_auto_failover&#34;&gt;https://github.com/citusdata/pg_auto_failover&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://github.com/citusdata/pg_auto_failover&#34;&gt;https://github.com/citusdata/pg_auto_failover&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA&lt;/p&gt; &lt;p&gt;感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA&lt;/p&gt;
&lt;p&gt;不過,反正當作練功嘛,多測試一套也不錯!&lt;/p&gt;</description> &lt;p&gt;不過,反正當作練功嘛,多測試一套也不錯!&lt;/p&gt;</description>
</item> </item>
@ -435,9 +352,7 @@
<guid>https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/</guid> <guid>https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/</guid>
<description>&lt;p&gt;前面測試了用pgbarman / pgbackrest 來備份 postgresql&lt;/p&gt; <description>&lt;p&gt;前面測試了用pgbarman / pgbackrest 來備份 postgresql&lt;/p&gt;
&lt;p&gt;這次改從system file level 來下手&lt;/p&gt; &lt;p&gt;這次改從system file level 來下手&lt;/p&gt;
&lt;p&gt;採用zfs 的快照來備份、還原postgresql 資料庫&lt;/p&gt;</description> &lt;p&gt;採用zfs 的快照來備份、還原postgresql 資料庫&lt;/p&gt;</description>
</item> </item>
@ -466,11 +381,8 @@
<guid>https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/</guid> <guid>https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/</guid>
<description>&lt;p&gt;很久以前就有看到這個用來備份postgresql 的 pgbarman&lt;/p&gt; <description>&lt;p&gt;很久以前就有看到這個用來備份postgresql 的 pgbarman&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.pgbarman.org/&#34;&gt;https://www.pgbarman.org/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.pgbarman.org/&#34;&gt;https://www.pgbarman.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看&lt;/p&gt; &lt;p&gt;前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看&lt;/p&gt;
&lt;p&gt;不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -481,11 +393,8 @@
<guid>https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/</guid>
<description>&lt;p&gt;因為老闆說要試試看用GPU 來跑postgresql 威力&lt;/p&gt; <description>&lt;p&gt;因為老闆說要試試看用GPU 來跑postgresql 威力&lt;/p&gt;
&lt;p&gt;手邊剛好有一張 geforce gt 720&lt;/p&gt; &lt;p&gt;手邊剛好有一張 geforce gt 720&lt;/p&gt;
&lt;p&gt;一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援&lt;/p&gt; &lt;p&gt;一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援&lt;/p&gt;
&lt;p&gt;就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -496,17 +405,11 @@
<guid>https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/</guid> <guid>https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/</guid>
<description>&lt;p&gt;最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立&lt;/p&gt; <description>&lt;p&gt;最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立&lt;/p&gt;
&lt;p&gt;想說再打個VPN tunnel 來當跳板連 ptt 好了&lt;/p&gt; &lt;p&gt;想說再打個VPN tunnel 來當跳板連 ptt 好了&lt;/p&gt;
&lt;p&gt;因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境&lt;/p&gt; &lt;p&gt;因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境&lt;/p&gt;
&lt;p&gt;本來是在vultr 的VPS上面建立這個tunnel&lt;/p&gt; &lt;p&gt;本來是在vultr 的VPS上面建立這個tunnel&lt;/p&gt;
&lt;p&gt;但是那台VPS連去ptt 很頓,卡卡的&lt;/p&gt; &lt;p&gt;但是那台VPS連去ptt 很頓,卡卡的&lt;/p&gt;
&lt;p&gt;所以改用google cloud platform 的free tier 來做&lt;/p&gt; &lt;p&gt;所以改用google cloud platform 的free tier 來做&lt;/p&gt;
&lt;p&gt;反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態&lt;/p&gt;</description> &lt;p&gt;反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態&lt;/p&gt;</description>
</item> </item>
@ -517,15 +420,10 @@
<guid>https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/</guid> <guid>https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/</guid>
<description>&lt;p&gt;因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN&lt;/p&gt; <description>&lt;p&gt;因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN&lt;/p&gt;
&lt;p&gt;雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了&lt;/p&gt; &lt;p&gt;雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了&lt;/p&gt;
&lt;p&gt;完全沒辦法了解當時設計的邏輯造成後續debug 困難&lt;/p&gt; &lt;p&gt;完全沒辦法了解當時設計的邏輯造成後續debug 困難&lt;/p&gt;
&lt;p&gt;可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌&lt;/p&gt; &lt;p&gt;可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌&lt;/p&gt;
&lt;p&gt;之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點&lt;/p&gt; &lt;p&gt;之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點&lt;/p&gt;
&lt;p&gt;這次試試看躲在gateway後面看看能不能建立多點的VPN環境&lt;/p&gt;</description> &lt;p&gt;這次試試看躲在gateway後面看看能不能建立多點的VPN環境&lt;/p&gt;</description>
</item> </item>
@ -536,23 +434,14 @@
<guid>https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/</guid> <guid>https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/</guid>
<description>&lt;p&gt;之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt&lt;/p&gt; <description>&lt;p&gt;之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt&lt;/p&gt;
&lt;p&gt;然後用strongswan 來打 IPSEC site to site VPN&lt;/p&gt; &lt;p&gt;然後用strongswan 來打 IPSEC site to site VPN&lt;/p&gt;
&lt;p&gt;config 看起來不是很難 (只是看起來)&lt;/p&gt; &lt;p&gt;config 看起來不是很難 (只是看起來)&lt;/p&gt;
&lt;p&gt;但是實際上已經找不到當初的文件&lt;/p&gt; &lt;p&gt;但是實際上已經找不到當初的文件&lt;/p&gt;
&lt;p&gt;所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)&lt;/p&gt; &lt;p&gt;所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)&lt;/p&gt;
&lt;p&gt;後來採購了兩台edgerouter X 做測試&lt;/p&gt; &lt;p&gt;後來採購了兩台edgerouter X 做測試&lt;/p&gt;
&lt;p&gt;也用openvpn 成功的建立了 site to site VPN&lt;/p&gt; &lt;p&gt;也用openvpn 成功的建立了 site to site VPN&lt;/p&gt;
&lt;p&gt;本來想說 openvpn 已經夠簡單了&lt;/p&gt; &lt;p&gt;本來想說 openvpn 已經夠簡單了&lt;/p&gt;
&lt;p&gt;今天看到文章說用wireguard 可以更簡單&lt;/p&gt; &lt;p&gt;今天看到文章說用wireguard 可以更簡單&lt;/p&gt;
&lt;p&gt;於是研究了一下,發現還真的很簡單!&lt;/p&gt;</description> &lt;p&gt;於是研究了一下,發現還真的很簡單!&lt;/p&gt;</description>
</item> </item>
@ -563,19 +452,12 @@
<guid>https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/</guid> <guid>https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/</guid>
<description>&lt;p&gt;最近有個任務需要大量安裝client&lt;/p&gt; <description>&lt;p&gt;最近有個任務需要大量安裝client&lt;/p&gt;
&lt;p&gt;想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot&lt;/p&gt; &lt;p&gt;想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot&lt;/p&gt;
&lt;p&gt;然後選擇OS版本就可以自動進行安裝&lt;/p&gt; &lt;p&gt;然後選擇OS版本就可以自動進行安裝&lt;/p&gt;
&lt;p&gt;安裝完成後會自動重新開機接著就用ansible來做user環境設定&lt;/p&gt; &lt;p&gt;安裝完成後會自動重新開機接著就用ansible來做user環境設定&lt;/p&gt;
&lt;p&gt;PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了&lt;/p&gt; &lt;p&gt;PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了&lt;/p&gt;
&lt;p&gt;可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機&lt;/p&gt; &lt;p&gt;可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機&lt;/p&gt;
&lt;p&gt;就送出一封郵件來通知我說已經完成安裝可以執行ansible 了&lt;/p&gt; &lt;p&gt;就送出一封郵件來通知我說已經完成安裝可以執行ansible 了&lt;/p&gt;
&lt;p&gt;看似很簡單的一件事情,卻搞了我兩天&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;看似很簡單的一件事情,卻搞了我兩天&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -586,13 +468,9 @@
<guid>https://h.cowbay.org/post/remote-management-system-meshcentral/</guid> <guid>https://h.cowbay.org/post/remote-management-system-meshcentral/</guid>
<description>&lt;p&gt;之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體&lt;/p&gt; <description>&lt;p&gt;之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體&lt;/p&gt;
&lt;p&gt;但是如果要過 internet 就會碰到各種開port的問題&lt;/p&gt; &lt;p&gt;但是如果要過 internet 就會碰到各種開port的問題&lt;/p&gt;
&lt;p&gt;在這種環境下,就有了當時 teamviewer 的橫空出世&lt;/p&gt; &lt;p&gt;在這種環境下,就有了當時 teamviewer 的橫空出世&lt;/p&gt;
&lt;p&gt;解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多&lt;/p&gt; &lt;p&gt;解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多&lt;/p&gt;
&lt;p&gt;只要下載teamviewer被控端開啟後報ID 給協助者就好了&lt;/p&gt;</description> &lt;p&gt;只要下載teamviewer被控端開啟後報ID 給協助者就好了&lt;/p&gt;</description>
</item> </item>
@ -603,7 +481,6 @@
<guid>https://h.cowbay.org/post/change-timezone-in-docker/</guid> <guid>https://h.cowbay.org/post/change-timezone-in-docker/</guid>
<description>&lt;p&gt;最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致&lt;/p&gt; <description>&lt;p&gt;最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致&lt;/p&gt;
&lt;p&gt;有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -614,13 +491,9 @@
<guid>https://h.cowbay.org/post/inx-collect-detail-hardware-info/</guid> <guid>https://h.cowbay.org/post/inx-collect-detail-hardware-info/</guid>
<description>&lt;p&gt;最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&amp;hellip;.&lt;/p&gt; <description>&lt;p&gt;最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&amp;hellip;.&lt;/p&gt;
&lt;p&gt;然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著&lt;/p&gt; &lt;p&gt;然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著&lt;/p&gt;
&lt;p&gt;所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!&lt;/p&gt; &lt;p&gt;所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!&lt;/p&gt;
&lt;p&gt;也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了&lt;/p&gt; &lt;p&gt;也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了&lt;/p&gt;
&lt;p&gt;然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!&lt;/p&gt;</description> &lt;p&gt;然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!&lt;/p&gt;</description>
</item> </item>
@ -631,11 +504,8 @@
<guid>https://h.cowbay.org/post/log-all-bash-commands/</guid> <guid>https://h.cowbay.org/post/log-all-bash-commands/</guid>
<description>&lt;p&gt;今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案&lt;/p&gt; <description>&lt;p&gt;今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案&lt;/p&gt;
&lt;p&gt;居然不知為何自己產生了,在我記憶中沒有去執行過那個指令&lt;/p&gt; &lt;p&gt;居然不知為何自己產生了,在我記憶中沒有去執行過那個指令&lt;/p&gt;
&lt;p&gt;翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)&lt;/p&gt; &lt;p&gt;翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)&lt;/p&gt;
&lt;p&gt;所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份&lt;/p&gt;</description> &lt;p&gt;所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份&lt;/p&gt;</description>
</item> </item>
@ -646,9 +516,7 @@
<guid>https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/</guid> <guid>https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/</guid>
<description>&lt;p&gt;今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試&lt;/p&gt; <description>&lt;p&gt;今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試&lt;/p&gt;
&lt;p&gt;想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate&lt;/p&gt; &lt;p&gt;想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate&lt;/p&gt;
&lt;p&gt;可是一直出現device busy的錯誤訊息&lt;/p&gt;</description> &lt;p&gt;可是一直出現device busy的錯誤訊息&lt;/p&gt;</description>
</item> </item>
@ -659,7 +527,6 @@
<guid>https://h.cowbay.org/post/transfer-cent62-using-rsync/</guid> <guid>https://h.cowbay.org/post/transfer-cent62-using-rsync/</guid>
<description>&lt;p&gt;公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。&lt;/p&gt; <description>&lt;p&gt;公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。&lt;/p&gt;
&lt;p&gt;看起來不難搞,事實上&amp;hellip;..&lt;/p&gt;</description> &lt;p&gt;看起來不難搞,事實上&amp;hellip;..&lt;/p&gt;</description>
</item> </item>
@ -670,11 +537,8 @@
<guid>https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/</guid> <guid>https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/</guid>
<description>&lt;p&gt;最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook&lt;/p&gt; <description>&lt;p&gt;最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook&lt;/p&gt;
&lt;p&gt;因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體&lt;/p&gt; &lt;p&gt;因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體&lt;/p&gt;
&lt;p&gt;可以很簡單快速的備份、恢復系統狀態&lt;/p&gt; &lt;p&gt;可以很簡單快速的備份、恢復系統狀態&lt;/p&gt;
&lt;p&gt;可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -685,7 +549,6 @@
<guid>https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/</guid> <guid>https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/</guid>
<description>&lt;p&gt;買了一張 DELL 6/iR 低階的raid 卡&lt;/p&gt; <description>&lt;p&gt;買了一張 DELL 6/iR 低階的raid 卡&lt;/p&gt;
&lt;p&gt;來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -696,9 +559,7 @@
<guid>https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/</guid> <guid>https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/</guid>
<description>&lt;p&gt;最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上&lt;/p&gt; <description>&lt;p&gt;最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上&lt;/p&gt;
&lt;p&gt;因為新開的機器大部分都是在proxmox上所以很少碰實體機器了&lt;/p&gt; &lt;p&gt;因為新開的機器大部分都是在proxmox上所以很少碰實體機器了&lt;/p&gt;
&lt;p&gt;結果在安裝過程中做raid碰到一些問題來紀錄一下&lt;/p&gt;</description> &lt;p&gt;結果在安裝過程中做raid碰到一些問題來紀錄一下&lt;/p&gt;</description>
</item> </item>
@ -709,11 +570,8 @@
<guid>https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/</guid> <guid>https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/</guid>
<description>&lt;p&gt;這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp;amp; Server Backup&lt;/p&gt; <description>&lt;p&gt;這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp;amp; Server Backup&lt;/p&gt;
&lt;p&gt;因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10&lt;/p&gt; &lt;p&gt;因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10&lt;/p&gt;
&lt;p&gt;然後把Freenas 安裝在隨身碟上&lt;/p&gt; &lt;p&gt;然後把Freenas 安裝在隨身碟上&lt;/p&gt;
&lt;p&gt;不過會一直出現Smartd failed to start 的錯誤訊息&lt;/p&gt;</description> &lt;p&gt;不過會一直出現Smartd failed to start 的錯誤訊息&lt;/p&gt;</description>
</item> </item>
@ -724,11 +582,8 @@
<guid>https://h.cowbay.org/post/create-portable-vim-environment/</guid> <guid>https://h.cowbay.org/post/create-portable-vim-environment/</guid>
<description>&lt;p&gt;因為工作的關係現在很多時間都花在VIM的操作上&lt;/p&gt; <description>&lt;p&gt;因為工作的關係現在很多時間都花在VIM的操作上&lt;/p&gt;
&lt;p&gt;所以之前花了滿多時間調整出一個適合自己的VIM環境&lt;/p&gt; &lt;p&gt;所以之前花了滿多時間調整出一個適合自己的VIM環境&lt;/p&gt;
&lt;p&gt;原本的作法是把這個設定好的環境丟到自己建立的gitea 上面&lt;/p&gt; &lt;p&gt;原本的作法是把這個設定好的環境丟到自己建立的gitea 上面&lt;/p&gt;
&lt;p&gt;然後每到一台新的機器就要去clone 下來&lt;/p&gt;</description> &lt;p&gt;然後每到一台新的機器就要去clone 下來&lt;/p&gt;</description>
</item> </item>
@ -739,21 +594,13 @@
<guid>https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/</guid> <guid>https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/</guid>
<description>&lt;p&gt;想做一個 10G 的 LAB 環境出來已經很久了。&lt;/p&gt; <description>&lt;p&gt;想做一個 10G 的 LAB 環境出來已經很久了。&lt;/p&gt;
&lt;p&gt;只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜&lt;/p&gt; &lt;p&gt;只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜&lt;/p&gt;
&lt;p&gt;如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)&lt;/p&gt; &lt;p&gt;如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)&lt;/p&gt;
&lt;p&gt;所以一直沒有付諸行動。&lt;/p&gt; &lt;p&gt;所以一直沒有付諸行動。&lt;/p&gt;
&lt;p&gt;硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)&lt;/p&gt; &lt;p&gt;硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)&lt;/p&gt;
&lt;p&gt;聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位&lt;/p&gt; &lt;p&gt;聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位&lt;/p&gt;
&lt;p&gt;就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線&lt;/p&gt; &lt;p&gt;就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線&lt;/p&gt;
&lt;p&gt;就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到&lt;/p&gt; &lt;p&gt;就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到&lt;/p&gt;
&lt;p&gt;今天就花了點時間測試一下&lt;/p&gt;</description> &lt;p&gt;今天就花了點時間測試一下&lt;/p&gt;</description>
</item> </item>
@ -764,9 +611,7 @@
<guid>https://h.cowbay.org/post/ansible-selectattr-filter/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr-filter/</guid>
<description>&lt;p&gt;在上一篇 &lt;a href=&#34;https://h.cowbay.org/post/ansible-selectattr/&#34;&gt;Ansible how to use &amp;lsquo;list&amp;rsquo; in yaml file &lt;/a&gt;&lt;/p&gt; <description>&lt;p&gt;在上一篇 &lt;a href=&#34;https://h.cowbay.org/post/ansible-selectattr/&#34;&gt;Ansible how to use &amp;lsquo;list&amp;rsquo; in yaml file &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單&lt;/p&gt; &lt;p&gt;有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單&lt;/p&gt;
&lt;p&gt;不過就是有點醜&lt;/p&gt;</description> &lt;p&gt;不過就是有點醜&lt;/p&gt;</description>
</item> </item>
@ -777,11 +622,8 @@
<guid>https://h.cowbay.org/post/ansible-selectattr/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr/</guid>
<description>&lt;p&gt;這幾天在玩ansible 時,碰到一個問題&lt;/p&gt; <description>&lt;p&gt;這幾天在玩ansible 時,碰到一個問題&lt;/p&gt;
&lt;p&gt;假如我有個yaml檔作為資料來源檔名是 abc.yml&lt;/p&gt; &lt;p&gt;假如我有個yaml檔作為資料來源檔名是 abc.yml&lt;/p&gt;
&lt;p&gt;大概長這樣&lt;/p&gt; &lt;p&gt;大概長這樣&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &amp;quot;teams&amp;quot;: [ &lt;pre&gt;&lt;code&gt; &amp;quot;teams&amp;quot;: [
{ {
&amp;quot;chinese_name&amp;quot;: &amp;quot;TEAM1&amp;quot;, &amp;quot;chinese_name&amp;quot;: &amp;quot;TEAM1&amp;quot;,
@ -829,11 +671,8 @@
<guid>https://h.cowbay.org/post/change-preferred-language-in-firefox/</guid> <guid>https://h.cowbay.org/post/change-preferred-language-in-firefox/</guid>
<description>&lt;p&gt;最近在測試metabase記得幾個月前就有測試過&lt;/p&gt; <description>&lt;p&gt;最近在測試metabase記得幾個月前就有測試過&lt;/p&gt;
&lt;p&gt;但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的&lt;/p&gt; &lt;p&gt;但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的&lt;/p&gt;
&lt;p&gt;所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)&lt;/p&gt; &lt;p&gt;所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)&lt;/p&gt;
&lt;p&gt;不過呢,很討厭的是,一進去就發現語系採用的是簡體中文&lt;/p&gt;</description> &lt;p&gt;不過呢,很討厭的是,一進去就發現語系採用的是簡體中文&lt;/p&gt;</description>
</item> </item>
@ -844,11 +683,8 @@
<guid>https://h.cowbay.org/post/copy_role_in_pgsql/</guid> <guid>https://h.cowbay.org/post/copy_role_in_pgsql/</guid>
<description>&lt;p&gt;因為工作上的需求有個資料庫需要開放給不同team的人去存取&lt;/p&gt; <description>&lt;p&gt;因為工作上的需求有個資料庫需要開放給不同team的人去存取&lt;/p&gt;
&lt;p&gt;雖然都是在同一台機器上的同一個資料庫&lt;/p&gt; &lt;p&gt;雖然都是在同一台機器上的同一個資料庫&lt;/p&gt;
&lt;p&gt;但是希望能夠不同team的人用不同的資料庫使用者&lt;/p&gt; &lt;p&gt;但是希望能夠不同team的人用不同的資料庫使用者&lt;/p&gt;
&lt;p&gt;這樣萬一出事,會比較好抓兇手??&lt;/p&gt;</description> &lt;p&gt;這樣萬一出事,會比較好抓兇手??&lt;/p&gt;</description>
</item> </item>
@ -859,17 +695,11 @@
<guid>https://h.cowbay.org/post/weird-client-server-connection/</guid> <guid>https://h.cowbay.org/post/weird-client-server-connection/</guid>
<description>&lt;p&gt;這是發生在一個夜黑風高的寂寥深夜&amp;hellip;.. ( What The FXXX &amp;hellip; )&lt;/p&gt; <description>&lt;p&gt;這是發生在一個夜黑風高的寂寥深夜&amp;hellip;.. ( What The FXXX &amp;hellip; )&lt;/p&gt;
&lt;p&gt;來到這個環境之後,有一個很詭異的狀況一直困擾著我&lt;/p&gt; &lt;p&gt;來到這個環境之後,有一個很詭異的狀況一直困擾著我&lt;/p&gt;
&lt;p&gt;在每個分公司都會有一台伺服器作為KVM Host&lt;/p&gt; &lt;p&gt;在每個分公司都會有一台伺服器作為KVM Host&lt;/p&gt;
&lt;p&gt;上面跑兩台VM一台作為ansible controller (目前沒作用)&lt;/p&gt; &lt;p&gt;上面跑兩台VM一台作為ansible controller (目前沒作用)&lt;/p&gt;
&lt;p&gt;另一台作為這邊所謂的 &amp;ldquo;Build Server&amp;rdquo;&lt;/p&gt; &lt;p&gt;另一台作為這邊所謂的 &amp;ldquo;Build Server&amp;rdquo;&lt;/p&gt;
&lt;p&gt;用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)&lt;/p&gt; &lt;p&gt;用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)&lt;/p&gt;
&lt;p&gt;問題就發生在這台 Build Server 上&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;問題就發生在這台 Build Server 上&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -893,22 +723,14 @@
<pubDate>Tue, 06 Nov 2018 14:57:14 +0800</pubDate> <pubDate>Tue, 06 Nov 2018 14:57:14 +0800</pubDate>
<guid>https://h.cowbay.org/post/bookstack-docker/</guid> <guid>https://h.cowbay.org/post/bookstack-docker/</guid>
<description>&lt;p&gt;Bookstack 是一套非常好用的線上&amp;rdquo;筆記&amp;rdquo;系統&lt;/p&gt; <description>&lt;p&gt;Bookstack 是一套非常好用的線上&amp;quot;筆記&amp;quot;系統&lt;/p&gt;
&lt;p&gt;他用圖書館/書本的概念,讓使用者可以建立自己的&amp;quot;圖書館&amp;rdquo;&lt;/p&gt;
&lt;p&gt;他用圖書館/書本的概念,讓使用者可以建立自己的&amp;rdquo;圖書館&amp;rdquo;&lt;/p&gt; &lt;p&gt;同時在圖書館內建立不同的&amp;quot;書籍&amp;rdquo;&lt;/p&gt;
&lt;p&gt;同時在圖書館內建立不同的&amp;rdquo;書籍&amp;rdquo;&lt;/p&gt;
&lt;p&gt;而且支援 Markdown 語法&lt;/p&gt; &lt;p&gt;而且支援 Markdown 語法&lt;/p&gt;
&lt;p&gt;其他的方式像是在nextcloud上編輯 md檔案(字體太小)&lt;/p&gt; &lt;p&gt;其他的方式像是在nextcloud上編輯 md檔案(字體太小)&lt;/p&gt;
&lt;p&gt;或者是boostnote(只能在本機)&lt;/p&gt; &lt;p&gt;或者是boostnote(只能在本機)&lt;/p&gt;
&lt;p&gt;都或多或少有點小缺點&lt;/p&gt; &lt;p&gt;都或多或少有點小缺點&lt;/p&gt;
&lt;p&gt;Bookstack則是沒有這些問題不過就是系統「大」了點&amp;hellip;&lt;/p&gt; &lt;p&gt;Bookstack則是沒有這些問題不過就是系統「大」了點&amp;hellip;&lt;/p&gt;
&lt;p&gt;不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)&lt;/p&gt;</description> &lt;p&gt;不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)&lt;/p&gt;</description>
</item> </item>
@ -920,16 +742,11 @@
<guid>https://h.cowbay.org/post/enable-synology-public-ssh/</guid> <guid>https://h.cowbay.org/post/enable-synology-public-ssh/</guid>
<description>&lt;p&gt;公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file <description>&lt;p&gt;公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file
之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來&lt;/p&gt; 之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來&lt;/p&gt;
&lt;p&gt;這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體 &lt;p&gt;這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體
像是這篇&lt;/p&gt; 像是這篇&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&#34;&gt;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&#34;&gt;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;或者是這篇&lt;/p&gt; &lt;p&gt;或者是這篇&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.maketecheasier.com/mount-google-drive-ubuntu/&#34;&gt;https://www.maketecheasier.com/mount-google-drive-ubuntu/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.maketecheasier.com/mount-google-drive-ubuntu/&#34;&gt;https://www.maketecheasier.com/mount-google-drive-ubuntu/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;但是手邊的伺服器原則上除非有必要不然都沒有開放internet &lt;p&gt;但是手邊的伺服器原則上除非有必要不然都沒有開放internet
所以導致明明檔案就在那邊,但是要取得就是很麻煩&lt;/p&gt;</description> 所以導致明明檔案就在那邊,但是要取得就是很麻煩&lt;/p&gt;</description>
</item> </item>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,19 +331,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前幾天公司的一台 Synology DS 415+ 發生異常</p> <p>前幾天公司的一台 Synology DS 415+ 發生異常</p>
<p>注意到的時候,四顆硬碟燈號都不斷的在閃爍</p> <p>注意到的時候,四顆硬碟燈號都不斷的在閃爍</p>
<p>但是已經無法登入系統</p> <p>但是已經無法登入系統</p>
<p>重開機之後更慘,四顆硬碟燈號全部橘燈恆亮</p> <p>重開機之後更慘,四顆硬碟燈號全部橘燈恆亮</p>
<p>底下的電源藍燈不斷的在閃爍</p> <p>底下的電源藍燈不斷的在閃爍</p>
<p>雖然我一再表示不希望送修了</p> <p>雖然我一再表示不希望送修了</p>
<p>一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&hellip;</p> <p>一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&hellip;</p>
<p>不過主管還是希望能夠先問群暉維修的費用多少</p> <p>不過主管還是希望能夠先問群暉維修的費用多少</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/synology-ds415-repair-cost/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/synology-ds415-repair-cost/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -479,7 +468,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -491,6 +480,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>群暉 on MC部落</title> <title>群暉 on MC部落</title>
@ -18,19 +18,12 @@
<guid>https://h.cowbay.org/post/synology-ds415-repair-cost/</guid> <guid>https://h.cowbay.org/post/synology-ds415-repair-cost/</guid>
<description>&lt;p&gt;前幾天公司的一台 Synology DS 415+ 發生異常&lt;/p&gt; <description>&lt;p&gt;前幾天公司的一台 Synology DS 415+ 發生異常&lt;/p&gt;
&lt;p&gt;注意到的時候,四顆硬碟燈號都不斷的在閃爍&lt;/p&gt; &lt;p&gt;注意到的時候,四顆硬碟燈號都不斷的在閃爍&lt;/p&gt;
&lt;p&gt;但是已經無法登入系統&lt;/p&gt; &lt;p&gt;但是已經無法登入系統&lt;/p&gt;
&lt;p&gt;重開機之後更慘,四顆硬碟燈號全部橘燈恆亮&lt;/p&gt; &lt;p&gt;重開機之後更慘,四顆硬碟燈號全部橘燈恆亮&lt;/p&gt;
&lt;p&gt;底下的電源藍燈不斷的在閃爍&lt;/p&gt; &lt;p&gt;底下的電源藍燈不斷的在閃爍&lt;/p&gt;
&lt;p&gt;雖然我一再表示不希望送修了&lt;/p&gt; &lt;p&gt;雖然我一再表示不希望送修了&lt;/p&gt;
&lt;p&gt;一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&amp;hellip;&lt;/p&gt; &lt;p&gt;一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&amp;hellip;&lt;/p&gt;
&lt;p&gt;不過主管還是希望能夠先問群暉維修的費用多少&lt;/p&gt;</description> &lt;p&gt;不過主管還是希望能夠先問群暉維修的費用多少&lt;/p&gt;</description>
</item> </item>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -82,10 +82,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -335,11 +331,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了</p> <p>2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了</p>
<p>開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況</p> <p>開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況</p>
<p>終於宣告不治</p> <p>終於宣告不治</p>
<p>問題很明顯的就是Intel C2000 系列 CPU 的瑕疵</p> <p>問題很明顯的就是Intel C2000 系列 CPU 的瑕疵</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/what-a-piss-in-synology-document/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/what-a-piss-in-synology-document/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -471,7 +464,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -483,6 +476,6 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>雜念 on MC部落</title> <title>雜念 on MC部落</title>
@ -18,11 +18,8 @@
<guid>https://h.cowbay.org/post/what-a-piss-in-synology-document/</guid> <guid>https://h.cowbay.org/post/what-a-piss-in-synology-document/</guid>
<description>&lt;p&gt;2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了&lt;/p&gt; <description>&lt;p&gt;2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了&lt;/p&gt;
&lt;p&gt;開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況&lt;/p&gt; &lt;p&gt;開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況&lt;/p&gt;
&lt;p&gt;終於宣告不治&lt;/p&gt; &lt;p&gt;終於宣告不治&lt;/p&gt;
&lt;p&gt;問題很明顯的就是Intel C2000 系列 CPU 的瑕疵&lt;/p&gt;</description> &lt;p&gt;問題很明顯的就是Intel C2000 系列 CPU 的瑕疵&lt;/p&gt;</description>
</item> </item>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -285,9 +281,7 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then</p> <p>When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane. Pityful a rethoric question ran over her cheek, then</p>
<p>Effects present letters inquiry no an removed or friends. Desire behind latter me though in. Supposing shameless am he engrossed up additions. My possible peculiar together to. Desire so better am cannot he up before points. Remember mistaken opinions it pleasure of debating. Court front maids forty if aware their at. Chicken use are pressed removed.</p> <p>Effects present letters inquiry no an removed or friends. Desire behind latter me though in. Supposing shameless am he engrossed up additions. My possible peculiar together to. Desire so better am cannot he up before points. Remember mistaken opinions it pleasure of debating. Court front maids forty if aware their at. Chicken use are pressed removed.</p>
<p>Able an hope of body. Any nay shyness article matters own removal nothing his forming. Gay own additions education satisfied the perpetual. If he cause manor happy. Without farther she exposed saw man led. Along on happy could cease green oh.</p> <p>Able an hope of body. Any nay shyness article matters own removal nothing his forming. Gay own additions education satisfied the perpetual. If he cause manor happy. Without farther she exposed saw man led. Along on happy could cease green oh.</p>
@ -447,7 +441,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -459,7 +453,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Get in touch on MC部落</title> <title>Get in touch on MC部落</title>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Galleries on MC部落</title> <title>Galleries on MC部落</title>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -307,8 +303,8 @@ if (!doNotTrack) {
<div class="entry-container"> <div class="entry-container">
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p><img src="https://i.imgur.com/Odp4mfD.png" alt="" /> <p><img src="https://i.imgur.com/Odp4mfD.png" alt="">
<img src="https://i.imgur.com/yyiEHjb.png" alt="" /></p> <img src="https://i.imgur.com/yyiEHjb.png" alt=""></p>
</article> </article>
</div> </div>
@ -586,7 +582,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -598,7 +594,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,9 +321,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案</p> <p>最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案</p>
<p>之前是用 gohttpd 來做</p> <p>之前是用 gohttpd 來做</p>
<p>可是不支援線上編輯 yaml 檔案</p> <p>可是不支援線上編輯 yaml 檔案</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/cloudcmd-web-file-manager/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/cloudcmd-web-file-manager/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -381,7 +375,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點</p> <p>感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點</p>
<p>就把系統弄起來玩玩看順便建立ansible 的playbook</p> <p>就把系統弄起來玩玩看順便建立ansible 的playbook</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -435,7 +428,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。</p> <p>最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。</p>
<p>Breaks here</p> <p>Breaks here</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -489,15 +481,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題</p> <p>之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題</p>
<p>也不用煩惱怎麼去更新一堆有的沒的</p> <p>也不用煩惱怎麼去更新一堆有的沒的</p>
<p>不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況</p> <p>不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況</p>
<p>雖然可以從caddy 上面取得這些檔案</p> <p>雖然可以從caddy 上面取得這些檔案</p>
<p>但是基本上這些檔案都是綁定一個特定的hostname</p> <p>但是基本上這些檔案都是綁定一個特定的hostname</p>
<p>可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )</p> <p>可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -551,15 +538,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>手機上的廣告越來越討厭了</p> <p>手機上的廣告越來越討厭了</p>
<p>但是用手機看頁面、影片的機會越來越高</p> <p>但是用手機看頁面、影片的機會越來越高</p>
<p>所以一直想看看有沒有什麼方式可以解決這個問題</p> <p>所以一直想看看有沒有什麼方式可以解決這個問題</p>
<p>不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉</p> <p>不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉</p>
<p>在github上面看到有個專案是 wireguard + pihole</p> <p>在github上面看到有個專案是 wireguard + pihole</p>
<p>滿有趣的,就來研究一下</p> <p>滿有趣的,就來研究一下</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -834,7 +816,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -846,7 +828,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>MC部落</title> <title>MC部落</title>
@ -6,11 +6,23 @@
<description>Recent content on MC部落</description> <description>Recent content on MC部落</description>
<generator>Hugo -- gohugo.io</generator> <generator>Hugo -- gohugo.io</generator>
<language>en-us</language> <language>en-us</language>
<lastBuildDate>Tue, 20 Jul 2021 09:19:47 +0800</lastBuildDate> <lastBuildDate>Thu, 26 Aug 2021 12:08:43 +0800</lastBuildDate>
<atom:link href="https://h.cowbay.org/index.xml" rel="self" type="application/rss+xml" /> <atom:link href="https://h.cowbay.org/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>auto fetch Wildcard ssl certs with lego &#43; acme-dns ( Domain Register : Namecheap)</title>
<link>https://h.cowbay.org/auto-fetch-wildcard-ssl-certs-acme-dns-lego/</link>
<pubDate>Thu, 26 Aug 2021 12:08:43 +0800</pubDate>
<guid>https://h.cowbay.org/auto-fetch-wildcard-ssl-certs-acme-dns-lego/</guid>
<description>&lt;h3 id=&#34;auto-fetch--wildcard-ssl-certs-with-lego--acme-dns--domain-register--namecheap&#34;&gt;auto fetch Wildcard ssl certs with lego + acme-dns ( Domain Register : Namecheap)&lt;/h3&gt;
&lt;p&gt;自從用了 &lt;a href=&#34;https://github.com/artyom/leproxy&#34;&gt;leproxy&lt;/a&gt; 之後其實就很少在管ssl 憑證的問題,反正&lt;a href=&#34;https://github.com/artyom/leproxy&#34;&gt;leproxy &lt;/a&gt;都會自動處理好&lt;/p&gt;
&lt;p&gt;不過LAN裡面的機器越來越多每次看到警告說沒有加密的訊息就有點不爽之前用了很多方式去申請全域憑證申請倒是還好沒太多問題。但是一碰到要更新就都無法自動因為都會要求去修改DNS 的 TXT 或者是 CNAME 記錄。&lt;/p&gt;
&lt;p&gt;一般來說如果是其他DNS 供應商大部分都會提供API那就還好。 BUT !! (對然生就是離不開這個BUT &amp;hellip;) 我們的域名是老闆在 iwantmyname 買的,一開始是給 webfaction 代管後來webfaction 被godaddy 買走,就轉到 namecheap 去(我也不知道為什麼不在godaddy 就好)。&lt;/p&gt;</description>
</item>
<item> <item>
<title>[筆記] WEB 檔案管理 Cloudcmd Web File Manager</title> <title>[筆記] WEB 檔案管理 Cloudcmd Web File Manager</title>
<link>https://h.cowbay.org/post/cloudcmd-web-file-manager/</link> <link>https://h.cowbay.org/post/cloudcmd-web-file-manager/</link>
@ -18,9 +30,7 @@
<guid>https://h.cowbay.org/post/cloudcmd-web-file-manager/</guid> <guid>https://h.cowbay.org/post/cloudcmd-web-file-manager/</guid>
<description>&lt;p&gt;最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案&lt;/p&gt; <description>&lt;p&gt;最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案&lt;/p&gt;
&lt;p&gt;之前是用 gohttpd 來做&lt;/p&gt; &lt;p&gt;之前是用 gohttpd 來做&lt;/p&gt;
&lt;p&gt;可是不支援線上編輯 yaml 檔案&lt;/p&gt;</description> &lt;p&gt;可是不支援線上編輯 yaml 檔案&lt;/p&gt;</description>
</item> </item>
@ -31,7 +41,6 @@
<guid>https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/</guid> <guid>https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/</guid>
<description>&lt;p&gt;感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點&lt;/p&gt; <description>&lt;p&gt;感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點&lt;/p&gt;
&lt;p&gt;就把系統弄起來玩玩看順便建立ansible 的playbook&lt;/p&gt;</description> &lt;p&gt;就把系統弄起來玩玩看順便建立ansible 的playbook&lt;/p&gt;</description>
</item> </item>
@ -42,7 +51,6 @@
<guid>https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/</guid> <guid>https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/</guid>
<description>&lt;p&gt;最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。&lt;/p&gt; <description>&lt;p&gt;最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。&lt;/p&gt;
&lt;p&gt;Breaks here&lt;/p&gt;</description> &lt;p&gt;Breaks here&lt;/p&gt;</description>
</item> </item>
@ -53,15 +61,10 @@
<guid>https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/</guid> <guid>https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/</guid>
<description>&lt;p&gt;之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題&lt;/p&gt; <description>&lt;p&gt;之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題&lt;/p&gt;
&lt;p&gt;也不用煩惱怎麼去更新一堆有的沒的&lt;/p&gt; &lt;p&gt;也不用煩惱怎麼去更新一堆有的沒的&lt;/p&gt;
&lt;p&gt;不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況&lt;/p&gt; &lt;p&gt;不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況&lt;/p&gt;
&lt;p&gt;雖然可以從caddy 上面取得這些檔案&lt;/p&gt; &lt;p&gt;雖然可以從caddy 上面取得這些檔案&lt;/p&gt;
&lt;p&gt;但是基本上這些檔案都是綁定一個特定的hostname&lt;/p&gt; &lt;p&gt;但是基本上這些檔案都是綁定一個特定的hostname&lt;/p&gt;
&lt;p&gt;可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )&lt;/p&gt;</description> &lt;p&gt;可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )&lt;/p&gt;</description>
</item> </item>
@ -72,15 +75,10 @@
<guid>https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/</guid> <guid>https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/</guid>
<description>&lt;p&gt;手機上的廣告越來越討厭了&lt;/p&gt; <description>&lt;p&gt;手機上的廣告越來越討厭了&lt;/p&gt;
&lt;p&gt;但是用手機看頁面、影片的機會越來越高&lt;/p&gt; &lt;p&gt;但是用手機看頁面、影片的機會越來越高&lt;/p&gt;
&lt;p&gt;所以一直想看看有沒有什麼方式可以解決這個問題&lt;/p&gt; &lt;p&gt;所以一直想看看有沒有什麼方式可以解決這個問題&lt;/p&gt;
&lt;p&gt;不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉&lt;/p&gt; &lt;p&gt;不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉&lt;/p&gt;
&lt;p&gt;在github上面看到有個專案是 wireguard + pihole&lt;/p&gt; &lt;p&gt;在github上面看到有個專案是 wireguard + pihole&lt;/p&gt;
&lt;p&gt;滿有趣的,就來研究一下&lt;/p&gt;</description> &lt;p&gt;滿有趣的,就來研究一下&lt;/p&gt;</description>
</item> </item>
@ -91,25 +89,15 @@
<guid>https://h.cowbay.org/post/check-port-speed-in-openwrt/</guid> <guid>https://h.cowbay.org/post/check-port-speed-in-openwrt/</guid>
<description>&lt;p&gt;最近在玩ansible + openwrt + wireguard&lt;/p&gt; <description>&lt;p&gt;最近在玩ansible + openwrt + wireguard&lt;/p&gt;
&lt;p&gt;ansible 腳本寫好之後可以把config 佈署到 openwrt 上&lt;/p&gt; &lt;p&gt;ansible 腳本寫好之後可以把config 佈署到 openwrt 上&lt;/p&gt;
&lt;p&gt;當然前提是最好用同樣的機器不同的機器在config 上會有一些差異&lt;/p&gt; &lt;p&gt;當然前提是最好用同樣的機器不同的機器在config 上會有一些差異&lt;/p&gt;
&lt;p&gt;但是這些差異常常就會造成無法連線、無法使用的狀況&lt;/p&gt; &lt;p&gt;但是這些差異常常就會造成無法連線、無法使用的狀況&lt;/p&gt;
&lt;p&gt;BTW 我是用 ubiquiti 的 edgerouter X 來做&lt;/p&gt; &lt;p&gt;BTW 我是用 ubiquiti 的 edgerouter X 來做&lt;/p&gt;
&lt;p&gt;都弄好之後就想說來跑個iperf3 測試一下連線速度&lt;/p&gt; &lt;p&gt;都弄好之後就想說來跑個iperf3 測試一下連線速度&lt;/p&gt;
&lt;p&gt;也好和之前做的 IPSEC 比較一下&lt;/p&gt; &lt;p&gt;也好和之前做的 IPSEC 比較一下&lt;/p&gt;
&lt;p&gt;結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config&lt;/p&gt; &lt;p&gt;結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config&lt;/p&gt;
&lt;p&gt;但是有一台edgerouter X 的VPN 連接速度就是特別慢&lt;/p&gt; &lt;p&gt;但是有一台edgerouter X 的VPN 連接速度就是特別慢&lt;/p&gt;
&lt;p&gt;而且速度都剛好卡在 99.X Mb 左右&lt;/p&gt; &lt;p&gt;而且速度都剛好卡在 99.X Mb 左右&lt;/p&gt;
&lt;p&gt;就讓我很納悶了&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;就讓我很納悶了&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -120,19 +108,12 @@
<guid>https://h.cowbay.org/post/debian-buster-server-been-hacked/</guid> <guid>https://h.cowbay.org/post/debian-buster-server-been-hacked/</guid>
<description>&lt;p&gt;上禮拜某天在開會的時候LINE不斷傳來訊息&lt;/p&gt; <description>&lt;p&gt;上禮拜某天在開會的時候LINE不斷傳來訊息&lt;/p&gt;
&lt;p&gt;不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了&lt;/p&gt; &lt;p&gt;不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了&lt;/p&gt;
&lt;p&gt;看來大概有啥事發生&lt;/p&gt; &lt;p&gt;看來大概有啥事發生&lt;/p&gt;
&lt;p&gt;不過畢竟不是正職的工作,就先放著吧&lt;/p&gt; &lt;p&gt;不過畢竟不是正職的工作,就先放著吧&lt;/p&gt;
&lt;p&gt;後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我&lt;/p&gt; &lt;p&gt;後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我&lt;/p&gt;
&lt;p&gt;叫我趕快連進去看&lt;/p&gt; &lt;p&gt;叫我趕快連進去看&lt;/p&gt;
&lt;p&gt;是說,啊我又沒跟人家簽維護,趕什麼趕&amp;hellip;&lt;/p&gt; &lt;p&gt;是說,啊我又沒跟人家簽維護,趕什麼趕&amp;hellip;&lt;/p&gt;
&lt;p&gt;總之,開完會後就了解一下狀況&lt;/p&gt;</description> &lt;p&gt;總之,開完會後就了解一下狀況&lt;/p&gt;</description>
</item> </item>
@ -143,13 +124,9 @@
<guid>https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/</guid> <guid>https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/</guid>
<description>&lt;p&gt;工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)&lt;/p&gt; <description>&lt;p&gt;工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)&lt;/p&gt;
&lt;p&gt;結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了&lt;/p&gt; &lt;p&gt;結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了&lt;/p&gt;
&lt;p&gt;手動下指令也啟動不了&lt;/p&gt; &lt;p&gt;手動下指令也啟動不了&lt;/p&gt;
&lt;p&gt;查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包&lt;/p&gt; &lt;p&gt;查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包&lt;/p&gt;
&lt;p&gt;看來就連kernel 最好都不要自動升級&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;看來就連kernel 最好都不要自動升級&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -160,9 +137,7 @@
<guid>https://h.cowbay.org/post/ubuntu-1804-preseeds/</guid> <guid>https://h.cowbay.org/post/ubuntu-1804-preseeds/</guid>
<description>&lt;p&gt;ubuntu 18.04 預設移掉了 /etc/rc.local 的功能&lt;/p&gt; <description>&lt;p&gt;ubuntu 18.04 預設移掉了 /etc/rc.local 的功能&lt;/p&gt;
&lt;p&gt;變成要用 systemd 的方式來運作,可是有點難用…&lt;/p&gt; &lt;p&gt;變成要用 systemd 的方式來運作,可是有點難用…&lt;/p&gt;
&lt;p&gt;紀錄一下步驟,再來研究怎麼整合到 preseed 裡面&lt;/p&gt;</description> &lt;p&gt;紀錄一下步驟,再來研究怎麼整合到 preseed 裡面&lt;/p&gt;</description>
</item> </item>
@ -173,11 +148,8 @@
<guid>https://h.cowbay.org/post/ubuntu-1404-preseed/</guid> <guid>https://h.cowbay.org/post/ubuntu-1404-preseed/</guid>
<description>&lt;p&gt;這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04&lt;/p&gt; <description>&lt;p&gt;這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04&lt;/p&gt;
&lt;p&gt;在安裝完成後,會發出郵件通知管理者已經安裝完成&lt;/p&gt; &lt;p&gt;在安裝完成後,會發出郵件通知管理者已經安裝完成&lt;/p&gt;
&lt;p&gt;可是某次ansible 更新之後,反而沒辦法安裝完成&lt;/p&gt; &lt;p&gt;可是某次ansible 更新之後,反而沒辦法安裝完成&lt;/p&gt;
&lt;p&gt;這次順手修改一下同時更新了ansible 的template&lt;/p&gt;</description> &lt;p&gt;這次順手修改一下同時更新了ansible 的template&lt;/p&gt;</description>
</item> </item>
@ -188,15 +160,10 @@
<guid>https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/</guid> <guid>https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/</guid>
<description>&lt;p&gt;ubuntu 18.04 的 DNS 設定很煩&lt;/p&gt; <description>&lt;p&gt;ubuntu 18.04 的 DNS 設定很煩&lt;/p&gt;
&lt;p&gt;系統預設會用NetworkManager 去管理&lt;/p&gt; &lt;p&gt;系統預設會用NetworkManager 去管理&lt;/p&gt;
&lt;p&gt;然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式&lt;/p&gt; &lt;p&gt;然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式&lt;/p&gt;
&lt;p&gt;之前都是很粗暴的停用 NetworkManager&lt;/p&gt; &lt;p&gt;之前都是很粗暴的停用 NetworkManager&lt;/p&gt;
&lt;p&gt;但是用筆電的user 又需要用 NetworkManager 來管理無線網路&lt;/p&gt; &lt;p&gt;但是用筆電的user 又需要用 NetworkManager 來管理無線網路&lt;/p&gt;
&lt;p&gt;今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf&lt;/p&gt;</description> &lt;p&gt;今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf&lt;/p&gt;</description>
</item> </item>
@ -206,16 +173,11 @@
<pubDate>Wed, 19 Feb 2020 16:22:38 +0800</pubDate> <pubDate>Wed, 19 Feb 2020 16:22:38 +0800</pubDate>
<guid>https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/</guid>
<description>&lt;p&gt;早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 &lt;sup&gt;4&lt;/sup&gt;&amp;frasl;&lt;sub&gt;17&lt;/sub&gt;&lt;/p&gt; <description>&lt;p&gt;早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 4/17&lt;/p&gt;
&lt;p&gt;想說快到期了,看看能不能線上申請展延&lt;/p&gt; &lt;p&gt;想說快到期了,看看能不能線上申請展延&lt;/p&gt;
&lt;p&gt;結果辦公室沒有Linux 可以用的讀卡機&lt;/p&gt; &lt;p&gt;結果辦公室沒有Linux 可以用的讀卡機&lt;/p&gt;
&lt;p&gt;OOXX 咧我們可是號稱全Linux 環境捏!&lt;/p&gt; &lt;p&gt;OOXX 咧我們可是號稱全Linux 環境捏!&lt;/p&gt;
&lt;p&gt;結果居然沒有對應的硬體!?&lt;/p&gt; &lt;p&gt;結果居然沒有對應的硬體!?&lt;/p&gt;
&lt;p&gt;於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!&lt;/p&gt;</description> &lt;p&gt;於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!&lt;/p&gt;</description>
</item> </item>
@ -226,11 +188,8 @@
<guid>https://h.cowbay.org/post/proxmox-with-synology-high-availability/</guid> <guid>https://h.cowbay.org/post/proxmox-with-synology-high-availability/</guid>
<description>&lt;p&gt;前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+&lt;/p&gt; <description>&lt;p&gt;前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+&lt;/p&gt;
&lt;p&gt;詳情請看 &lt;a href=&#34;https://h.cowbay.org/post/first-try-synology-ha/&#34;&gt;https://h.cowbay.org/post/first-try-synology-ha/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;詳情請看 &lt;a href=&#34;https://h.cowbay.org/post/first-try-synology-ha/&#34;&gt;https://h.cowbay.org/post/first-try-synology-ha/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;今天趁尾牙前夕,手邊沒啥要緊事&lt;/p&gt; &lt;p&gt;今天趁尾牙前夕,手邊沒啥要緊事&lt;/p&gt;
&lt;p&gt;就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境&lt;/p&gt;</description> &lt;p&gt;就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境&lt;/p&gt;</description>
</item> </item>
@ -241,15 +200,10 @@
<guid>https://h.cowbay.org/post/first-try-synology-ha/</guid> <guid>https://h.cowbay.org/post/first-try-synology-ha/</guid>
<description>&lt;p&gt;上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了&lt;/p&gt; <description>&lt;p&gt;上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了&lt;/p&gt;
&lt;p&gt;原因應該就是之前的 intel c2000 series cpu 的 bug&lt;/p&gt; &lt;p&gt;原因應該就是之前的 intel c2000 series cpu 的 bug&lt;/p&gt;
&lt;p&gt;只是不知道為什麼這台兩三年來都沒有關機的NAS&lt;/p&gt; &lt;p&gt;只是不知道為什麼這台兩三年來都沒有關機的NAS&lt;/p&gt;
&lt;p&gt;比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)&lt;/p&gt; &lt;p&gt;比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)&lt;/p&gt;
&lt;p&gt;趁著這次機會,看看網路上說的換電阻大法有沒有用!&lt;/p&gt; &lt;p&gt;趁著這次機會,看看網路上說的換電阻大法有沒有用!&lt;/p&gt;
&lt;p&gt;如果有用,就拿這兩台來玩玩 synology high availability !&lt;/p&gt;</description> &lt;p&gt;如果有用,就拿這兩台來玩玩 synology high availability !&lt;/p&gt;</description>
</item> </item>
@ -260,11 +214,8 @@
<guid>https://h.cowbay.org/post/postgresql-pgbench-benchmark/</guid> <guid>https://h.cowbay.org/post/postgresql-pgbench-benchmark/</guid>
<description>&lt;p&gt;昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench&lt;/p&gt; <description>&lt;p&gt;昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench&lt;/p&gt;
&lt;p&gt;分數大概如何,想要跟他的筆電做個比較&lt;/p&gt; &lt;p&gt;分數大概如何,想要跟他的筆電做個比較&lt;/p&gt;
&lt;p&gt;之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本&lt;/p&gt; &lt;p&gt;之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本&lt;/p&gt;
&lt;p&gt;對於pgbench 跑分會有多大的影響&lt;/p&gt;</description> &lt;p&gt;對於pgbench 跑分會有多大的影響&lt;/p&gt;</description>
</item> </item>
@ -275,9 +226,7 @@
<guid>https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/</guid> <guid>https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/</guid>
<description>&lt;p&gt;2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!&lt;/p&gt; <description>&lt;p&gt;2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!&lt;/p&gt;
&lt;p&gt;因為群暉的文件在最關鍵的一步寫得亂七八糟!&lt;/p&gt; &lt;p&gt;因為群暉的文件在最關鍵的一步寫得亂七八糟!&lt;/p&gt;
&lt;p&gt;所以在這邊紀錄一下我操作的步驟!&lt;/p&gt;</description> &lt;p&gt;所以在這邊紀錄一下我操作的步驟!&lt;/p&gt;</description>
</item> </item>
@ -288,11 +237,8 @@
<guid>https://h.cowbay.org/post/what-a-piss-in-synology-document/</guid> <guid>https://h.cowbay.org/post/what-a-piss-in-synology-document/</guid>
<description>&lt;p&gt;2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了&lt;/p&gt; <description>&lt;p&gt;2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了&lt;/p&gt;
&lt;p&gt;開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況&lt;/p&gt; &lt;p&gt;開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況&lt;/p&gt;
&lt;p&gt;終於宣告不治&lt;/p&gt; &lt;p&gt;終於宣告不治&lt;/p&gt;
&lt;p&gt;問題很明顯的就是Intel C2000 系列 CPU 的瑕疵&lt;/p&gt;</description> &lt;p&gt;問題很明顯的就是Intel C2000 系列 CPU 的瑕疵&lt;/p&gt;</description>
</item> </item>
@ -303,11 +249,8 @@
<guid>https://h.cowbay.org/post/ansible-get-value-from-loop-register/</guid> <guid>https://h.cowbay.org/post/ansible-get-value-from-loop-register/</guid>
<description>&lt;p&gt;今天在寫一支客製化 firefox 的playbook&lt;/p&gt; <description>&lt;p&gt;今天在寫一支客製化 firefox 的playbook&lt;/p&gt;
&lt;p&gt;因為firefox 會給每個user 建立一個由亂數字串組成的default profile&lt;/p&gt; &lt;p&gt;因為firefox 會給每個user 建立一個由亂數字串組成的default profile&lt;/p&gt;
&lt;p&gt;所以每個user的 default profile 都不同&lt;/p&gt; &lt;p&gt;所以每個user的 default profile 都不同&lt;/p&gt;
&lt;p&gt;也因此在用register處理的時候碰到了一些問題&lt;/p&gt;</description> &lt;p&gt;也因此在用register處理的時候碰到了一些問題&lt;/p&gt;</description>
</item> </item>
@ -318,13 +261,9 @@
<guid>https://h.cowbay.org/post/ansible-ssh-forwardagent/</guid> <guid>https://h.cowbay.org/post/ansible-ssh-forwardagent/</guid>
<description>&lt;p&gt;正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent&lt;/p&gt; <description>&lt;p&gt;正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent&lt;/p&gt;
&lt;p&gt;總之就是在寫一隻ansible playbook&lt;/p&gt; &lt;p&gt;總之就是在寫一隻ansible playbook&lt;/p&gt;
&lt;p&gt;目的是用來安裝、設定 firefox&lt;/p&gt; &lt;p&gt;目的是用來安裝、設定 firefox&lt;/p&gt;
&lt;p&gt;包含安裝 firefox addon&lt;/p&gt; &lt;p&gt;包含安裝 firefox addon&lt;/p&gt;
&lt;p&gt;但是一開始在執行的時候,碰到了一些錯誤&lt;/p&gt;</description> &lt;p&gt;但是一開始在執行的時候,碰到了一些錯誤&lt;/p&gt;</description>
</item> </item>
@ -335,15 +274,10 @@
<guid>https://h.cowbay.org/post/test-pg_prewarm/</guid> <guid>https://h.cowbay.org/post/test-pg_prewarm/</guid>
<description>&lt;p&gt;老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面&lt;/p&gt; <description>&lt;p&gt;老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面&lt;/p&gt;
&lt;p&gt;但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)&lt;/p&gt; &lt;p&gt;但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)&lt;/p&gt;
&lt;p&gt;在找資料的時候發現了這個postgresql 的 pg_prewarm extension&lt;/p&gt; &lt;p&gt;在找資料的時候發現了這個postgresql 的 pg_prewarm extension&lt;/p&gt;
&lt;p&gt;好像有點意思?就來測試看看吧!&lt;/p&gt; &lt;p&gt;好像有點意思?就來測試看看吧!&lt;/p&gt;
&lt;p&gt;只是目前還不知道該怎麼解讀測試的數據就是了&amp;hellip;&lt;/p&gt; &lt;p&gt;只是目前還不知道該怎麼解讀測試的數據就是了&amp;hellip;&lt;/p&gt;
&lt;p&gt;幹!林北真的不是 DBA 啦 =.=&lt;/p&gt;</description> &lt;p&gt;幹!林北真的不是 DBA 啦 =.=&lt;/p&gt;</description>
</item> </item>
@ -354,9 +288,7 @@
<guid>https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/</guid> <guid>https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/</guid>
<description>&lt;p&gt;剛剛在跑一個修改過的playbook卻發現一個詭異的狀況&lt;/p&gt; <description>&lt;p&gt;剛剛在跑一個修改過的playbook卻發現一個詭異的狀況&lt;/p&gt;
&lt;p&gt;在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄&lt;/p&gt; &lt;p&gt;在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄&lt;/p&gt;
&lt;p&gt;怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤&lt;/p&gt;</description> &lt;p&gt;怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤&lt;/p&gt;</description>
</item> </item>
@ -367,11 +299,8 @@
<guid>https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/</guid> <guid>https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/</guid>
<description>&lt;p&gt;這幾天在ansible 寫了一份新的playbook給developer 用&lt;/p&gt; <description>&lt;p&gt;這幾天在ansible 寫了一份新的playbook給developer 用&lt;/p&gt;
&lt;p&gt;然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon&lt;/p&gt; &lt;p&gt;然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon&lt;/p&gt;
&lt;p&gt;我才發現原來之前的寫法不能用在 ubuntu 18.04 上&lt;/p&gt; &lt;p&gt;我才發現原來之前的寫法不能用在 ubuntu 18.04 上&lt;/p&gt;
&lt;p&gt;只好又弄了一份出來&lt;/p&gt;</description> &lt;p&gt;只好又弄了一份出來&lt;/p&gt;</description>
</item> </item>
@ -382,19 +311,12 @@
<guid>https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/</guid> <guid>https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/</guid>
<description>&lt;p&gt;最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04&lt;/p&gt; <description>&lt;p&gt;最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04&lt;/p&gt;
&lt;p&gt;因為公司政策的關係所以現在要連接internet ,需要申請&lt;/p&gt; &lt;p&gt;因為公司政策的關係所以現在要連接internet ,需要申請&lt;/p&gt;
&lt;p&gt;然後 user 再去系統的proxy 設定新增一個 PAC 檔&lt;/p&gt; &lt;p&gt;然後 user 再去系統的proxy 設定新增一個 PAC 檔&lt;/p&gt;
&lt;p&gt;但是這個動作其實是去叫NetworkManager 這個服務&lt;/p&gt; &lt;p&gt;但是這個動作其實是去叫NetworkManager 這個服務&lt;/p&gt;
&lt;p&gt;可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定&lt;/p&gt; &lt;p&gt;可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定&lt;/p&gt;
&lt;p&gt;所以想試試看有沒有辦法不使用 NetworkManager 服務&lt;/p&gt; &lt;p&gt;所以想試試看有沒有辦法不使用 NetworkManager 服務&lt;/p&gt;
&lt;p&gt;又能夠在 user level 修改 proxy 參數&lt;/p&gt; &lt;p&gt;又能夠在 user level 修改 proxy 參數&lt;/p&gt;
&lt;p&gt;就想到了用 dconf 來做&lt;/p&gt;</description> &lt;p&gt;就想到了用 dconf 來做&lt;/p&gt;</description>
</item> </item>
@ -405,11 +327,8 @@
<guid>https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/</guid> <guid>https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/</guid>
<description>&lt;p&gt;最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案&lt;/p&gt; <description>&lt;p&gt;最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案&lt;/p&gt;
&lt;p&gt;就不小心發現了這個 streisand&lt;/p&gt; &lt;p&gt;就不小心發現了這個 streisand&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/StreisandEffect/streisand&#34;&gt;https://github.com/StreisandEffect/streisand&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://github.com/StreisandEffect/streisand&#34;&gt;https://github.com/StreisandEffect/streisand&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;玩了一下發現這根本就是終極的VPN Server solution ..&lt;/p&gt;</description> &lt;p&gt;玩了一下發現這根本就是終極的VPN Server solution ..&lt;/p&gt;</description>
</item> </item>
@ -420,7 +339,6 @@
<guid>https://h.cowbay.org/post/recommended-ulauncher-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/recommended-ulauncher-in-ubuntu-1804/</guid>
<description>&lt;p&gt;這兩天在找關於在 ubuntu 中做搜尋的軟體&lt;/p&gt; <description>&lt;p&gt;這兩天在找關於在 ubuntu 中做搜尋的軟體&lt;/p&gt;
&lt;p&gt;意外找到一個非常好用的工具 ulauncher&lt;/p&gt;</description> &lt;p&gt;意外找到一個非常好用的工具 ulauncher&lt;/p&gt;</description>
</item> </item>
@ -431,15 +349,10 @@
<guid>https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/</guid> <guid>https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/</guid>
<description>&lt;p&gt;最近都在弄postgresql&lt;/p&gt; <description>&lt;p&gt;最近都在弄postgresql&lt;/p&gt;
&lt;p&gt;備份、還原測試得差不多了,就等著看到時候要用什麼方式&lt;/p&gt; &lt;p&gt;備份、還原測試得差不多了,就等著看到時候要用什麼方式&lt;/p&gt;
&lt;p&gt;前幾天看到 pg_auto_failover 這個postgresql 的extension&lt;/p&gt; &lt;p&gt;前幾天看到 pg_auto_failover 這個postgresql 的extension&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/citusdata/pg_auto_failover&#34;&gt;https://github.com/citusdata/pg_auto_failover&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://github.com/citusdata/pg_auto_failover&#34;&gt;https://github.com/citusdata/pg_auto_failover&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA&lt;/p&gt; &lt;p&gt;感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA&lt;/p&gt;
&lt;p&gt;不過,反正當作練功嘛,多測試一套也不錯!&lt;/p&gt;</description> &lt;p&gt;不過,反正當作練功嘛,多測試一套也不錯!&lt;/p&gt;</description>
</item> </item>
@ -461,9 +374,7 @@
<guid>https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/</guid> <guid>https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/</guid>
<description>&lt;p&gt;前面測試了用pgbarman / pgbackrest 來備份 postgresql&lt;/p&gt; <description>&lt;p&gt;前面測試了用pgbarman / pgbackrest 來備份 postgresql&lt;/p&gt;
&lt;p&gt;這次改從system file level 來下手&lt;/p&gt; &lt;p&gt;這次改從system file level 來下手&lt;/p&gt;
&lt;p&gt;採用zfs 的快照來備份、還原postgresql 資料庫&lt;/p&gt;</description> &lt;p&gt;採用zfs 的快照來備份、還原postgresql 資料庫&lt;/p&gt;</description>
</item> </item>
@ -492,11 +403,8 @@
<guid>https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/</guid> <guid>https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/</guid>
<description>&lt;p&gt;很久以前就有看到這個用來備份postgresql 的 pgbarman&lt;/p&gt; <description>&lt;p&gt;很久以前就有看到這個用來備份postgresql 的 pgbarman&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.pgbarman.org/&#34;&gt;https://www.pgbarman.org/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.pgbarman.org/&#34;&gt;https://www.pgbarman.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看&lt;/p&gt; &lt;p&gt;前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看&lt;/p&gt;
&lt;p&gt;不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -507,11 +415,8 @@
<guid>https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/</guid>
<description>&lt;p&gt;因為老闆說要試試看用GPU 來跑postgresql 威力&lt;/p&gt; <description>&lt;p&gt;因為老闆說要試試看用GPU 來跑postgresql 威力&lt;/p&gt;
&lt;p&gt;手邊剛好有一張 geforce gt 720&lt;/p&gt; &lt;p&gt;手邊剛好有一張 geforce gt 720&lt;/p&gt;
&lt;p&gt;一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援&lt;/p&gt; &lt;p&gt;一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援&lt;/p&gt;
&lt;p&gt;就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -522,17 +427,11 @@
<guid>https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/</guid> <guid>https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/</guid>
<description>&lt;p&gt;最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立&lt;/p&gt; <description>&lt;p&gt;最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立&lt;/p&gt;
&lt;p&gt;想說再打個VPN tunnel 來當跳板連 ptt 好了&lt;/p&gt; &lt;p&gt;想說再打個VPN tunnel 來當跳板連 ptt 好了&lt;/p&gt;
&lt;p&gt;因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境&lt;/p&gt; &lt;p&gt;因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境&lt;/p&gt;
&lt;p&gt;本來是在vultr 的VPS上面建立這個tunnel&lt;/p&gt; &lt;p&gt;本來是在vultr 的VPS上面建立這個tunnel&lt;/p&gt;
&lt;p&gt;但是那台VPS連去ptt 很頓,卡卡的&lt;/p&gt; &lt;p&gt;但是那台VPS連去ptt 很頓,卡卡的&lt;/p&gt;
&lt;p&gt;所以改用google cloud platform 的free tier 來做&lt;/p&gt; &lt;p&gt;所以改用google cloud platform 的free tier 來做&lt;/p&gt;
&lt;p&gt;反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態&lt;/p&gt;</description> &lt;p&gt;反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態&lt;/p&gt;</description>
</item> </item>
@ -543,15 +442,10 @@
<guid>https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/</guid> <guid>https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/</guid>
<description>&lt;p&gt;因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN&lt;/p&gt; <description>&lt;p&gt;因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN&lt;/p&gt;
&lt;p&gt;雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了&lt;/p&gt; &lt;p&gt;雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了&lt;/p&gt;
&lt;p&gt;完全沒辦法了解當時設計的邏輯造成後續debug 困難&lt;/p&gt; &lt;p&gt;完全沒辦法了解當時設計的邏輯造成後續debug 困難&lt;/p&gt;
&lt;p&gt;可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌&lt;/p&gt; &lt;p&gt;可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌&lt;/p&gt;
&lt;p&gt;之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點&lt;/p&gt; &lt;p&gt;之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點&lt;/p&gt;
&lt;p&gt;這次試試看躲在gateway後面看看能不能建立多點的VPN環境&lt;/p&gt;</description> &lt;p&gt;這次試試看躲在gateway後面看看能不能建立多點的VPN環境&lt;/p&gt;</description>
</item> </item>
@ -562,23 +456,14 @@
<guid>https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/</guid> <guid>https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/</guid>
<description>&lt;p&gt;之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt&lt;/p&gt; <description>&lt;p&gt;之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt&lt;/p&gt;
&lt;p&gt;然後用strongswan 來打 IPSEC site to site VPN&lt;/p&gt; &lt;p&gt;然後用strongswan 來打 IPSEC site to site VPN&lt;/p&gt;
&lt;p&gt;config 看起來不是很難 (只是看起來)&lt;/p&gt; &lt;p&gt;config 看起來不是很難 (只是看起來)&lt;/p&gt;
&lt;p&gt;但是實際上已經找不到當初的文件&lt;/p&gt; &lt;p&gt;但是實際上已經找不到當初的文件&lt;/p&gt;
&lt;p&gt;所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)&lt;/p&gt; &lt;p&gt;所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)&lt;/p&gt;
&lt;p&gt;後來採購了兩台edgerouter X 做測試&lt;/p&gt; &lt;p&gt;後來採購了兩台edgerouter X 做測試&lt;/p&gt;
&lt;p&gt;也用openvpn 成功的建立了 site to site VPN&lt;/p&gt; &lt;p&gt;也用openvpn 成功的建立了 site to site VPN&lt;/p&gt;
&lt;p&gt;本來想說 openvpn 已經夠簡單了&lt;/p&gt; &lt;p&gt;本來想說 openvpn 已經夠簡單了&lt;/p&gt;
&lt;p&gt;今天看到文章說用wireguard 可以更簡單&lt;/p&gt; &lt;p&gt;今天看到文章說用wireguard 可以更簡單&lt;/p&gt;
&lt;p&gt;於是研究了一下,發現還真的很簡單!&lt;/p&gt;</description> &lt;p&gt;於是研究了一下,發現還真的很簡單!&lt;/p&gt;</description>
</item> </item>
@ -589,16 +474,10 @@
<guid>https://h.cowbay.org/post/another-way-to-keep-ansible-log/</guid> <guid>https://h.cowbay.org/post/another-way-to-keep-ansible-log/</guid>
<description>&lt;p&gt;之前為了能夠在執行完 ansible playbook 後能有個log 可以看&lt;/p&gt; <description>&lt;p&gt;之前為了能夠在執行完 ansible playbook 後能有個log 可以看&lt;/p&gt;
&lt;p&gt;所以在每次執行的時候,都要加入 tee 的指令&lt;/p&gt; &lt;p&gt;所以在每次執行的時候,都要加入 tee 的指令&lt;/p&gt;
&lt;p&gt;像是&lt;/p&gt; &lt;p&gt;像是&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log &lt;pre&gt;&lt;code&gt;ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
&lt;/code&gt;&lt;/pre&gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;一直都是放在crontab 裡面執行,也就沒有去管他&lt;/p&gt;
&lt;p&gt;一直都是放在crontab 裡面執行,也就沒有去管他&lt;/p&gt;
&lt;p&gt;反正也沒有人關心結果怎樣 (攤手&lt;/p&gt;</description> &lt;p&gt;反正也沒有人關心結果怎樣 (攤手&lt;/p&gt;</description>
</item> </item>
@ -609,19 +488,12 @@
<guid>https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/</guid> <guid>https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/</guid>
<description>&lt;p&gt;最近有個任務需要大量安裝client&lt;/p&gt; <description>&lt;p&gt;最近有個任務需要大量安裝client&lt;/p&gt;
&lt;p&gt;想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot&lt;/p&gt; &lt;p&gt;想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot&lt;/p&gt;
&lt;p&gt;然後選擇OS版本就可以自動進行安裝&lt;/p&gt; &lt;p&gt;然後選擇OS版本就可以自動進行安裝&lt;/p&gt;
&lt;p&gt;安裝完成後會自動重新開機接著就用ansible來做user環境設定&lt;/p&gt; &lt;p&gt;安裝完成後會自動重新開機接著就用ansible來做user環境設定&lt;/p&gt;
&lt;p&gt;PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了&lt;/p&gt; &lt;p&gt;PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了&lt;/p&gt;
&lt;p&gt;可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機&lt;/p&gt; &lt;p&gt;可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機&lt;/p&gt;
&lt;p&gt;就送出一封郵件來通知我說已經完成安裝可以執行ansible 了&lt;/p&gt; &lt;p&gt;就送出一封郵件來通知我說已經完成安裝可以執行ansible 了&lt;/p&gt;
&lt;p&gt;看似很簡單的一件事情,卻搞了我兩天&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;看似很簡單的一件事情,卻搞了我兩天&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -632,11 +504,8 @@
<guid>https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/</guid> <guid>https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/</guid>
<description>&lt;p&gt;因為工作上的需要要修改client端的 /etc/environment 檔案&lt;/p&gt; <description>&lt;p&gt;因為工作上的需要要修改client端的 /etc/environment 檔案&lt;/p&gt;
&lt;p&gt;在有權限使用proxy 服務的user的環境中加入proxy 的設定&lt;/p&gt; &lt;p&gt;在有權限使用proxy 服務的user的環境中加入proxy 的設定&lt;/p&gt;
&lt;p&gt;原本的清單中有host/user/ip 這幾個值可以拿來判斷&lt;/p&gt; &lt;p&gt;原本的清單中有host/user/ip 這幾個值可以拿來判斷&lt;/p&gt;
&lt;p&gt;proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment&lt;/p&gt;</description> &lt;p&gt;proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment&lt;/p&gt;</description>
</item> </item>
@ -647,9 +516,7 @@
<guid>https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/</guid>
<description>&lt;p&gt;在ansible中關於如何引用自定義的變數一直讓我很頭疼&lt;/p&gt; <description>&lt;p&gt;在ansible中關於如何引用自定義的變數一直讓我很頭疼&lt;/p&gt;
&lt;p&gt;尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數&lt;/p&gt; &lt;p&gt;尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數&lt;/p&gt;
&lt;p&gt;這次還是用selectattr 來處理,希望下次能夠記得&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;這次還是用selectattr 來處理,希望下次能夠記得&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -660,13 +527,9 @@
<guid>https://h.cowbay.org/post/remote-management-system-meshcentral/</guid> <guid>https://h.cowbay.org/post/remote-management-system-meshcentral/</guid>
<description>&lt;p&gt;之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體&lt;/p&gt; <description>&lt;p&gt;之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體&lt;/p&gt;
&lt;p&gt;但是如果要過 internet 就會碰到各種開port的問題&lt;/p&gt; &lt;p&gt;但是如果要過 internet 就會碰到各種開port的問題&lt;/p&gt;
&lt;p&gt;在這種環境下,就有了當時 teamviewer 的橫空出世&lt;/p&gt; &lt;p&gt;在這種環境下,就有了當時 teamviewer 的橫空出世&lt;/p&gt;
&lt;p&gt;解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多&lt;/p&gt; &lt;p&gt;解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多&lt;/p&gt;
&lt;p&gt;只要下載teamviewer被控端開啟後報ID 給協助者就好了&lt;/p&gt;</description> &lt;p&gt;只要下載teamviewer被控端開啟後報ID 給協助者就好了&lt;/p&gt;</description>
</item> </item>
@ -677,15 +540,10 @@
<guid>https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/</guid> <guid>https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/</guid>
<description>&lt;p&gt;前幾天接的一個case&lt;/p&gt; <description>&lt;p&gt;前幾天接的一個case&lt;/p&gt;
&lt;p&gt;因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)&lt;/p&gt; &lt;p&gt;因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)&lt;/p&gt;
&lt;p&gt;改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)&lt;/p&gt; &lt;p&gt;改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)&lt;/p&gt;
&lt;p&gt;storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C&lt;/p&gt; &lt;p&gt;storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C&lt;/p&gt;
&lt;p&gt;既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡&lt;/p&gt; &lt;p&gt;既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡&lt;/p&gt;
&lt;p&gt;一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡&lt;/p&gt;</description> &lt;p&gt;一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡&lt;/p&gt;</description>
</item> </item>
@ -696,7 +554,6 @@
<guid>https://h.cowbay.org/post/change-timezone-in-docker/</guid> <guid>https://h.cowbay.org/post/change-timezone-in-docker/</guid>
<description>&lt;p&gt;最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致&lt;/p&gt; <description>&lt;p&gt;最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致&lt;/p&gt;
&lt;p&gt;有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -707,11 +564,8 @@
<guid>https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/</guid> <guid>https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/</guid>
<description>&lt;p&gt;工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。&lt;/p&gt; <description>&lt;p&gt;工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。&lt;/p&gt;
&lt;p&gt;以前都是傻傻的用 scp 傳檔案&lt;/p&gt; &lt;p&gt;以前都是傻傻的用 scp 傳檔案&lt;/p&gt;
&lt;p&gt;之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行&lt;/p&gt; &lt;p&gt;之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行&lt;/p&gt;
&lt;p&gt;早上研究了一下,順便做個筆記。&lt;/p&gt;</description> &lt;p&gt;早上研究了一下,順便做個筆記。&lt;/p&gt;</description>
</item> </item>
@ -722,13 +576,9 @@
<guid>https://h.cowbay.org/post/inx-collect-detail-hardware-info/</guid> <guid>https://h.cowbay.org/post/inx-collect-detail-hardware-info/</guid>
<description>&lt;p&gt;最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&amp;hellip;.&lt;/p&gt; <description>&lt;p&gt;最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&amp;hellip;.&lt;/p&gt;
&lt;p&gt;然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著&lt;/p&gt; &lt;p&gt;然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著&lt;/p&gt;
&lt;p&gt;所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!&lt;/p&gt; &lt;p&gt;所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!&lt;/p&gt;
&lt;p&gt;也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了&lt;/p&gt; &lt;p&gt;也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了&lt;/p&gt;
&lt;p&gt;然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!&lt;/p&gt;</description> &lt;p&gt;然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!&lt;/p&gt;</description>
</item> </item>
@ -739,11 +589,8 @@
<guid>https://h.cowbay.org/post/log-all-bash-commands/</guid> <guid>https://h.cowbay.org/post/log-all-bash-commands/</guid>
<description>&lt;p&gt;今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案&lt;/p&gt; <description>&lt;p&gt;今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案&lt;/p&gt;
&lt;p&gt;居然不知為何自己產生了,在我記憶中沒有去執行過那個指令&lt;/p&gt; &lt;p&gt;居然不知為何自己產生了,在我記憶中沒有去執行過那個指令&lt;/p&gt;
&lt;p&gt;翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)&lt;/p&gt; &lt;p&gt;翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)&lt;/p&gt;
&lt;p&gt;所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份&lt;/p&gt;</description> &lt;p&gt;所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份&lt;/p&gt;</description>
</item> </item>
@ -754,9 +601,7 @@
<guid>https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/</guid> <guid>https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/</guid>
<description>&lt;p&gt;今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試&lt;/p&gt; <description>&lt;p&gt;今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試&lt;/p&gt;
&lt;p&gt;想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate&lt;/p&gt; &lt;p&gt;想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate&lt;/p&gt;
&lt;p&gt;可是一直出現device busy的錯誤訊息&lt;/p&gt;</description> &lt;p&gt;可是一直出現device busy的錯誤訊息&lt;/p&gt;</description>
</item> </item>
@ -767,7 +612,6 @@
<guid>https://h.cowbay.org/post/transfer-cent62-using-rsync/</guid> <guid>https://h.cowbay.org/post/transfer-cent62-using-rsync/</guid>
<description>&lt;p&gt;公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。&lt;/p&gt; <description>&lt;p&gt;公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。&lt;/p&gt;
&lt;p&gt;看起來不難搞,事實上&amp;hellip;..&lt;/p&gt;</description> &lt;p&gt;看起來不難搞,事實上&amp;hellip;..&lt;/p&gt;</description>
</item> </item>
@ -778,9 +622,7 @@
<guid>https://h.cowbay.org/post/command_to_test_main_ssl/</guid> <guid>https://h.cowbay.org/post/command_to_test_main_ssl/</guid>
<description>&lt;p&gt;今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信&lt;/p&gt; <description>&lt;p&gt;今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信&lt;/p&gt;
&lt;p&gt;然後google 不知道跟人家改了什麼,結果不接受原本的認證了&amp;hellip; WTF &amp;hellip;.&lt;/p&gt; &lt;p&gt;然後google 不知道跟人家改了什麼,結果不接受原本的認證了&amp;hellip; WTF &amp;hellip;.&lt;/p&gt;
&lt;p&gt;然後,這問題應該很久了,結果現在才在講 &amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;然後,這問題應該很久了,結果現在才在講 &amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -791,11 +633,8 @@
<guid>https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/</guid> <guid>https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/</guid>
<description>&lt;p&gt;最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook&lt;/p&gt; <description>&lt;p&gt;最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook&lt;/p&gt;
&lt;p&gt;因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體&lt;/p&gt; &lt;p&gt;因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體&lt;/p&gt;
&lt;p&gt;可以很簡單快速的備份、恢復系統狀態&lt;/p&gt; &lt;p&gt;可以很簡單快速的備份、恢復系統狀態&lt;/p&gt;
&lt;p&gt;可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -806,7 +645,6 @@
<guid>https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/</guid> <guid>https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/</guid>
<description>&lt;p&gt;買了一張 DELL 6/iR 低階的raid 卡&lt;/p&gt; <description>&lt;p&gt;買了一張 DELL 6/iR 低階的raid 卡&lt;/p&gt;
&lt;p&gt;來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -817,9 +655,7 @@
<guid>https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/</guid> <guid>https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/</guid>
<description>&lt;p&gt;最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上&lt;/p&gt; <description>&lt;p&gt;最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上&lt;/p&gt;
&lt;p&gt;因為新開的機器大部分都是在proxmox上所以很少碰實體機器了&lt;/p&gt; &lt;p&gt;因為新開的機器大部分都是在proxmox上所以很少碰實體機器了&lt;/p&gt;
&lt;p&gt;結果在安裝過程中做raid碰到一些問題來紀錄一下&lt;/p&gt;</description> &lt;p&gt;結果在安裝過程中做raid碰到一些問題來紀錄一下&lt;/p&gt;</description>
</item> </item>
@ -830,11 +666,8 @@
<guid>https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/</guid> <guid>https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/</guid>
<description>&lt;p&gt;這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp;amp; Server Backup&lt;/p&gt; <description>&lt;p&gt;這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp;amp; Server Backup&lt;/p&gt;
&lt;p&gt;因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10&lt;/p&gt; &lt;p&gt;因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10&lt;/p&gt;
&lt;p&gt;然後把Freenas 安裝在隨身碟上&lt;/p&gt; &lt;p&gt;然後把Freenas 安裝在隨身碟上&lt;/p&gt;
&lt;p&gt;不過會一直出現Smartd failed to start 的錯誤訊息&lt;/p&gt;</description> &lt;p&gt;不過會一直出現Smartd failed to start 的錯誤訊息&lt;/p&gt;</description>
</item> </item>
@ -845,13 +678,9 @@
<guid>https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/</guid> <guid>https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/</guid>
<description>&lt;p&gt;最近在做一台老機器的P2V&lt;/p&gt; <description>&lt;p&gt;最近在做一台老機器的P2V&lt;/p&gt;
&lt;p&gt;偏偏user說不能關機所以我用dd + ssh 做線上移轉&lt;/p&gt; &lt;p&gt;偏偏user說不能關機所以我用dd + ssh 做線上移轉&lt;/p&gt;
&lt;p&gt;這部份有空再來寫&lt;/p&gt; &lt;p&gt;這部份有空再來寫&lt;/p&gt;
&lt;p&gt;只是因為原來的設定有用mdadm 做raid1&lt;/p&gt; &lt;p&gt;只是因為原來的設定有用mdadm 做raid1&lt;/p&gt;
&lt;p&gt;這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機&lt;/p&gt;</description> &lt;p&gt;這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機&lt;/p&gt;</description>
</item> </item>
@ -862,11 +691,8 @@
<guid>https://h.cowbay.org/post/create-portable-vim-environment/</guid> <guid>https://h.cowbay.org/post/create-portable-vim-environment/</guid>
<description>&lt;p&gt;因為工作的關係現在很多時間都花在VIM的操作上&lt;/p&gt; <description>&lt;p&gt;因為工作的關係現在很多時間都花在VIM的操作上&lt;/p&gt;
&lt;p&gt;所以之前花了滿多時間調整出一個適合自己的VIM環境&lt;/p&gt; &lt;p&gt;所以之前花了滿多時間調整出一個適合自己的VIM環境&lt;/p&gt;
&lt;p&gt;原本的作法是把這個設定好的環境丟到自己建立的gitea 上面&lt;/p&gt; &lt;p&gt;原本的作法是把這個設定好的環境丟到自己建立的gitea 上面&lt;/p&gt;
&lt;p&gt;然後每到一台新的機器就要去clone 下來&lt;/p&gt;</description> &lt;p&gt;然後每到一台新的機器就要去clone 下來&lt;/p&gt;</description>
</item> </item>
@ -877,19 +703,12 @@
<guid>https://h.cowbay.org/post/synology-ds415-repair-cost/</guid> <guid>https://h.cowbay.org/post/synology-ds415-repair-cost/</guid>
<description>&lt;p&gt;前幾天公司的一台 Synology DS 415+ 發生異常&lt;/p&gt; <description>&lt;p&gt;前幾天公司的一台 Synology DS 415+ 發生異常&lt;/p&gt;
&lt;p&gt;注意到的時候,四顆硬碟燈號都不斷的在閃爍&lt;/p&gt; &lt;p&gt;注意到的時候,四顆硬碟燈號都不斷的在閃爍&lt;/p&gt;
&lt;p&gt;但是已經無法登入系統&lt;/p&gt; &lt;p&gt;但是已經無法登入系統&lt;/p&gt;
&lt;p&gt;重開機之後更慘,四顆硬碟燈號全部橘燈恆亮&lt;/p&gt; &lt;p&gt;重開機之後更慘,四顆硬碟燈號全部橘燈恆亮&lt;/p&gt;
&lt;p&gt;底下的電源藍燈不斷的在閃爍&lt;/p&gt; &lt;p&gt;底下的電源藍燈不斷的在閃爍&lt;/p&gt;
&lt;p&gt;雖然我一再表示不希望送修了&lt;/p&gt; &lt;p&gt;雖然我一再表示不希望送修了&lt;/p&gt;
&lt;p&gt;一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&amp;hellip;&lt;/p&gt; &lt;p&gt;一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&amp;hellip;&lt;/p&gt;
&lt;p&gt;不過主管還是希望能夠先問群暉維修的費用多少&lt;/p&gt;</description> &lt;p&gt;不過主管還是希望能夠先問群暉維修的費用多少&lt;/p&gt;</description>
</item> </item>
@ -900,21 +719,13 @@
<guid>https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/</guid> <guid>https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/</guid>
<description>&lt;p&gt;想做一個 10G 的 LAB 環境出來已經很久了。&lt;/p&gt; <description>&lt;p&gt;想做一個 10G 的 LAB 環境出來已經很久了。&lt;/p&gt;
&lt;p&gt;只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜&lt;/p&gt; &lt;p&gt;只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜&lt;/p&gt;
&lt;p&gt;如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)&lt;/p&gt; &lt;p&gt;如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)&lt;/p&gt;
&lt;p&gt;所以一直沒有付諸行動。&lt;/p&gt; &lt;p&gt;所以一直沒有付諸行動。&lt;/p&gt;
&lt;p&gt;硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)&lt;/p&gt; &lt;p&gt;硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)&lt;/p&gt;
&lt;p&gt;聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位&lt;/p&gt; &lt;p&gt;聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位&lt;/p&gt;
&lt;p&gt;就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線&lt;/p&gt; &lt;p&gt;就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線&lt;/p&gt;
&lt;p&gt;就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到&lt;/p&gt; &lt;p&gt;就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到&lt;/p&gt;
&lt;p&gt;今天就花了點時間測試一下&lt;/p&gt;</description> &lt;p&gt;今天就花了點時間測試一下&lt;/p&gt;</description>
</item> </item>
@ -925,9 +736,7 @@
<guid>https://h.cowbay.org/post/ansible-selectattr-filter/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr-filter/</guid>
<description>&lt;p&gt;在上一篇 &lt;a href=&#34;https://h.cowbay.org/post/ansible-selectattr/&#34;&gt;Ansible how to use &amp;lsquo;list&amp;rsquo; in yaml file &lt;/a&gt;&lt;/p&gt; <description>&lt;p&gt;在上一篇 &lt;a href=&#34;https://h.cowbay.org/post/ansible-selectattr/&#34;&gt;Ansible how to use &amp;lsquo;list&amp;rsquo; in yaml file &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單&lt;/p&gt; &lt;p&gt;有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單&lt;/p&gt;
&lt;p&gt;不過就是有點醜&lt;/p&gt;</description> &lt;p&gt;不過就是有點醜&lt;/p&gt;</description>
</item> </item>
@ -938,11 +747,8 @@
<guid>https://h.cowbay.org/post/ansible-selectattr/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr/</guid>
<description>&lt;p&gt;這幾天在玩ansible 時,碰到一個問題&lt;/p&gt; <description>&lt;p&gt;這幾天在玩ansible 時,碰到一個問題&lt;/p&gt;
&lt;p&gt;假如我有個yaml檔作為資料來源檔名是 abc.yml&lt;/p&gt; &lt;p&gt;假如我有個yaml檔作為資料來源檔名是 abc.yml&lt;/p&gt;
&lt;p&gt;大概長這樣&lt;/p&gt; &lt;p&gt;大概長這樣&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &amp;quot;teams&amp;quot;: [ &lt;pre&gt;&lt;code&gt; &amp;quot;teams&amp;quot;: [
{ {
&amp;quot;chinese_name&amp;quot;: &amp;quot;TEAM1&amp;quot;, &amp;quot;chinese_name&amp;quot;: &amp;quot;TEAM1&amp;quot;,
@ -990,11 +796,8 @@
<guid>https://h.cowbay.org/post/change-preferred-language-in-firefox/</guid> <guid>https://h.cowbay.org/post/change-preferred-language-in-firefox/</guid>
<description>&lt;p&gt;最近在測試metabase記得幾個月前就有測試過&lt;/p&gt; <description>&lt;p&gt;最近在測試metabase記得幾個月前就有測試過&lt;/p&gt;
&lt;p&gt;但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的&lt;/p&gt; &lt;p&gt;但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的&lt;/p&gt;
&lt;p&gt;所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)&lt;/p&gt; &lt;p&gt;所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)&lt;/p&gt;
&lt;p&gt;不過呢,很討厭的是,一進去就發現語系採用的是簡體中文&lt;/p&gt;</description> &lt;p&gt;不過呢,很討厭的是,一進去就發現語系採用的是簡體中文&lt;/p&gt;</description>
</item> </item>
@ -1005,11 +808,8 @@
<guid>https://h.cowbay.org/post/copy_role_in_pgsql/</guid> <guid>https://h.cowbay.org/post/copy_role_in_pgsql/</guid>
<description>&lt;p&gt;因為工作上的需求有個資料庫需要開放給不同team的人去存取&lt;/p&gt; <description>&lt;p&gt;因為工作上的需求有個資料庫需要開放給不同team的人去存取&lt;/p&gt;
&lt;p&gt;雖然都是在同一台機器上的同一個資料庫&lt;/p&gt; &lt;p&gt;雖然都是在同一台機器上的同一個資料庫&lt;/p&gt;
&lt;p&gt;但是希望能夠不同team的人用不同的資料庫使用者&lt;/p&gt; &lt;p&gt;但是希望能夠不同team的人用不同的資料庫使用者&lt;/p&gt;
&lt;p&gt;這樣萬一出事,會比較好抓兇手??&lt;/p&gt;</description> &lt;p&gt;這樣萬一出事,會比較好抓兇手??&lt;/p&gt;</description>
</item> </item>
@ -1020,17 +820,11 @@
<guid>https://h.cowbay.org/post/weird-client-server-connection/</guid> <guid>https://h.cowbay.org/post/weird-client-server-connection/</guid>
<description>&lt;p&gt;這是發生在一個夜黑風高的寂寥深夜&amp;hellip;.. ( What The FXXX &amp;hellip; )&lt;/p&gt; <description>&lt;p&gt;這是發生在一個夜黑風高的寂寥深夜&amp;hellip;.. ( What The FXXX &amp;hellip; )&lt;/p&gt;
&lt;p&gt;來到這個環境之後,有一個很詭異的狀況一直困擾著我&lt;/p&gt; &lt;p&gt;來到這個環境之後,有一個很詭異的狀況一直困擾著我&lt;/p&gt;
&lt;p&gt;在每個分公司都會有一台伺服器作為KVM Host&lt;/p&gt; &lt;p&gt;在每個分公司都會有一台伺服器作為KVM Host&lt;/p&gt;
&lt;p&gt;上面跑兩台VM一台作為ansible controller (目前沒作用)&lt;/p&gt; &lt;p&gt;上面跑兩台VM一台作為ansible controller (目前沒作用)&lt;/p&gt;
&lt;p&gt;另一台作為這邊所謂的 &amp;ldquo;Build Server&amp;rdquo;&lt;/p&gt; &lt;p&gt;另一台作為這邊所謂的 &amp;ldquo;Build Server&amp;rdquo;&lt;/p&gt;
&lt;p&gt;用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)&lt;/p&gt; &lt;p&gt;用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)&lt;/p&gt;
&lt;p&gt;問題就發生在這台 Build Server 上&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;問題就發生在這台 Build Server 上&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -1054,22 +848,14 @@
<pubDate>Tue, 06 Nov 2018 14:57:14 +0800</pubDate> <pubDate>Tue, 06 Nov 2018 14:57:14 +0800</pubDate>
<guid>https://h.cowbay.org/post/bookstack-docker/</guid> <guid>https://h.cowbay.org/post/bookstack-docker/</guid>
<description>&lt;p&gt;Bookstack 是一套非常好用的線上&amp;rdquo;筆記&amp;rdquo;系統&lt;/p&gt; <description>&lt;p&gt;Bookstack 是一套非常好用的線上&amp;quot;筆記&amp;quot;系統&lt;/p&gt;
&lt;p&gt;他用圖書館/書本的概念,讓使用者可以建立自己的&amp;quot;圖書館&amp;rdquo;&lt;/p&gt;
&lt;p&gt;他用圖書館/書本的概念,讓使用者可以建立自己的&amp;rdquo;圖書館&amp;rdquo;&lt;/p&gt; &lt;p&gt;同時在圖書館內建立不同的&amp;quot;書籍&amp;rdquo;&lt;/p&gt;
&lt;p&gt;同時在圖書館內建立不同的&amp;rdquo;書籍&amp;rdquo;&lt;/p&gt;
&lt;p&gt;而且支援 Markdown 語法&lt;/p&gt; &lt;p&gt;而且支援 Markdown 語法&lt;/p&gt;
&lt;p&gt;其他的方式像是在nextcloud上編輯 md檔案(字體太小)&lt;/p&gt; &lt;p&gt;其他的方式像是在nextcloud上編輯 md檔案(字體太小)&lt;/p&gt;
&lt;p&gt;或者是boostnote(只能在本機)&lt;/p&gt; &lt;p&gt;或者是boostnote(只能在本機)&lt;/p&gt;
&lt;p&gt;都或多或少有點小缺點&lt;/p&gt; &lt;p&gt;都或多或少有點小缺點&lt;/p&gt;
&lt;p&gt;Bookstack則是沒有這些問題不過就是系統「大」了點&amp;hellip;&lt;/p&gt; &lt;p&gt;Bookstack則是沒有這些問題不過就是系統「大」了點&amp;hellip;&lt;/p&gt;
&lt;p&gt;不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)&lt;/p&gt;</description> &lt;p&gt;不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)&lt;/p&gt;</description>
</item> </item>
@ -1081,16 +867,11 @@
<guid>https://h.cowbay.org/post/enable-synology-public-ssh/</guid> <guid>https://h.cowbay.org/post/enable-synology-public-ssh/</guid>
<description>&lt;p&gt;公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file <description>&lt;p&gt;公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file
之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來&lt;/p&gt; 之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來&lt;/p&gt;
&lt;p&gt;這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體 &lt;p&gt;這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體
像是這篇&lt;/p&gt; 像是這篇&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&#34;&gt;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&#34;&gt;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;或者是這篇&lt;/p&gt; &lt;p&gt;或者是這篇&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.maketecheasier.com/mount-google-drive-ubuntu/&#34;&gt;https://www.maketecheasier.com/mount-google-drive-ubuntu/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.maketecheasier.com/mount-google-drive-ubuntu/&#34;&gt;https://www.maketecheasier.com/mount-google-drive-ubuntu/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;但是手邊的伺服器原則上除非有必要不然都沒有開放internet &lt;p&gt;但是手邊的伺服器原則上除非有必要不然都沒有開放internet
所以導致明明檔案就在那邊,但是要取得就是很麻煩&lt;/p&gt;</description> 所以導致明明檔案就在那邊,但是要取得就是很麻煩&lt;/p&gt;</description>
</item> </item>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,9 +321,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試</p> <p>今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試</p>
<p>想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate</p> <p>想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate</p>
<p>可是一直出現device busy的錯誤訊息</p> <p>可是一直出現device busy的錯誤訊息</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -381,7 +375,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。</p> <p>公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。</p>
<p>看起來不難搞,事實上&hellip;..</p> <p>看起來不難搞,事實上&hellip;..</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-cent62-using-rsync/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-cent62-using-rsync/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -430,9 +423,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信</p> <p>今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信</p>
<p>然後google 不知道跟人家改了什麼,結果不接受原本的認證了&hellip; WTF &hellip;.</p> <p>然後google 不知道跟人家改了什麼,結果不接受原本的認證了&hellip; WTF &hellip;.</p>
<p>然後,這問題應該很久了,結果現在才在講 &hellip;.</p> <p>然後,這問題應該很久了,結果現在才在講 &hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/command_to_test_main_ssl/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/command_to_test_main_ssl/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -486,11 +477,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook</p> <p>最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook</p>
<p>因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體</p> <p>因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體</p>
<p>可以很簡單快速的備份、恢復系統狀態</p> <p>可以很簡單快速的備份、恢復系統狀態</p>
<p>可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&hellip;.</p> <p>可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -544,7 +532,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>買了一張 DELL 6/iR 低階的raid 卡</p> <p>買了一張 DELL 6/iR 低階的raid 卡</p>
<p>來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&hellip;</p> <p>來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -829,7 +816,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -841,7 +828,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,9 +321,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上</p> <p>最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上</p>
<p>因為新開的機器大部分都是在proxmox上所以很少碰實體機器了</p> <p>因為新開的機器大部分都是在proxmox上所以很少碰實體機器了</p>
<p>結果在安裝過程中做raid碰到一些問題來紀錄一下</p> <p>結果在安裝過程中做raid碰到一些問題來紀錄一下</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -381,11 +375,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp; Server Backup</p> <p>這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp; Server Backup</p>
<p>因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10</p> <p>因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10</p>
<p>然後把Freenas 安裝在隨身碟上</p> <p>然後把Freenas 安裝在隨身碟上</p>
<p>不過會一直出現Smartd failed to start 的錯誤訊息</p> <p>不過會一直出現Smartd failed to start 的錯誤訊息</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -439,13 +430,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在做一台老機器的P2V</p> <p>最近在做一台老機器的P2V</p>
<p>偏偏user說不能關機所以我用dd + ssh 做線上移轉</p> <p>偏偏user說不能關機所以我用dd + ssh 做線上移轉</p>
<p>這部份有空再來寫</p> <p>這部份有空再來寫</p>
<p>只是因為原來的設定有用mdadm 做raid1</p> <p>只是因為原來的設定有用mdadm 做raid1</p>
<p>這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機</p> <p>這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -499,11 +486,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為工作的關係現在很多時間都花在VIM的操作上</p> <p>因為工作的關係現在很多時間都花在VIM的操作上</p>
<p>所以之前花了滿多時間調整出一個適合自己的VIM環境</p> <p>所以之前花了滿多時間調整出一個適合自己的VIM環境</p>
<p>原本的作法是把這個設定好的環境丟到自己建立的gitea 上面</p> <p>原本的作法是把這個設定好的環境丟到自己建立的gitea 上面</p>
<p>然後每到一台新的機器就要去clone 下來</p> <p>然後每到一台新的機器就要去clone 下來</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/create-portable-vim-environment/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/create-portable-vim-environment/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -557,19 +541,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前幾天公司的一台 Synology DS 415+ 發生異常</p> <p>前幾天公司的一台 Synology DS 415+ 發生異常</p>
<p>注意到的時候,四顆硬碟燈號都不斷的在閃爍</p> <p>注意到的時候,四顆硬碟燈號都不斷的在閃爍</p>
<p>但是已經無法登入系統</p> <p>但是已經無法登入系統</p>
<p>重開機之後更慘,四顆硬碟燈號全部橘燈恆亮</p> <p>重開機之後更慘,四顆硬碟燈號全部橘燈恆亮</p>
<p>底下的電源藍燈不斷的在閃爍</p> <p>底下的電源藍燈不斷的在閃爍</p>
<p>雖然我一再表示不希望送修了</p> <p>雖然我一再表示不希望送修了</p>
<p>一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&hellip;</p> <p>一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&hellip;</p>
<p>不過主管還是希望能夠先問群暉維修的費用多少</p> <p>不過主管還是希望能夠先問群暉維修的費用多少</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/synology-ds415-repair-cost/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/synology-ds415-repair-cost/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -852,7 +829,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -864,7 +841,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,21 +321,13 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>想做一個 10G 的 LAB 環境出來已經很久了。</p> <p>想做一個 10G 的 LAB 環境出來已經很久了。</p>
<p>只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜</p> <p>只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜</p>
<p>如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)</p> <p>如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)</p>
<p>所以一直沒有付諸行動。</p> <p>所以一直沒有付諸行動。</p>
<p>硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)</p> <p>硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)</p>
<p>聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位</p> <p>聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位</p>
<p>就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線</p> <p>就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線</p>
<p>就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到</p> <p>就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到</p>
<p>今天就花了點時間測試一下</p> <p>今天就花了點時間測試一下</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -393,9 +381,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>在上一篇 <a href="https://h.cowbay.org/post/ansible-selectattr/">Ansible how to use &lsquo;list&rsquo; in yaml file </a></p> <p>在上一篇 <a href="https://h.cowbay.org/post/ansible-selectattr/">Ansible how to use &lsquo;list&rsquo; in yaml file </a></p>
<p>有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單</p> <p>有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單</p>
<p>不過就是有點醜</p> <p>不過就是有點醜</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-filter/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-filter/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -449,11 +435,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這幾天在玩ansible 時,碰到一個問題</p> <p>這幾天在玩ansible 時,碰到一個問題</p>
<p>假如我有個yaml檔作為資料來源檔名是 abc.yml</p> <p>假如我有個yaml檔作為資料來源檔名是 abc.yml</p>
<p>大概長這樣</p> <p>大概長這樣</p>
<pre><code> &quot;teams&quot;: [ <pre><code> &quot;teams&quot;: [
{ {
&quot;chinese_name&quot;: &quot;TEAM1&quot;, &quot;chinese_name&quot;: &quot;TEAM1&quot;,
@ -544,11 +527,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在測試metabase記得幾個月前就有測試過</p> <p>最近在測試metabase記得幾個月前就有測試過</p>
<p>但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的</p> <p>但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的</p>
<p>所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)</p> <p>所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)</p>
<p>不過呢,很討厭的是,一進去就發現語系採用的是簡體中文</p> <p>不過呢,很討厭的是,一進去就發現語系採用的是簡體中文</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-preferred-language-in-firefox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-preferred-language-in-firefox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -602,11 +582,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為工作上的需求有個資料庫需要開放給不同team的人去存取</p> <p>因為工作上的需求有個資料庫需要開放給不同team的人去存取</p>
<p>雖然都是在同一台機器上的同一個資料庫</p> <p>雖然都是在同一台機器上的同一個資料庫</p>
<p>但是希望能夠不同team的人用不同的資料庫使用者</p> <p>但是希望能夠不同team的人用不同的資料庫使用者</p>
<p>這樣萬一出事,會比較好抓兇手??</p> <p>這樣萬一出事,會比較好抓兇手??</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/copy_role_in_pgsql/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/copy_role_in_pgsql/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -887,7 +864,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -899,7 +876,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,17 +321,11 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這是發生在一個夜黑風高的寂寥深夜&hellip;.. ( What The FXXX &hellip; )</p> <p>這是發生在一個夜黑風高的寂寥深夜&hellip;.. ( What The FXXX &hellip; )</p>
<p>來到這個環境之後,有一個很詭異的狀況一直困擾著我</p> <p>來到這個環境之後,有一個很詭異的狀況一直困擾著我</p>
<p>在每個分公司都會有一台伺服器作為KVM Host</p> <p>在每個分公司都會有一台伺服器作為KVM Host</p>
<p>上面跑兩台VM一台作為ansible controller (目前沒作用)</p> <p>上面跑兩台VM一台作為ansible controller (目前沒作用)</p>
<p>另一台作為這邊所謂的 &ldquo;Build Server&rdquo;</p> <p>另一台作為這邊所謂的 &ldquo;Build Server&rdquo;</p>
<p>用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)</p> <p>用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)</p>
<p>問題就發生在這台 Build Server 上&hellip;</p> <p>問題就發生在這台 Build Server 上&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/weird-client-server-connection/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/weird-client-server-connection/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -445,22 +435,14 @@ if (!doNotTrack) {
</div> </div>
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>Bookstack 是一套非常好用的線上&rdquo;筆記&rdquo;系統</p> <p>Bookstack 是一套非常好用的線上&quot;筆記&quot;系統</p>
<p>他用圖書館/書本的概念,讓使用者可以建立自己的&quot;圖書館&rdquo;</p>
<p>他用圖書館/書本的概念,讓使用者可以建立自己的&rdquo;圖書館&rdquo;</p> <p>同時在圖書館內建立不同的&quot;書籍&rdquo;</p>
<p>同時在圖書館內建立不同的&rdquo;書籍&rdquo;</p>
<p>而且支援 Markdown 語法</p> <p>而且支援 Markdown 語法</p>
<p>其他的方式像是在nextcloud上編輯 md檔案(字體太小)</p> <p>其他的方式像是在nextcloud上編輯 md檔案(字體太小)</p>
<p>或者是boostnote(只能在本機)</p> <p>或者是boostnote(只能在本機)</p>
<p>都或多或少有點小缺點</p> <p>都或多或少有點小缺點</p>
<p>Bookstack則是沒有這些問題不過就是系統「大」了點&hellip;</p> <p>Bookstack則是沒有這些問題不過就是系統「大」了點&hellip;</p>
<p>不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)</p> <p>不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/bookstack-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/bookstack-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -515,16 +497,11 @@ if (!doNotTrack) {
<article> <article>
<p>公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file <p>公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file
之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來</p> 之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來</p>
<p>這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體 <p>這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體
像是這篇</p> 像是這篇</p>
<p><a href="https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux">https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux</a></p> <p><a href="https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux">https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux</a></p>
<p>或者是這篇</p> <p>或者是這篇</p>
<p><a href="https://www.maketecheasier.com/mount-google-drive-ubuntu/">https://www.maketecheasier.com/mount-google-drive-ubuntu/</a></p> <p><a href="https://www.maketecheasier.com/mount-google-drive-ubuntu/">https://www.maketecheasier.com/mount-google-drive-ubuntu/</a></p>
<p>但是手邊的伺服器原則上除非有必要不然都沒有開放internet <p>但是手邊的伺服器原則上除非有必要不然都沒有開放internet
所以導致明明檔案就在那邊,但是要取得就是很麻煩</p> 所以導致明明檔案就在那邊,但是要取得就是很麻煩</p>
@ -802,7 +779,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -814,7 +791,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,25 +321,15 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在玩ansible + openwrt + wireguard</p> <p>最近在玩ansible + openwrt + wireguard</p>
<p>ansible 腳本寫好之後可以把config 佈署到 openwrt 上</p> <p>ansible 腳本寫好之後可以把config 佈署到 openwrt 上</p>
<p>當然前提是最好用同樣的機器不同的機器在config 上會有一些差異</p> <p>當然前提是最好用同樣的機器不同的機器在config 上會有一些差異</p>
<p>但是這些差異常常就會造成無法連線、無法使用的狀況</p> <p>但是這些差異常常就會造成無法連線、無法使用的狀況</p>
<p>BTW 我是用 ubiquiti 的 edgerouter X 來做</p> <p>BTW 我是用 ubiquiti 的 edgerouter X 來做</p>
<p>都弄好之後就想說來跑個iperf3 測試一下連線速度</p> <p>都弄好之後就想說來跑個iperf3 測試一下連線速度</p>
<p>也好和之前做的 IPSEC 比較一下</p> <p>也好和之前做的 IPSEC 比較一下</p>
<p>結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config</p> <p>結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config</p>
<p>但是有一台edgerouter X 的VPN 連接速度就是特別慢</p> <p>但是有一台edgerouter X 的VPN 連接速度就是特別慢</p>
<p>而且速度都剛好卡在 99.X Mb 左右</p> <p>而且速度都剛好卡在 99.X Mb 左右</p>
<p>就讓我很納悶了&hellip;</p> <p>就讓我很納悶了&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/check-port-speed-in-openwrt/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/check-port-speed-in-openwrt/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -397,19 +383,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>上禮拜某天在開會的時候LINE不斷傳來訊息</p> <p>上禮拜某天在開會的時候LINE不斷傳來訊息</p>
<p>不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了</p> <p>不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了</p>
<p>看來大概有啥事發生</p> <p>看來大概有啥事發生</p>
<p>不過畢竟不是正職的工作,就先放著吧</p> <p>不過畢竟不是正職的工作,就先放著吧</p>
<p>後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我</p> <p>後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我</p>
<p>叫我趕快連進去看</p> <p>叫我趕快連進去看</p>
<p>是說,啊我又沒跟人家簽維護,趕什麼趕&hellip;</p> <p>是說,啊我又沒跟人家簽維護,趕什麼趕&hellip;</p>
<p>總之,開完會後就了解一下狀況</p> <p>總之,開完會後就了解一下狀況</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/debian-buster-server-been-hacked/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/debian-buster-server-been-hacked/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -463,13 +442,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)</p> <p>工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)</p>
<p>結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了</p> <p>結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了</p>
<p>手動下指令也啟動不了</p> <p>手動下指令也啟動不了</p>
<p>查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包</p> <p>查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包</p>
<p>看來就連kernel 最好都不要自動升級&hellip;</p> <p>看來就連kernel 最好都不要自動升級&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -523,9 +498,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>ubuntu 18.04 預設移掉了 /etc/rc.local 的功能</p> <p>ubuntu 18.04 預設移掉了 /etc/rc.local 的功能</p>
<p>變成要用 systemd 的方式來運作,可是有點難用…</p> <p>變成要用 systemd 的方式來運作,可是有點難用…</p>
<p>紀錄一下步驟,再來研究怎麼整合到 preseed 裡面</p> <p>紀錄一下步驟,再來研究怎麼整合到 preseed 裡面</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-preseeds/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1804-preseeds/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -579,11 +552,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04</p> <p>這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04</p>
<p>在安裝完成後,會發出郵件通知管理者已經安裝完成</p> <p>在安裝完成後,會發出郵件通知管理者已經安裝完成</p>
<p>可是某次ansible 更新之後,反而沒辦法安裝完成</p> <p>可是某次ansible 更新之後,反而沒辦法安裝完成</p>
<p>這次順手修改一下同時更新了ansible 的template</p> <p>這次順手修改一下同時更新了ansible 的template</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1404-preseed/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-1404-preseed/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -860,7 +830,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -872,7 +842,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,15 +321,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>ubuntu 18.04 的 DNS 設定很煩</p> <p>ubuntu 18.04 的 DNS 設定很煩</p>
<p>系統預設會用NetworkManager 去管理</p> <p>系統預設會用NetworkManager 去管理</p>
<p>然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式</p> <p>然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式</p>
<p>之前都是很粗暴的停用 NetworkManager</p> <p>之前都是很粗暴的停用 NetworkManager</p>
<p>但是用筆電的user 又需要用 NetworkManager 來管理無線網路</p> <p>但是用筆電的user 又需要用 NetworkManager 來管理無線網路</p>
<p>今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf</p> <p>今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -386,16 +377,11 @@ if (!doNotTrack) {
</div> </div>
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 <sup>4</sup>&frasl;<sub>17</sub></p> <p>早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 4/17</p>
<p>想說快到期了,看看能不能線上申請展延</p> <p>想說快到期了,看看能不能線上申請展延</p>
<p>結果辦公室沒有Linux 可以用的讀卡機</p> <p>結果辦公室沒有Linux 可以用的讀卡機</p>
<p>OOXX 咧我們可是號稱全Linux 環境捏!</p> <p>OOXX 咧我們可是號稱全Linux 環境捏!</p>
<p>結果居然沒有對應的硬體!?</p> <p>結果居然沒有對應的硬體!?</p>
<p>於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!</p> <p>於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -449,11 +435,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+</p> <p>前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+</p>
<p>詳情請看 <a href="https://h.cowbay.org/post/first-try-synology-ha/">https://h.cowbay.org/post/first-try-synology-ha/</a></p> <p>詳情請看 <a href="https://h.cowbay.org/post/first-try-synology-ha/">https://h.cowbay.org/post/first-try-synology-ha/</a></p>
<p>今天趁尾牙前夕,手邊沒啥要緊事</p> <p>今天趁尾牙前夕,手邊沒啥要緊事</p>
<p>就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境</p> <p>就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/proxmox-with-synology-high-availability/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/proxmox-with-synology-high-availability/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -507,15 +490,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了</p> <p>上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了</p>
<p>原因應該就是之前的 intel c2000 series cpu 的 bug</p> <p>原因應該就是之前的 intel c2000 series cpu 的 bug</p>
<p>只是不知道為什麼這台兩三年來都沒有關機的NAS</p> <p>只是不知道為什麼這台兩三年來都沒有關機的NAS</p>
<p>比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)</p> <p>比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)</p>
<p>趁著這次機會,看看網路上說的換電阻大法有沒有用!</p> <p>趁著這次機會,看看網路上說的換電阻大法有沒有用!</p>
<p>如果有用,就拿這兩台來玩玩 synology high availability !</p> <p>如果有用,就拿這兩台來玩玩 synology high availability !</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/first-try-synology-ha/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/first-try-synology-ha/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -569,11 +547,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench</p> <p>昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench</p>
<p>分數大概如何,想要跟他的筆電做個比較</p> <p>分數大概如何,想要跟他的筆電做個比較</p>
<p>之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本</p> <p>之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本</p>
<p>對於pgbench 跑分會有多大的影響</p> <p>對於pgbench 跑分會有多大的影響</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-pgbench-benchmark/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-pgbench-benchmark/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -852,7 +827,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -864,7 +839,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,9 +321,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!</p> <p>2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!</p>
<p>因為群暉的文件在最關鍵的一步寫得亂七八糟!</p> <p>因為群暉的文件在最關鍵的一步寫得亂七八糟!</p>
<p>所以在這邊紀錄一下我操作的步驟!</p> <p>所以在這邊紀錄一下我操作的步驟!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -381,11 +375,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了</p> <p>2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了</p>
<p>開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況</p> <p>開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況</p>
<p>終於宣告不治</p> <p>終於宣告不治</p>
<p>問題很明顯的就是Intel C2000 系列 CPU 的瑕疵</p> <p>問題很明顯的就是Intel C2000 系列 CPU 的瑕疵</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/what-a-piss-in-synology-document/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/what-a-piss-in-synology-document/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -439,11 +430,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天在寫一支客製化 firefox 的playbook</p> <p>今天在寫一支客製化 firefox 的playbook</p>
<p>因為firefox 會給每個user 建立一個由亂數字串組成的default profile</p> <p>因為firefox 會給每個user 建立一個由亂數字串組成的default profile</p>
<p>所以每個user的 default profile 都不同</p> <p>所以每個user的 default profile 都不同</p>
<p>也因此在用register處理的時候碰到了一些問題</p> <p>也因此在用register處理的時候碰到了一些問題</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-get-value-from-loop-register/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-get-value-from-loop-register/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -497,13 +485,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent</p> <p>正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent</p>
<p>總之就是在寫一隻ansible playbook</p> <p>總之就是在寫一隻ansible playbook</p>
<p>目的是用來安裝、設定 firefox</p> <p>目的是用來安裝、設定 firefox</p>
<p>包含安裝 firefox addon</p> <p>包含安裝 firefox addon</p>
<p>但是一開始在執行的時候,碰到了一些錯誤</p> <p>但是一開始在執行的時候,碰到了一些錯誤</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-ssh-forwardagent/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-ssh-forwardagent/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -557,15 +541,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面</p> <p>老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面</p>
<p>但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)</p> <p>但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)</p>
<p>在找資料的時候發現了這個postgresql 的 pg_prewarm extension</p> <p>在找資料的時候發現了這個postgresql 的 pg_prewarm extension</p>
<p>好像有點意思?就來測試看看吧!</p> <p>好像有點意思?就來測試看看吧!</p>
<p>只是目前還不知道該怎麼解讀測試的數據就是了&hellip;</p> <p>只是目前還不知道該怎麼解讀測試的數據就是了&hellip;</p>
<p>幹!林北真的不是 DBA 啦 =.=</p> <p>幹!林北真的不是 DBA 啦 =.=</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/test-pg_prewarm/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/test-pg_prewarm/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -846,7 +825,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -858,7 +837,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,9 +321,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>剛剛在跑一個修改過的playbook卻發現一個詭異的狀況</p> <p>剛剛在跑一個修改過的playbook卻發現一個詭異的狀況</p>
<p>在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄</p> <p>在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄</p>
<p>怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤</p> <p>怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -381,11 +375,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這幾天在ansible 寫了一份新的playbook給developer 用</p> <p>這幾天在ansible 寫了一份新的playbook給developer 用</p>
<p>然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon</p> <p>然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon</p>
<p>我才發現原來之前的寫法不能用在 ubuntu 18.04 上</p> <p>我才發現原來之前的寫法不能用在 ubuntu 18.04 上</p>
<p>只好又弄了一份出來</p> <p>只好又弄了一份出來</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -439,19 +430,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04</p> <p>最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04</p>
<p>因為公司政策的關係所以現在要連接internet ,需要申請</p> <p>因為公司政策的關係所以現在要連接internet ,需要申請</p>
<p>然後 user 再去系統的proxy 設定新增一個 PAC 檔</p> <p>然後 user 再去系統的proxy 設定新增一個 PAC 檔</p>
<p>但是這個動作其實是去叫NetworkManager 這個服務</p> <p>但是這個動作其實是去叫NetworkManager 這個服務</p>
<p>可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定</p> <p>可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定</p>
<p>所以想試試看有沒有辦法不使用 NetworkManager 服務</p> <p>所以想試試看有沒有辦法不使用 NetworkManager 服務</p>
<p>又能夠在 user level 修改 proxy 參數</p> <p>又能夠在 user level 修改 proxy 參數</p>
<p>就想到了用 dconf 來做</p> <p>就想到了用 dconf 來做</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -505,11 +489,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案</p> <p>最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案</p>
<p>就不小心發現了這個 streisand</p> <p>就不小心發現了這個 streisand</p>
<p><a href="https://github.com/StreisandEffect/streisand">https://github.com/StreisandEffect/streisand</a></p> <p><a href="https://github.com/StreisandEffect/streisand">https://github.com/StreisandEffect/streisand</a></p>
<p>玩了一下發現這根本就是終極的VPN Server solution ..</p> <p>玩了一下發現這根本就是終極的VPN Server solution ..</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -563,7 +544,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>這兩天在找關於在 ubuntu 中做搜尋的軟體</p> <p>這兩天在找關於在 ubuntu 中做搜尋的軟體</p>
<p>意外找到一個非常好用的工具 ulauncher</p> <p>意外找到一個非常好用的工具 ulauncher</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/recommended-ulauncher-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/recommended-ulauncher-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -846,7 +826,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -858,7 +838,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,15 +321,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近都在弄postgresql</p> <p>最近都在弄postgresql</p>
<p>備份、還原測試得差不多了,就等著看到時候要用什麼方式</p> <p>備份、還原測試得差不多了,就等著看到時候要用什麼方式</p>
<p>前幾天看到 pg_auto_failover 這個postgresql 的extension</p> <p>前幾天看到 pg_auto_failover 這個postgresql 的extension</p>
<p><a href="https://github.com/citusdata/pg_auto_failover">https://github.com/citusdata/pg_auto_failover</a></p> <p><a href="https://github.com/citusdata/pg_auto_failover">https://github.com/citusdata/pg_auto_failover</a></p>
<p>感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA</p> <p>感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA</p>
<p>不過,反正當作練功嘛,多測試一套也不錯!</p> <p>不過,反正當作練功嘛,多測試一套也不錯!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -441,9 +432,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前面測試了用pgbarman / pgbackrest 來備份 postgresql</p> <p>前面測試了用pgbarman / pgbackrest 來備份 postgresql</p>
<p>這次改從system file level 來下手</p> <p>這次改從system file level 來下手</p>
<p>採用zfs 的快照來備份、還原postgresql 資料庫</p> <p>採用zfs 的快照來備份、還原postgresql 資料庫</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -832,7 +821,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -844,7 +833,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,11 +321,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>很久以前就有看到這個用來備份postgresql 的 pgbarman</p> <p>很久以前就有看到這個用來備份postgresql 的 pgbarman</p>
<p><a href="https://www.pgbarman.org/">https://www.pgbarman.org/</a></p> <p><a href="https://www.pgbarman.org/">https://www.pgbarman.org/</a></p>
<p>前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看</p> <p>前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看</p>
<p>不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&hellip;</p> <p>不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -383,11 +376,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為老闆說要試試看用GPU 來跑postgresql 威力</p> <p>因為老闆說要試試看用GPU 來跑postgresql 威力</p>
<p>手邊剛好有一張 geforce gt 720</p> <p>手邊剛好有一張 geforce gt 720</p>
<p>一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援</p> <p>一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援</p>
<p>就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&hellip;</p> <p>就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -441,17 +431,11 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立</p> <p>最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立</p>
<p>想說再打個VPN tunnel 來當跳板連 ptt 好了</p> <p>想說再打個VPN tunnel 來當跳板連 ptt 好了</p>
<p>因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境</p> <p>因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境</p>
<p>本來是在vultr 的VPS上面建立這個tunnel</p> <p>本來是在vultr 的VPS上面建立這個tunnel</p>
<p>但是那台VPS連去ptt 很頓,卡卡的</p> <p>但是那台VPS連去ptt 很頓,卡卡的</p>
<p>所以改用google cloud platform 的free tier 來做</p> <p>所以改用google cloud platform 的free tier 來做</p>
<p>反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態</p> <p>反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -505,15 +489,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN</p> <p>因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN</p>
<p>雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了</p> <p>雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了</p>
<p>完全沒辦法了解當時設計的邏輯造成後續debug 困難</p> <p>完全沒辦法了解當時設計的邏輯造成後續debug 困難</p>
<p>可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌</p> <p>可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌</p>
<p>之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點</p> <p>之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點</p>
<p>這次試試看躲在gateway後面看看能不能建立多點的VPN環境</p> <p>這次試試看躲在gateway後面看看能不能建立多點的VPN環境</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -567,23 +546,14 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt</p> <p>之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt</p>
<p>然後用strongswan 來打 IPSEC site to site VPN</p> <p>然後用strongswan 來打 IPSEC site to site VPN</p>
<p>config 看起來不是很難 (只是看起來)</p> <p>config 看起來不是很難 (只是看起來)</p>
<p>但是實際上已經找不到當初的文件</p> <p>但是實際上已經找不到當初的文件</p>
<p>所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)</p> <p>所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)</p>
<p>後來採購了兩台edgerouter X 做測試</p> <p>後來採購了兩台edgerouter X 做測試</p>
<p>也用openvpn 成功的建立了 site to site VPN</p> <p>也用openvpn 成功的建立了 site to site VPN</p>
<p>本來想說 openvpn 已經夠簡單了</p> <p>本來想說 openvpn 已經夠簡單了</p>
<p>今天看到文章說用wireguard 可以更簡單</p> <p>今天看到文章說用wireguard 可以更簡單</p>
<p>於是研究了一下,發現還真的很簡單!</p> <p>於是研究了一下,發現還真的很簡單!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -868,7 +838,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -880,7 +850,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,16 +321,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p> <p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p>
<p>所以在每次執行的時候,都要加入 tee 的指令</p> <p>所以在每次執行的時候,都要加入 tee 的指令</p>
<p>像是</p> <p>像是</p>
<pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log <pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
</code></pre> </code></pre><p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>反正也沒有人關心結果怎樣 (攤手</p> <p>反正也沒有人關心結果怎樣 (攤手</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/another-way-to-keep-ansible-log/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/another-way-to-keep-ansible-log/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -388,19 +378,12 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近有個任務需要大量安裝client</p> <p>最近有個任務需要大量安裝client</p>
<p>想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot</p> <p>想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot</p>
<p>然後選擇OS版本就可以自動進行安裝</p> <p>然後選擇OS版本就可以自動進行安裝</p>
<p>安裝完成後會自動重新開機接著就用ansible來做user環境設定</p> <p>安裝完成後會自動重新開機接著就用ansible來做user環境設定</p>
<p>PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了</p> <p>PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了</p>
<p>可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機</p> <p>可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機</p>
<p>就送出一封郵件來通知我說已經完成安裝可以執行ansible 了</p> <p>就送出一封郵件來通知我說已經完成安裝可以執行ansible 了</p>
<p>看似很簡單的一件事情,卻搞了我兩天&hellip;.</p> <p>看似很簡單的一件事情,卻搞了我兩天&hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -454,11 +437,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>因為工作上的需要要修改client端的 /etc/environment 檔案</p> <p>因為工作上的需要要修改client端的 /etc/environment 檔案</p>
<p>在有權限使用proxy 服務的user的環境中加入proxy 的設定</p> <p>在有權限使用proxy 服務的user的環境中加入proxy 的設定</p>
<p>原本的清單中有host/user/ip 這幾個值可以拿來判斷</p> <p>原本的清單中有host/user/ip 這幾個值可以拿來判斷</p>
<p>proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment</p> <p>proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -512,9 +492,7 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>在ansible中關於如何引用自定義的變數一直讓我很頭疼</p> <p>在ansible中關於如何引用自定義的變數一直讓我很頭疼</p>
<p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p> <p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p>
<p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p> <p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -568,13 +546,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體</p> <p>之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體</p>
<p>但是如果要過 internet 就會碰到各種開port的問題</p> <p>但是如果要過 internet 就會碰到各種開port的問題</p>
<p>在這種環境下,就有了當時 teamviewer 的橫空出世</p> <p>在這種環境下,就有了當時 teamviewer 的橫空出世</p>
<p>解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多</p> <p>解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多</p>
<p>只要下載teamviewer被控端開啟後報ID 給協助者就好了</p> <p>只要下載teamviewer被控端開啟後報ID 給協助者就好了</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/remote-management-system-meshcentral/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/remote-management-system-meshcentral/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -859,7 +833,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -871,7 +845,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-us"> <html lang="en-us">
<head> <head>
<meta name="generator" content="Hugo 0.58.3" /><meta charset="utf-8"> <meta name="generator" content="Hugo 0.68.3" /><meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<script type="application/ld+json"> <script type="application/ld+json">
{ {
@ -22,8 +22,8 @@
"accountablePerson" : "", "accountablePerson" : "",
"copyrightHolder" : "", "copyrightHolder" : "",
"copyrightYear" : "2021", "copyrightYear" : "2021",
"datePublished": "2021-07-20 09:19:47 \x2b0800 CST", "datePublished": "2021-08-26 12:08:43 \x2b0800 CST",
"dateModified" : "2021-07-20 09:19:47 \x2b0800 CST", "dateModified" : "2021-08-26 12:08:43 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/", "url" : "https:\/\/h.cowbay.org\/",
"wordCount" : "0", "wordCount" : "0",
"image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"", "image" : "https://h.cowbay.org%!s(\u003cnil\u003e)"",
@ -46,9 +46,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -84,10 +84,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -325,15 +321,10 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>前幾天接的一個case</p> <p>前幾天接的一個case</p>
<p>因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)</p> <p>因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)</p>
<p>改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)</p> <p>改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)</p>
<p>storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C</p> <p>storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C</p>
<p>既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡</p> <p>既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡</p>
<p>一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡</p> <p>一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -387,7 +378,6 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致</p> <p>最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致</p>
<p>有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&hellip;.</p> <p>有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&hellip;.</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-timezone-in-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/change-timezone-in-docker/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -441,11 +431,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。</p> <p>工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。</p>
<p>以前都是傻傻的用 scp 傳檔案</p> <p>以前都是傻傻的用 scp 傳檔案</p>
<p>之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行</p> <p>之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行</p>
<p>早上研究了一下,順便做個筆記。</p> <p>早上研究了一下,順便做個筆記。</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -499,13 +486,9 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&hellip;.</p> <p>最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&hellip;.</p>
<p>然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著</p> <p>然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著</p>
<p>所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!</p> <p>所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!</p>
<p>也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了</p> <p>也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了</p>
<p>然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!</p> <p>然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/inx-collect-detail-hardware-info/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/inx-collect-detail-hardware-info/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -559,11 +542,8 @@ if (!doNotTrack) {
<div class='excerpt-content'> <div class='excerpt-content'>
<article> <article>
<p>今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案</p> <p>今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案</p>
<p>居然不知為何自己產生了,在我記憶中沒有去執行過那個指令</p> <p>居然不知為何自己產生了,在我記憶中沒有去執行過那個指令</p>
<p>翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)</p> <p>翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)</p>
<p>所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份</p> <p>所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份</p>
<div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/log-all-bash-commands/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div> <div class="more-link-wrapper"><a class="more-link" href="https://h.cowbay.org/post/log-all-bash-commands/">Read the post<span class="screen-reader-text">This is a Standard Post</span></a></div>
@ -848,7 +828,7 @@ if (!doNotTrack) {
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -860,7 +840,7 @@ if (!doNotTrack) {
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 用 proxmox \x26 Mellanox SFP 網卡土炮 10G LAB ", "name" : "[筆記] 用 proxmox \x26 Mellanox SFP 網卡土炮 10G LAB ",
"headline" : "[筆記] 用 proxmox \x26 Mellanox SFP 網卡土炮 10G LAB ", "headline" : "[筆記] 用 proxmox \x26 Mellanox SFP 網卡土炮 10G LAB ",
"description" : "\x3cp\x3e想做一個 10G 的 LAB 環境出來已經很久了。\x3c\/p\x3e\n\n\x3cp\x3e只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜\x3c\/p\x3e\n\n\x3cp\x3e如果直接在淘寶購買很怕會買錯(什麼LC\/FC LC\/LC 多模單模 單芯雙芯 SFP\/SFP\x2b 又是什麼光模塊的一大堆規格)\x3c\/p\x3e\n\n\x3cp\x3e所以一直沒有付諸行動。\x3c\/p\x3e\n\n\x3cp\x3e硬體的工作很久沒碰了剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)\x3c\/p\x3e\n\n\x3cp\x3e聊了一下跟他請教了關於線材、光纖模塊的問題回答也都很快很到位\x3c\/p\x3e\n\n\x3cp\x3e就直接下訂了兩張網卡、兩個光纖模塊、一條LC\/LC 光纖線\x3c\/p\x3e\n\n\x3cp\x3e就是到貨有點久等了兩個禮拜左右一直到昨天東西才寄到\x3c\/p\x3e\n\n\x3cp\x3e今天就花了點時間測試一下\x3c\/p\x3e", "description" : "\x3cp\x3e想做一個 10G 的 LAB 環境出來已經很久了。\x3c\/p\x3e\n\x3cp\x3e只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜\x3c\/p\x3e\n\x3cp\x3e如果直接在淘寶購買很怕會買錯(什麼LC\/FC LC\/LC 多模單模 單芯雙芯 SFP\/SFP\x2b 又是什麼光模塊的一大堆規格)\x3c\/p\x3e\n\x3cp\x3e所以一直沒有付諸行動。\x3c\/p\x3e\n\x3cp\x3e硬體的工作很久沒碰了剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)\x3c\/p\x3e\n\x3cp\x3e聊了一下跟他請教了關於線材、光纖模塊的問題回答也都很快很到位\x3c\/p\x3e\n\x3cp\x3e就直接下訂了兩張網卡、兩個光纖模塊、一條LC\/LC 光纖線\x3c\/p\x3e\n\x3cp\x3e就是到貨有點久等了兩個禮拜左右一直到昨天東西才寄到\x3c\/p\x3e\n\x3cp\x3e今天就花了點時間測試一下\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,90 +305,48 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>想做一個 10G 的 LAB 環境出來已經很久了。</p> <p>想做一個 10G 的 LAB 環境出來已經很久了。</p>
<p>只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜</p> <p>只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜</p>
<p>如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)</p> <p>如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)</p>
<p>所以一直沒有付諸行動。</p> <p>所以一直沒有付諸行動。</p>
<p>硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)</p> <p>硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)</p>
<p>聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位</p> <p>聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位</p>
<p>就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線</p> <p>就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線</p>
<p>就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到</p> <p>就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到</p>
<p>今天就花了點時間測試一下</p> <p>今天就花了點時間測試一下</p>
<p>先上個圖!</p> <p>先上個圖!</p>
<p><img src="https://i.imgur.com/34MNFkW.png" alt="10G LAB"></p>
<p><img src="https://i.imgur.com/34MNFkW.png" alt="10G LAB" /></p>
<p>簡單說,就是有兩台機器,分別安裝 proxmox (一台是新裝的另一台是本來就在線上的LAB用機器)以及光纖網卡</p> <p>簡單說,就是有兩台機器,分別安裝 proxmox (一台是新裝的另一台是本來就在線上的LAB用機器)以及光纖網卡</p>
<p>Mellanox 這張 X2 的卡, proxmox 5.1 / 5.2 可以直接抓到,所以不必另外安裝驅動程式</p> <p>Mellanox 這張 X2 的卡, proxmox 5.1 / 5.2 可以直接抓到,所以不必另外安裝驅動程式</p>
<p>硬體安裝很順利,不過軟體的設定就碰到點麻煩了,所以才想說作個筆記..</p> <p>硬體安裝很順利,不過軟體的設定就碰到點麻煩了,所以才想說作個筆記..</p>
<h3 id="strongfont-colorred必須作-vmbridge-才能指定這個網卡給vm用-fontstrong"><!-- raw HTML omitted --><!-- raw HTML omitted -->必須作 vmbridge 才能指定這個網卡給VM用 <!-- raw HTML omitted --><!-- raw HTML omitted --></h3>
<h3 id="strong-font-color-red-必須作-vmbridge-才能指定這個網卡給vm用-font-strong"><strong><font color="red">必須作 vmbridge 才能指定這個網卡給VM用 </font></strong></h3>
<p>安裝好網卡開機透過proxmox的WEB界面設定好網卡的資料後原本以為可以直接使用了</p> <p>安裝好網卡開機透過proxmox的WEB界面設定好網卡的資料後原本以為可以直接使用了</p>
<p>但是proxmox 會提示需要重新開機才能變更設定</p> <p>但是proxmox 會提示需要重新開機才能變更設定</p>
<p>可是重新開機後我兩台怎麼都ping不到對方</p> <p>可是重新開機後我兩台怎麼都ping不到對方</p>
<p>在這之前,我已經用兩台 ubuntu 18.04 client 測試過了只要設定好IP就可以直接通</p> <p>在這之前,我已經用兩台 ubuntu 18.04 client 測試過了只要設定好IP就可以直接通</p>
<p>所以在這邊碰到這個問題,我滿訝異的</p> <p>所以在這邊碰到這個問題,我滿訝異的</p>
<p>可是看網卡的燈號,明明就有亮起來,應該是正常的呀</p> <p>可是看網卡的燈號,明明就有亮起來,應該是正常的呀</p>
<p>原來在proxmox 中,新增了網卡,並不是直接就可以拿來用</p> <p>原來在proxmox 中,新增了網卡,並不是直接就可以拿來用</p>
<p>要先設定好 bridge 然後才能起新的VM、指定新設定的 vmbridge 給這個新起的機器使用</p> <p>要先設定好 bridge 然後才能起新的VM、指定新設定的 vmbridge 給這個新起的機器使用</p>
<h3 id="strongfont-colorreddisk-cache-type-要改fontstrong"><!-- raw HTML omitted --><!-- raw HTML omitted -->Disk Cache type 要改<!-- raw HTML omitted --><!-- raw HTML omitted --></h3>
<h3 id="strong-font-color-red-disk-cache-type-要改-font-strong"><strong><font color="red">Disk Cache type 要改</font></strong></h3>
<p>設定了新的 vmbridge 之後就可以在新VM的設定畫面中指定網卡走這個界面出去</p> <p>設定了新的 vmbridge 之後就可以在新VM的設定畫面中指定網卡走這個界面出去</p>
<p>可是這樣做出來的VM ,一直無法開機</p> <p>可是這樣做出來的VM ,一直無法開機</p>
<p>錯誤訊息如下</p> <p>錯誤訊息如下</p>
<pre><code>kvm: -drive file=/zp/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on: file system may not support O_DIRECT <pre><code>kvm: -drive file=/zp/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on: file system may not support O_DIRECT
kvm: -drive file=/zp/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on: Could not open '/zp/images/100/vm-100-disk-1.qcow2': Invalid argument kvm: -drive file=/zp/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on: Could not open '/zp/images/100/vm-100-disk-1.qcow2': Invalid argument
TASK ERROR: start failed: command '/usr/bin/kvm -id 100 -name 123123 -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=da27a9ea-fd55-4542-b2a7-8d5b09bf7611' -smp '2,sockets=1,cores=2,maxcpus=2' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vga std -vnc unix:/var/run/qemu-server/100.vnc,x509,password -cpu kvm64,+lahf_lm,+sep,+kvm_pv_unhalt,+kvm_pv_eoi,enforce -m 2048 -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:b972d1ad783' -drive 'file=/zp/template/iso/ubuntu-18.04.1-live-server-amd64.iso,if=none,id=drive-ide2,media=cdrom,aio=threads' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' -drive 'file=/zp/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on' -device 'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100' -netdev 'type=tap,id=net0,ifname=tap100i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=A2:EA:45:EE:17:25,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'' failed: exit code 1 TASK ERROR: start failed: command '/usr/bin/kvm -id 100 -name 123123 -chardev 'socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -pidfile /var/run/qemu-server/100.pid -daemonize -smbios 'type=1,uuid=da27a9ea-fd55-4542-b2a7-8d5b09bf7611' -smp '2,sockets=1,cores=2,maxcpus=2' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vga std -vnc unix:/var/run/qemu-server/100.vnc,x509,password -cpu kvm64,+lahf_lm,+sep,+kvm_pv_unhalt,+kvm_pv_eoi,enforce -m 2048 -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:b972d1ad783' -drive 'file=/zp/template/iso/ubuntu-18.04.1-live-server-amd64.iso,if=none,id=drive-ide2,media=cdrom,aio=threads' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' -drive 'file=/zp/images/100/vm-100-disk-1.qcow2,if=none,id=drive-virtio0,format=qcow2,cache=none,aio=native,detect-zeroes=on' -device 'virtio-blk-pci,drive=drive-virtio0,id=virtio0,bus=pci.0,addr=0xa,bootindex=100' -netdev 'type=tap,id=net0,ifname=tap100i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=A2:EA:45:EE:17:25,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'' failed: exit code 1
</code></pre> </code></pre><p>當然先去拜google果然就看到了提示需要把 磁碟的 Cache 從預設的 Default(No Cache) 改成 write through</p>
<p><img src="https://i.imgur.com/cmClmGd.png" alt="proxmox dish cache mode"></p>
<p>當然先去拜google果然就看到了提示需要把 磁碟的 Cache 從預設的 Default(No Cache) 改成 write through</p>
<p><img src="https://i.imgur.com/cmClmGd.png" alt="proxmox dish cache mode" /></p>
<p>為什麼?我也不知道..不知道是不是因為我把磁碟種類選成用 Virtio Block 的關係</p> <p>為什麼?我也不知道..不知道是不是因為我把磁碟種類選成用 Virtio Block 的關係</p>
<p>總之呢,改完之後就可以了 &hellip;</p> <p>總之呢,改完之後就可以了 &hellip;</p>
<h3 id="strongfont-colorred必須手動設定路由fontstrong"><!-- raw HTML omitted --><!-- raw HTML omitted -->必須手動設定路由<!-- raw HTML omitted --><!-- raw HTML omitted --></h3>
<h3 id="strong-font-color-red-必須手動設定路由-font-strong"><strong><font color="red">必須手動設定路由</font></strong></h3>
<h4 id="update">Update</h4> <h4 id="update">Update</h4>
<pre><code>這邊可能是我有誤解應該不需要先在pve 本機設定 10G網卡的 IP <pre><code>這邊可能是我有誤解應該不需要先在pve 本機設定 10G網卡的 IP
直接進web console 去設定 vmbr1 就好了 直接進web console 去設定 vmbr1 就好了
</code></pre> </code></pre><p>設定好新的VM開機、設定IP、重開機之後會發現還是ping 不到另一台機器..(翻桌!)</p>
<p>設定好新的VM開機、設定IP、重開機之後會發現還是ping 不到另一台機器..(翻桌!)</p>
<p>只好又去拜google ,就看到了底下這篇</p> <p>只好又去拜google ,就看到了底下這篇</p>
<p><a href="https://forum.proxmox.com/threads/how-to-add-second-nic.40905/">https://forum.proxmox.com/threads/how-to-add-second-nic.40905/</a></p> <p><a href="https://forum.proxmox.com/threads/how-to-add-second-nic.40905/">https://forum.proxmox.com/threads/how-to-add-second-nic.40905/</a></p>
<p>大概點出了方向,必須要手動增加路由(感覺有點蠢)</p> <p>大概點出了方向,必須要手動增加路由(感覺有點蠢)</p>
<p>像我的光纖網卡走的是 192.168.50.0/24 就要去把原有的192.168.50.0/24的路由給砍掉然後再新增(是不是很蠢?)</p> <p>像我的光纖網卡走的是 192.168.50.0/24 就要去把原有的192.168.50.0/24的路由給砍掉然後再新增(是不是很蠢?)</p>
<pre><code>root@ssd:/etc/network# ip route del 192.168.50.0/24 <pre><code>root@ssd:/etc/network# ip route del 192.168.50.0/24
root@ssd:/etc/network# ip route add 192.168.50.0/24 dev vmbr1 root@ssd:/etc/network# ip route add 192.168.50.0/24 dev vmbr1
root@ssd:/etc/network# ip route root@ssd:/etc/network# ip route
@ -402,10 +356,7 @@ default via 192.168.11.253 dev vmbr0 onlink
192.168.50.0/24 dev vmbr1 scope link 192.168.50.0/24 dev vmbr1 scope link
root@ssd:/etc/network# root@ssd:/etc/network#
</code></pre> </code></pre><p>OK ping 一下對面看能不能過</p>
<p>OK ping 一下對面看能不能過</p>
<pre><code>root@ssd:/etc/network# ping 192.168.50.10 <pre><code>root@ssd:/etc/network# ping 192.168.50.10
PING 192.168.50.10 (192.168.50.10) 56(84) bytes of data. PING 192.168.50.10 (192.168.50.10) 56(84) bytes of data.
64 bytes from 192.168.50.10: icmp_seq=1 ttl=64 time=0.083 ms 64 bytes from 192.168.50.10: icmp_seq=1 ttl=64 time=0.083 ms
@ -414,31 +365,17 @@ PING 192.168.50.10 (192.168.50.10) 56(84) bytes of data.
64 bytes from 192.168.50.10: icmp_seq=4 ttl=64 time=0.126 ms 64 bytes from 192.168.50.10: icmp_seq=4 ttl=64 time=0.126 ms
^C ^C
--- 192.168.50.10 ping statistics --- --- 192.168.50.10 ping statistics ---
</code></pre> </code></pre><p>GOOD !很好!通了一邊,另外一邊就照辦,兩邊都通了,就可以開始來測試速度了</p>
<p>GOOD !很好!通了一邊,另外一邊就照辦,兩邊都通了,就可以開始來測試速度了</p>
<p>p.s 這個路由不知道需不需要每次都手動增加或者是有哪個config可以在開機時載入</p> <p>p.s 這個路由不知道需不需要每次都手動增加或者是有哪個config可以在開機時載入</p>
<p>沒記錯的話,應該是在 /etc/network/if-up.d/ 新增一個 route 檔案</p> <p>沒記錯的話,應該是在 /etc/network/if-up.d/ 新增一個 route 檔案</p>
<p>不過這部份我不是很確定就是了</p> <p>不過這部份我不是很確定就是了</p>
<p>所以自己寫了一個 script 來用..</p> <p>所以自己寫了一個 script 來用..</p>
<h3 id="strongiperf-測試速度strong"><!-- raw HTML omitted -->iperf 測試速度<!-- raw HTML omitted --></h3>
<h3 id="strong-iperf-測試速度-strong"><strong>iperf 測試速度</strong></h3>
<p>在linux 上,我習慣用 iperf 來測試兩台主機的連接速度</p> <p>在linux 上,我習慣用 iperf 來測試兩台主機的連接速度</p>
<p>兩邊都用 apt install iperf 裝好套件</p> <p>兩邊都用 apt install iperf 裝好套件</p>
<p>然後找一台作為 server ,執行</p> <p>然後找一台作為 server ,執行</p>
<pre><code>iperf -s <pre><code>iperf -s
</code></pre> </code></pre><p>然後到另一台,去執行</p>
<p>然後到另一台,去執行</p>
<pre><code>2018-11-30 15:36:58 [minion@ubuntu ~]$ iperf -d -t 600 -P 10 -c 192.168.50.200 <pre><code>2018-11-30 15:36:58 [minion@ubuntu ~]$ iperf -d -t 600 -P 10 -c 192.168.50.200
WARNING: option -d is not valid for server mode WARNING: option -d is not valid for server mode
------------------------------------------------------------ ------------------------------------------------------------
@ -449,14 +386,9 @@ TCP window size: 85.0 KByte (default)
[ ID] Interval Transfer Bandwidth [ ID] Interval Transfer Bandwidth
[ 3] 0.0-600.0 sec 641 GBytes 9.18 Gbits/sec [ 3] 0.0-600.0 sec 641 GBytes 9.18 Gbits/sec
</code></pre> </code></pre><p>哈哈哈,有目有!測試速度來到了 9.18 Gbits 啊! 就是一個爽啊!</p>
<p>哈哈哈,有目有!測試速度來到了 9.18 Gbits 啊! 就是一個爽啊!</p>
<p>記得那個 server IP 是你 VM 裡面設定的 IP不是 proxmox 上面的</p> <p>記得那個 server IP 是你 VM 裡面設定的 IP不是 proxmox 上面的</p>
<p>同場加映走 1Gb 網路的測試結果</p> <p>同場加映走 1Gb 網路的測試結果</p>
<pre><code>2018-11-30 16:39:37 [minion@ubuntu ~]$ iperf -d -t 600 -P 10 -c 192.168.11.171 <pre><code>2018-11-30 16:39:37 [minion@ubuntu ~]$ iperf -d -t 600 -P 10 -c 192.168.11.171
WARNING: option -d is not valid for server mode WARNING: option -d is not valid for server mode
------------------------------------------------------------ ------------------------------------------------------------
@ -467,66 +399,39 @@ TCP window size: 85.0 KByte (default)
[ ID] Interval Transfer Bandwidth [ ID] Interval Transfer Bandwidth
[ 3] 0.0-600.0 sec 65.8 GBytes 941 Mbits/sec [ 3] 0.0-600.0 sec 65.8 GBytes 941 Mbits/sec
</code></pre> </code></pre><p>192.168.11.171 跟 192.168.50.200 是同一台機器只是一個是10G網卡一個是onboard的 1Gb 網卡</p>
<p>192.168.11.171 跟 192.168.50.200 是同一台機器只是一個是10G網卡一個是onboard的 1Gb 網卡</p>
<p>速度果然是提高了十倍呀,果然就是一個爽啊!!</p> <p>速度果然是提高了十倍呀,果然就是一個爽啊!!</p>
<h3 id="strong實際開vm來測試看看strong"><!-- raw HTML omitted -->實際開VM來測試看看<!-- raw HTML omitted --></h3>
<h3 id="strong-實際開vm來測試看看-strong"><strong>實際開VM來測試看看</strong></h3>
<p><del>上面的測試是兩台PVE HOST之間的連線測試</del></p> <p><del>上面的測試是兩台PVE HOST之間的連線測試</del></p>
<p>接下來要實際測試在PVE中建立新的VM一台安裝FreeNAS 作為storage另一台則是一般的client</p> <p>接下來要實際測試在PVE中建立新的VM一台安裝FreeNAS 作為storage另一台則是一般的client</p>
<p>步驟簡單來說就是在ssd 這台PVE 建立一個新的VM然後安裝FREENAS並且提供NFS/iscsi 給另一台PVE Host作為storage來源</p> <p>步驟簡單來說就是在ssd 這台PVE 建立一個新的VM然後安裝FREENAS並且提供NFS/iscsi 給另一台PVE Host作為storage來源</p>
<p>新增storage選NFS填入必要資訊後在這台主機上建立一個新的VM磁碟選擇剛剛連接的NFS</p> <p>新增storage選NFS填入必要資訊後在這台主機上建立一個新的VM磁碟選擇剛剛連接的NFS</p>
<h5 id="strong要特別注意freenas的nfs-share的參數要改strong"><!-- raw HTML omitted -->要特別注意freenas的NFS Share的參數要改<!-- raw HTML omitted -->#####</h5>
<h5 id="strong-要特別注意-freenas的nfs-share的參數要改-strong"><strong>要特別注意freenas的NFS Share的參數要改</strong></h5>
<p>在 mapuser/mapgroup這邊要改成 root/wheel 不然會有無法寫入的問題</p> <p>在 mapuser/mapgroup這邊要改成 root/wheel 不然會有無法寫入的問題</p>
<p><img src="https://i.imgur.com/Yn7qYdK.png" alt="FREENAS NFS Sharing"></p>
<p><img src="https://i.imgur.com/Yn7qYdK.png" alt="FREENAS NFS Sharing" /></p>
<p>安裝完之後,實際跑一下 dd 看看速度多少</p> <p>安裝完之後,實際跑一下 dd 看看速度多少</p>
<pre><code>Last login: Mon Dec 3 03:10:54 2018 <pre><code>Last login: Mon Dec 3 03:10:54 2018
2018-12-03 03:15:03 [administrator@ubuntu ~]$ dd if=/dev/zero of=testfile bs=10240 count=1000000 2018-12-03 03:15:03 [administrator@ubuntu ~]$ dd if=/dev/zero of=testfile bs=10240 count=1000000
1000000+0 records in 1000000+0 records in
1000000+0 records out 1000000+0 records out
10240000000 bytes (10 GB, 9.5 GiB) copied, 9.63458 s, 1.1 GB/s 10240000000 bytes (10 GB, 9.5 GiB) copied, 9.63458 s, 1.1 GB/s
</code></pre> </code></pre><pre><code>2018-12-03 03:17:28 [administrator@ubuntu ~]$ dd if=/dev/zero of=testfile bs=20480 count=1000000
<pre><code>2018-12-03 03:17:28 [administrator@ubuntu ~]$ dd if=/dev/zero of=testfile bs=20480 count=1000000
1000000+0 records in 1000000+0 records in
1000000+0 records out 1000000+0 records out
20480000000 bytes (20 GB, 19 GiB) copied, 16.0786 s, 1.3 GB/s 20480000000 bytes (20 GB, 19 GiB) copied, 16.0786 s, 1.3 GB/s
</code></pre> </code></pre><pre><code>2018-12-03 03:17:50 [administrator@ubuntu ~]$ dd if=/dev/zero of=testfile bs=4096 count=1000000
<pre><code>2018-12-03 03:17:50 [administrator@ubuntu ~]$ dd if=/dev/zero of=testfile bs=4096 count=1000000
1000000+0 records in 1000000+0 records in
1000000+0 records out 1000000+0 records out
4096000000 bytes (4.1 GB, 3.8 GiB) copied, 4.80629 s, 852 MB/s 4096000000 bytes (4.1 GB, 3.8 GiB) copied, 4.80629 s, 852 MB/s
2018-12-03 03:25:23 [administrator@ubuntu ~]$ 2018-12-03 03:25:23 [administrator@ubuntu ~]$
</code></pre> </code></pre><p>可以看到不但大檔案速度都很快,就連小檔案(4096)居然也有852MB</p>
<p>可以看到不但大檔案速度都很快,就連小檔案(4096)居然也有852MB</p>
<p>我底層也不過就是四顆 SATA3 sandisk 240G SSD 而已啊</p> <p>我底層也不過就是四顆 SATA3 sandisk 240G SSD 而已啊</p>
<p>如果都換成PCI-E SSD ,嘿嘿&hellip;(流口水</p> <p>如果都換成PCI-E SSD ,嘿嘿&hellip;(流口水</p>
<hr>
<hr />
<p>不過呢這個也只是自己建的LAB玩玩看而已</p> <p>不過呢這個也只是自己建的LAB玩玩看而已</p>
<p>真的要放到 production 環境去,我也還沒啥把握 (畢竟都是中古、二手、退役的產品拼湊起來的)</p> <p>真的要放到 production 環境去,我也還沒啥把握 (畢竟都是中古、二手、退役的產品拼湊起來的)</p>
<p>而且沒有10G Switch ,所以只能點對點連接</p> <p>而且沒有10G Switch ,所以只能點對點連接</p>
<p>說不定等到對岸的 10G Switch 開始大降價 (我覺得 8 port SFP+ / NTD $2000 左右我應該就會出手了)</p> <p>說不定等到對岸的 10G Switch 開始大降價 (我覺得 8 port SFP+ / NTD $2000 左右我應該就會出手了)</p>
<p>再來把10G 的環境弄完整一點!</p> <p>再來把10G 的環境弄完整一點!</p>
</article> </article>
</div> </div>
@ -806,7 +711,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -818,7 +723,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在ansible playbook中不小心多打了一個空格 \/ Accidentally Typed an Extra Space in Ansible Playbook", "name" : "[筆記] 在ansible playbook中不小心多打了一個空格 \/ Accidentally Typed an Extra Space in Ansible Playbook",
"headline" : "[筆記] 在ansible playbook中不小心多打了一個空格 \/ Accidentally Typed an Extra Space in Ansible Playbook", "headline" : "[筆記] 在ansible playbook中不小心多打了一個空格 \/ Accidentally Typed an Extra Space in Ansible Playbook",
"description" : "\x3cp\x3e剛剛在跑一個修改過的playbook卻發現一個詭異的狀況\x3c\/p\x3e\n\n\x3cp\x3e在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄\x3c\/p\x3e\n\n\x3cp\x3e怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤\x3c\/p\x3e", "description" : "\x3cp\x3e剛剛在跑一個修改過的playbook卻發現一個詭異的狀況\x3c\/p\x3e\n\x3cp\x3e在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄\x3c\/p\x3e\n\x3cp\x3e怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,13 +305,9 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>剛剛在跑一個修改過的playbook卻發現一個詭異的狀況</p> <p>剛剛在跑一個修改過的playbook卻發現一個詭異的狀況</p>
<p>在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄</p> <p>在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄</p>
<p>怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤</p> <p>怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤</p>
<p>原本的 playbook 大概長這樣</p> <p>原本的 playbook 大概長這樣</p>
<pre><code>- name: make dconf/profile folder <pre><code>- name: make dconf/profile folder
file: file:
path: &quot;{{ item }} &quot; path: &quot;{{ item }} &quot;
@ -341,10 +333,7 @@ if (!doNotTrack) {
dest: /etc/dconf/db/msb.d/00_msb_settings dest: /etc/dconf/db/msb.d/00_msb_settings
owner: root owner: root
group: root group: root
</code></pre> </code></pre><p>執行時的 LOG</p>
<p>執行時的 LOG</p>
<pre><code>TASK [userdesktop-1804 : generate 00_msb_settings] ******************************************************************************* <pre><code>TASK [userdesktop-1804 : generate 00_msb_settings] *******************************************************************************
Wednesday 18 December 2019 14:36:26 +0800 (0:00:00.328) 0:02:20.653 **** Wednesday 18 December 2019 14:36:26 +0800 (0:00:00.328) 0:02:20.653 ****
fatal: [hqpc108.abc.com.tw]: FAILED! =&gt; { fatal: [hqpc108.abc.com.tw]: FAILED! =&gt; {
@ -356,10 +345,7 @@ MSG:
Destination directory /etc/dconf/db/msb.d does not exist Destination directory /etc/dconf/db/msb.d does not exist
</code></pre> </code></pre><p>怪了,登錄遠端電腦看一下</p>
<p>怪了,登錄遠端電腦看一下</p>
<pre><code>administrator@ubuntu:/etc/dconf/db$ ls -alrt <pre><code>administrator@ubuntu:/etc/dconf/db$ ls -alrt
total 28 total 28
drwxr-xr-x 2 root root 4096 Dec 18 12:22 ibus.d drwxr-xr-x 2 root root 4096 Dec 18 12:22 ibus.d
@ -369,14 +355,9 @@ drwxr-xr-x 2 root root 4096 Dec 18 14:27 gdm.d
drwxr-xr-x 2 root root 4096 Dec 18 14:36 'msb.d ' drwxr-xr-x 2 root root 4096 Dec 18 14:36 'msb.d '
drwxr-xr-x 5 root root 4096 Dec 18 14:36 . drwxr-xr-x 5 root root 4096 Dec 18 14:36 .
drwxr-xr-x 4 root root 4096 Dec 18 14:37 .. drwxr-xr-x 4 root root 4096 Dec 18 14:37 ..
</code></pre> </code></pre><p>發現了怪異的狀況,那個 msb.d 被單引號包起來了,代表包含了一些特殊字元</p>
<p>發現了怪異的狀況,那個 msb.d 被單引號包起來了,代表包含了一些特殊字元</p>
<p>複製貼上後,才注意到,原來最後多了一個空白。</p> <p>複製貼上後,才注意到,原來最後多了一個空白。</p>
<p>回去看 playbook 內容</p> <p>回去看 playbook 內容</p>
<pre><code>- name: make dconf/profile folder <pre><code>- name: make dconf/profile folder
file: file:
path: &quot;{{ item }} &quot; path: &quot;{{ item }} &quot;
@ -387,20 +368,12 @@ drwxr-xr-x 4 root root 4096 Dec 18 14:37 ..
with_items: with_items:
- /etc/dconf/profile - /etc/dconf/profile
- /etc/dconf/db/msb.d - /etc/dconf/db/msb.d
</code></pre> </code></pre><p>問題就出在 path 這邊,在 }} 和 &quot; 之間,多了一個空格</p>
<p>問題就出在 path 這邊,在 }} 和 &ldquo; 之間,多了一個空格</p>
<p>然後ansible就很忠實的重現了這個語法</p> <p>然後ansible就很忠實的重現了這個語法</p>
<p>所以建立了 &ldquo;/etc/dconf/profile &quot; 以及&rdquo; /etc/dconf/db/msb.d &quot;</p>
<p>所以建立了 &ldquo;/etc/dconf/profile &rdquo; 以及&rdquo; /etc/dconf/db/msb.d &ldquo;</p>
<p>於是就造成了後面的錯誤。</p> <p>於是就造成了後面的錯誤。</p>
<p>把 playbook 裡面的 語法修正就好了。</p> <p>把 playbook 裡面的 語法修正就好了。</p>
<p>第一次碰到這狀況,也不是太難解決,不過還是簡單做個筆記好了</p> <p>第一次碰到這狀況,也不是太難解決,不過還是簡單做個筆記好了</p>
<p>不然都沒啥文章了,哈哈!</p> <p>不然都沒啥文章了,哈哈!</p>
</article> </article>
</div> </div>
@ -676,7 +649,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -688,7 +661,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "在ubuntu 18.04中,透過 dconf 設定系統層級的「我的最愛」\/ Add System Wide Favorite Apps in dock with Dconf in ubuntu 18.04", "name" : "在ubuntu 18.04中,透過 dconf 設定系統層級的「我的最愛」\/ Add System Wide Favorite Apps in dock with Dconf in ubuntu 18.04",
"headline" : "在ubuntu 18.04中,透過 dconf 設定系統層級的「我的最愛」\/ Add System Wide Favorite Apps in dock with Dconf in ubuntu 18.04", "headline" : "在ubuntu 18.04中,透過 dconf 設定系統層級的「我的最愛」\/ Add System Wide Favorite Apps in dock with Dconf in ubuntu 18.04",
"description" : "\x3cp\x3e這幾天在ansible 寫了一份新的playbook給developer 用\x3c\/p\x3e\n\n\x3cp\x3e然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon\x3c\/p\x3e\n\n\x3cp\x3e我才發現原來之前的寫法不能用在 ubuntu 18.04 上\x3c\/p\x3e\n\n\x3cp\x3e只好又弄了一份出來\x3c\/p\x3e", "description" : "\x3cp\x3e這幾天在ansible 寫了一份新的playbook給developer 用\x3c\/p\x3e\n\x3cp\x3e然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon\x3c\/p\x3e\n\x3cp\x3e我才發現原來之前的寫法不能用在 ubuntu 18.04 上\x3c\/p\x3e\n\x3cp\x3e只好又弄了一份出來\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,64 +305,41 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這幾天在ansible 寫了一份新的playbook給developer 用</p> <p>這幾天在ansible 寫了一份新的playbook給developer 用</p>
<p>然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon</p> <p>然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon</p>
<p>我才發現原來之前的寫法不能用在 ubuntu 18.04 上</p> <p>我才發現原來之前的寫法不能用在 ubuntu 18.04 上</p>
<p>只好又弄了一份出來</p> <p>只好又弄了一份出來</p>
<p>有些task 我是直接從原本給14.04 client 用的直接套用過來</p> <p>有些task 我是直接從原本給14.04 client 用的直接套用過來</p>
<p>也沒有去特別注意</p> <p>也沒有去特別注意</p>
<p>今天重新檢查才發現,舊的寫法是給 14.04 的unity用</p> <p>今天重新檢查才發現,舊的寫法是給 14.04 的unity用</p>
<p>但是 18.04 已經不用 unity 了所以在設定dock這個task 雖然有成功,但是沒做用 <p>但是 18.04 已經不用 unity 了所以在設定dock這個task 雖然有成功,但是沒做用
(手術成功,但病人掛了?)</p> (手術成功,但病人掛了?)</p>
<p>原來的寫法是在 /usr/share/glib-2.0/schemas/ 底下新增一個設定檔</p> <p>原來的寫法是在 /usr/share/glib-2.0/schemas/ 底下新增一個設定檔</p>
<p>然後用dconf 去產生設定</p> <p>然後用dconf 去產生設定</p>
<p>原本的內容長這樣</p> <p>原本的內容長這樣</p>
<pre><code>[com.canonical.Unity.Launcher] <pre><code>[com.canonical.Unity.Launcher]
favorites=['application://ubiquity.desktop', 'application://launchers.desktop', 'application://nautilus.desktop', 'application favorites=['application://ubiquity.desktop', 'application://launchers.desktop', 'application://nautilus.desktop', 'application
://gnome-terminal.desktop', 'application://google-chrome.desktop', 'application://goldendict.desktop', 'application://stardict ://gnome-terminal.desktop', 'application://google-chrome.desktop', 'application://goldendict.desktop', 'application://stardict
.desktop', 'application://libreoffice-writer.desktop', 'application://libreoffice-calc.desktop', 'unity://running-apps', 'unit .desktop', 'application://libreoffice-writer.desktop', 'application://libreoffice-calc.desktop', 'unity://running-apps', 'unit
y://expo-icon', 'unity://devices'] y://expo-icon', 'unity://devices']
</code></pre> </code></pre><p>就如同前面所說因爲18.04捨棄了 unity所以這個config 等於沒有用了</p>
<p>就如同前面所說因爲18.04捨棄了 unity所以這個config 等於沒有用了</p>
<p>新的步驟比較麻煩一點點</p> <p>新的步驟比較麻煩一點點</p>
<p>大概是</p> <p>大概是</p>
<ol> <ol>
<li>mkdir -p /etc/dconf/profile</li> <li>mkdir -p /etc/dconf/profile</li>
<li>vim /etc/dconf/profile/user</li>
<li><p>vim /etc/dconf/profile/user</p> </ol>
<pre><code>#This line allows the user to change the default favorites later. <pre><code>#This line allows the user to change the default favorites later.
user-db:user user-db:user
#This line defines a system database named msb #This line defines a system database named msb
system-db:msb system-db:msb
</code></pre></li> </code></pre><ol start="3">
<li>mkdir -p /etc/dconf/db/msb.d</li>
<li><p>mkdir -p /etc/dconf/db/msb.d</p></li> <li>vim /etc/dconf/db/msb.d/00_msb_settings</li>
</ol>
<li><p>vim /etc/dconf/db/msb.d/00_msb_settings</p>
<pre><code># Define default favorite apps <pre><code># Define default favorite apps
[org/gnome/shell] [org/gnome/shell]
favorite-apps = ['chromium-browser.desktop', 'firefox.desktop', 'gnome-terminal.desktop', 'nautilus.desktop'] favorite-apps = ['chromium-browser.desktop', 'firefox.desktop', 'gnome-terminal.desktop', 'nautilus.desktop']
</code></pre></li> </code></pre><p>把這些步驟改成 ansible 語法再派送到client ,重開機之後就可以正確顯示設定好的「我的最愛」了</p>
</ol>
<p>把這些步驟改成 ansible 語法再派送到client ,重開機之後就可以正確顯示設定好的「我的最愛」了</p>
<p>ref: <a href="https://askubuntu.com/a/1183012/789089">https://askubuntu.com/a/1183012/789089</a></p> <p>ref: <a href="https://askubuntu.com/a/1183012/789089">https://askubuntu.com/a/1183012/789089</a></p>
</article> </article>
</div> </div>
@ -644,7 +617,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -656,7 +629,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 為了保存log 用script 指令執行ansible \/ Another Way to Keep Ansible Log using script command", "name" : "[筆記] 為了保存log 用script 指令執行ansible \/ Another Way to Keep Ansible Log using script command",
"headline" : "[筆記] 為了保存log 用script 指令執行ansible \/ Another Way to Keep Ansible Log using script command", "headline" : "[筆記] 為了保存log 用script 指令執行ansible \/ Another Way to Keep Ansible Log using script command",
"description" : "\x3cp\x3e之前為了能夠在執行完 ansible playbook 後能有個log 可以看\x3c\/p\x3e\n\n\x3cp\x3e所以在每次執行的時候都要加入 tee 的指令\x3c\/p\x3e\n\n\x3cp\x3e像是\x3c\/p\x3e\n\n\x3cpre\x3e\x3ccode\x3eANSIBLE_CONFIG=\/home\/D\/ansiblecontrol\/ansible.cfg \/usr\/local\/bin\/ansible-playbook \/home\/D\/ansiblecontrol\/playbook.user_client.yml --vault-password-file=\/home\/D\/ansiblecontrol\/vault.passwd -i \/home\/D\/ansiblecontrol\/inventory\/production -f1 --limit tyuserclients |tee \/tmp\/tyuserclients.log\n\x3c\/code\x3e\x3c\/pre\x3e\n\n\x3cp\x3e一直都是放在crontab 裡面執行,也就沒有去管他\x3c\/p\x3e\n\n\x3cp\x3e反正也沒有人關心結果怎樣 (攤手\x3c\/p\x3e", "description" : "\x3cp\x3e之前為了能夠在執行完 ansible playbook 後能有個log 可以看\x3c\/p\x3e\n\x3cp\x3e所以在每次執行的時候都要加入 tee 的指令\x3c\/p\x3e\n\x3cp\x3e像是\x3c\/p\x3e\n\x3cpre\x3e\x3ccode\x3eANSIBLE_CONFIG=\/home\/D\/ansiblecontrol\/ansible.cfg \/usr\/local\/bin\/ansible-playbook \/home\/D\/ansiblecontrol\/playbook.user_client.yml --vault-password-file=\/home\/D\/ansiblecontrol\/vault.passwd -i \/home\/D\/ansiblecontrol\/inventory\/production -f1 --limit tyuserclients |tee \/tmp\/tyuserclients.log\n\x3c\/code\x3e\x3c\/pre\x3e\x3cp\x3e一直都是放在crontab 裡面執行,也就沒有去管他\x3c\/p\x3e\n\x3cp\x3e反正也沒有人關心結果怎樣 (攤手\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,28 +305,16 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p> <p>之前為了能夠在執行完 ansible playbook 後能有個log 可以看</p>
<p>所以在每次執行的時候,都要加入 tee 的指令</p> <p>所以在每次執行的時候,都要加入 tee 的指令</p>
<p>像是</p> <p>像是</p>
<pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log <pre><code>ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
</code></pre> </code></pre><p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>一直都是放在crontab 裡面執行,也就沒有去管他</p>
<p>反正也沒有人關心結果怎樣 (攤手</p> <p>反正也沒有人關心結果怎樣 (攤手</p>
<p>後來發現有個指令叫 script 可以完整紀錄指令執行期間的console 畫面變化(包含了ansi color!)</p> <p>後來發現有個指令叫 script 可以完整紀錄指令執行期間的console 畫面變化(包含了ansi color!)</p>
<p>剛剛測試了一下,發現的確是可以用,不過也沒感覺有特別好用的地方,就只是做個紀錄吧,說不定以後其他地方可以用得到</p> <p>剛剛測試了一下,發現的確是可以用,不過也沒感覺有特別好用的地方,就只是做個紀錄吧,說不定以後其他地方可以用得到</p>
<pre><code>sciprt -c 'make EXTRA_ARGS=&quot;-i inventory/production --limit hqpc074&quot; user_client' -f hqpc074.out' <pre><code>sciprt -c 'make EXTRA_ARGS=&quot;-i inventory/production --limit hqpc074&quot; user_client' -f hqpc074.out'
</code></pre> </code></pre><p>結果長這樣
<img src="https://i.imgur.com/F9KFAWV.png" alt=""></p>
<p>結果長這樣
<img src="https://i.imgur.com/F9KFAWV.png" alt="" /></p>
<p>就真的跟console 的畫面一樣</p> <p>就真的跟console 的畫面一樣</p>
</article> </article>
</div> </div>
@ -606,7 +590,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -618,7 +602,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記]在ansible中取得loop register後的值\/ Ansible Get Value From Loop Register", "name" : "[筆記]在ansible中取得loop register後的值\/ Ansible Get Value From Loop Register",
"headline" : "[筆記]在ansible中取得loop register後的值\/ Ansible Get Value From Loop Register", "headline" : "[筆記]在ansible中取得loop register後的值\/ Ansible Get Value From Loop Register",
"description" : "\x3cp\x3e今天在寫一支客製化 firefox 的playbook\x3c\/p\x3e\n\n\x3cp\x3e因為firefox 會給每個user 建立一個由亂數字串組成的default profile\x3c\/p\x3e\n\n\x3cp\x3e所以每個user的 default profile 都不同\x3c\/p\x3e\n\n\x3cp\x3e也因此在用register處理的時候碰到了一些問題\x3c\/p\x3e", "description" : "\x3cp\x3e今天在寫一支客製化 firefox 的playbook\x3c\/p\x3e\n\x3cp\x3e因為firefox 會給每個user 建立一個由亂數字串組成的default profile\x3c\/p\x3e\n\x3cp\x3e所以每個user的 default profile 都不同\x3c\/p\x3e\n\x3cp\x3e也因此在用register處理的時候碰到了一些問題\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,39 +305,24 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>今天在寫一支客製化 firefox 的playbook</p> <p>今天在寫一支客製化 firefox 的playbook</p>
<p>因為firefox 會給每個user 建立一個由亂數字串組成的default profile</p> <p>因為firefox 會給每個user 建立一個由亂數字串組成的default profile</p>
<p>所以每個user的 default profile 都不同</p> <p>所以每個user的 default profile 都不同</p>
<p>也因此在用register處理的時候碰到了一些問題</p> <p>也因此在用register處理的時候碰到了一些問題</p>
<h3 id="task-內容">TASK 內容</h3> <h3 id="task-內容">TASK 內容</h3>
<p>其實task 內容沒有很複雜簡單來說就是先檢查user的 firefox profile 目錄</p> <p>其實task 內容沒有很複雜簡單來說就是先檢查user的 firefox profile 目錄</p>
<p>如果存在就pass如果不存在就幫user建立</p> <p>如果存在就pass如果不存在就幫user建立</p>
<pre><code>- name: check if user profile exists <pre><code>- name: check if user profile exists
become_user: &quot;{{ item.name }}&quot; become_user: &quot;{{ item.name }}&quot;
stat: stat:
path: &quot;{{ firefox_home }}&quot; path: &quot;{{ firefox_home }}&quot;
register: profile_exists register: profile_exists
with_items: &quot;{{ users }}&quot; with_items: &quot;{{ users }}&quot;
</code></pre> </code></pre><p>但是在接下來的task在執行的時候碰到了問題</p>
<p>但是在接下來的task在執行的時候碰到了問題</p>
<p>ansible 提示說profile_exists 沒有 stat 屬性</p> <p>ansible 提示說profile_exists 沒有 stat 屬性</p>
<p>用過 stat module 的,應該都知道結果會是 var_name.stat.xxxx 這樣的用法</p> <p>用過 stat module 的,應該都知道結果會是 var_name.stat.xxxx 這樣的用法</p>
<p>所以可以肯定的是 stat 這個屬性一定在</p> <p>所以可以肯定的是 stat 這個屬性一定在</p>
<p>可是也一定有什麼問題,造成取不到值</p> <p>可是也一定有什麼問題,造成取不到值</p>
<p>當然就是先debug 來看看(有些不重要的屬性,我就先拿掉了)</p> <p>當然就是先debug 來看看(有些不重要的屬性,我就先拿掉了)</p>
<pre><code>ok: [hqdc075] =&gt; { <pre><code>ok: [hqdc075] =&gt; {
&quot;profile_exists&quot;: { &quot;profile_exists&quot;: {
&quot;changed&quot;: false, &quot;changed&quot;: false,
@ -402,40 +383,24 @@ if (!doNotTrack) {
&quot;exists&quot;: false, &quot;exists&quot;: false,
} }
}, },
</code></pre> </code></pre><p>一開始是先注意到了為什麼裡面還有 item ?</p>
<p>一開始是先注意到了為什麼裡面還有 item ?</p>
<p>再往上看,就發現多了一個 results 把原本的list 清單給包起來了</p> <p>再往上看,就發現多了一個 results 把原本的list 清單給包起來了</p>
<p>所以原本用 profile_exists.stat.exists 可以取得目錄是否存在(true/false)</p> <p>所以原本用 profile_exists.stat.exists 可以取得目錄是否存在(true/false)</p>
<p>但是現在因為多了一層 results ,所以變成取不到值</p> <p>但是現在因為多了一層 results ,所以變成取不到值</p>
<p>沒關係,既然知道了有多了一層 results ,那就知道要怎麼做了</p> <p>沒關係,既然知道了有多了一層 results ,那就知道要怎麼做了</p>
<h3 id="修正後續task">修正後續task</h3> <h3 id="修正後續task">修正後續task</h3>
<p>後面的task 稍微改一下,在指定 with_items 的時候,直接指定 profile_exists.results</p> <p>後面的task 稍微改一下,在指定 with_items 的時候,直接指定 profile_exists.results</p>
<p>接下來的用法就比較簡單了跟原本接stat 變數的語法差不多</p> <p>接下來的用法就比較簡單了跟原本接stat 變數的語法差不多</p>
<pre><code>- name: run firefox to create default profile <pre><code>- name: run firefox to create default profile
become_user: &quot;{{ item.item.name }}&quot; become_user: &quot;{{ item.item.name }}&quot;
shell: &quot;firefox --headless &amp;&quot; shell: &quot;firefox --headless &amp;&quot;
ignore_errors: True ignore_errors: True
when: item.stat.exists == false when: item.stat.exists == false
with_items: &quot;{{ profile_exists.results }}&quot; with_items: &quot;{{ profile_exists.results }}&quot;
</code></pre> </code></pre><p>透過這次的playbook 又知道了怎麼承接 loop register 跑出來的值,又學了一課</p>
<p>透過這次的playbook 又知道了怎麼承接 loop register 跑出來的值,又學了一課</p>
<p>本來一開始的想法是register dynamic variable name</p> <p>本來一開始的想法是register dynamic variable name</p>
<p>像是 a_exist,b_exist,c_exist 這樣</p> <p>像是 a_exist,b_exist,c_exist 這樣</p>
<p>不過ansible 不這樣處理,會自動的把所有結果都包在一個 results list 裡面</p> <p>不過ansible 不這樣處理,會自動的把所有結果都包在一個 results list 裡面</p>
<p>也算是還滿好用的啦</p> <p>也算是還滿好用的啦</p>
</article> </article>
</div> </div>
@ -711,7 +676,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -723,7 +688,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[ansible] 用 ip 位置判斷是否要執行task \/ansible run task depends on ipaddr", "name" : "[ansible] 用 ip 位置判斷是否要執行task \/ansible run task depends on ipaddr",
"headline" : "[ansible] 用 ip 位置判斷是否要執行task \/ansible run task depends on ipaddr", "headline" : "[ansible] 用 ip 位置判斷是否要執行task \/ansible run task depends on ipaddr",
"description" : "\x3cp\x3e因為工作上的需要要修改client端的 \/etc\/environment 檔案\x3c\/p\x3e\n\n\x3cp\x3e在有權限使用proxy 服務的user的環境中加入proxy 的設定\x3c\/p\x3e\n\n\x3cp\x3e原本的清單中有host\/user\/ip 這幾個值可以拿來判斷\x3c\/p\x3e\n\n\x3cp\x3eproxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 \/etc\/environment\x3c\/p\x3e", "description" : "\x3cp\x3e因為工作上的需要要修改client端的 \/etc\/environment 檔案\x3c\/p\x3e\n\x3cp\x3e在有權限使用proxy 服務的user的環境中加入proxy 的設定\x3c\/p\x3e\n\x3cp\x3e原本的清單中有host\/user\/ip 這幾個值可以拿來判斷\x3c\/p\x3e\n\x3cp\x3eproxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 \/etc\/environment\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,23 +305,14 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>因為工作上的需要要修改client端的 /etc/environment 檔案</p> <p>因為工作上的需要要修改client端的 /etc/environment 檔案</p>
<p>在有權限使用proxy 服務的user的環境中加入proxy 的設定</p> <p>在有權限使用proxy 服務的user的環境中加入proxy 的設定</p>
<p>原本的清單中有host/user/ip 這幾個值可以拿來判斷</p> <p>原本的清單中有host/user/ip 這幾個值可以拿來判斷</p>
<p>proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment</p> <p>proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment</p>
<p>原本的想法是這樣</p> <p>原本的想法是這樣</p>
<p>在playbook中有兩個 task</p> <p>在playbook中有兩個 task</p>
<p>當user ip (ansible_default_ipv4.address) 在清單內 ( {{ iuser_list }} )時</p> <p>當user ip (ansible_default_ipv4.address) 在清單內 ( {{ iuser_list }} )時</p>
<p>會去加入一些文字到 /etc/environment</p> <p>會去加入一些文字到 /etc/environment</p>
<p>反之,則取消這一段文字</p> <p>反之,則取消這一段文字</p>
<pre><code>- name: get internet user list <pre><code>- name: get internet user list
set_fact: set_fact:
iuser_list: &quot;{{ ch['client_hosts']['abc.com'] |selectattr('iuser', 'defined')| list }}&quot; iuser_list: &quot;{{ ch['client_hosts']['abc.com'] |selectattr('iuser', 'defined')| list }}&quot;
@ -350,36 +337,20 @@ if (!doNotTrack) {
block: &quot;&quot; block: &quot;&quot;
when: ansible_default_ipv4.address not in &quot;item.ipv4&quot; when: ansible_default_ipv4.address not in &quot;item.ipv4&quot;
with_items: &quot;{{ iuser_list }}&quot; with_items: &quot;{{ iuser_list }}&quot;
</code></pre> </code></pre><p>先做出一個可以上internet 的 user list</p>
<p>先做出一個可以上internet 的 user list</p>
<p>內容大概長這樣</p> <p>內容大概長這樣</p>
<pre><code>hwaddress: f4:4d:30:45:ee:6f', host: pc114', ipv4: 192.168.1.114', user: [liwa'], iuser: True <pre><code>hwaddress: f4:4d:30:45:ee:6f', host: pc114', ipv4: 192.168.1.114', user: [liwa'], iuser: True
hwaddress: f4:4d:30:45:ef:aa', host: pc120', ipv4: 192.168.1.120', user: [wany'], iuser: True hwaddress: f4:4d:30:45:ef:aa', host: pc120', ipv4: 192.168.1.120', user: [wany'], iuser: True
</code></pre> </code></pre><p>然後判斷當client ip 在這個清單中時,就去修改,反之就刪除修改的部份</p>
<p>然後判斷當client ip 在這個清單中時,就去修改,反之就刪除修改的部份</p>
<p>有權限上internet的電腦在一開始跑就卡關了這兩個task 都會被執行到</p> <p>有權限上internet的電腦在一開始跑就卡關了這兩個task 都會被執行到</p>
<p>不應該是這樣才對呀光看when 條件,會覺得這兩個條件應該是互斥的,怎麼會同時成立呢?</p> <p>不應該是這樣才對呀光看when 條件,會覺得這兩個條件應該是互斥的,怎麼會同時成立呢?</p>
<p>後來想想</p> <p>後來想想</p>
<p>在第一個task中因為是用 item.ipv4 == ansible_default_ipv4.address 去做比對所以很正常的一直比對到有符合的資料然後開始進行task</p> <p>在第一個task中因為是用 item.ipv4 == ansible_default_ipv4.address 去做比對所以很正常的一直比對到有符合的資料然後開始進行task</p>
<p>但是在第二個task中用的是ansible_default_ipv4.address not in item.ipv4 於是第一筆資料就符合條件於是也開始執行task</p> <p>但是在第二個task中用的是ansible_default_ipv4.address not in item.ipv4 於是第一筆資料就符合條件於是也開始執行task</p>
<p>在邏輯上,這樣的判斷沒有錯,錯的是我那打結的頭腦&hellip;.</p> <p>在邏輯上,這樣的判斷沒有錯,錯的是我那打結的頭腦&hellip;.</p>
<p>那怎麼解決呢?</p> <p>那怎麼解決呢?</p>
<p>把原本清單中的 ipv4 另外整理成一個list 然後再去比對client ip 有沒有在這個list 中</p> <p>把原本清單中的 ipv4 另外整理成一個list 然後再去比對client ip 有沒有在這個list 中</p>
<p>就會變成這樣</p> <p>就會變成這樣</p>
<pre><code>- name: get internet user ip list <pre><code>- name: get internet user ip list
set_fact: set_fact:
iuser_ip_list: &quot;{{ ch['client_hosts']['kw.com'] |selectattr('iuser', 'defined')| map(attribute='ipv4')|list }}&quot; iuser_ip_list: &quot;{{ ch['client_hosts']['kw.com'] |selectattr('iuser', 'defined')| map(attribute='ipv4')|list }}&quot;
@ -402,18 +373,11 @@ hwaddress: f4:4d:30:45:ef:aa', host: pc120', ipv4: 192.168.1.120', user: [wany']
marker: &quot;#{mark} ANSIBLE MANAGED BLOCK#&quot; marker: &quot;#{mark} ANSIBLE MANAGED BLOCK#&quot;
block: &quot;&quot; block: &quot;&quot;
when: ansible_default_ipv4.address not in iuser_ip_list when: ansible_default_ipv4.address not in iuser_ip_list
</code></pre> </code></pre><p>因為只比對 ip 所以結果就是一翻兩瞪眼有在裡面就跑第一個task ,沒有就跑第二個</p>
<hr>
<p>因為只比對 ip 所以結果就是一翻兩瞪眼有在裡面就跑第一個task ,沒有就跑第二個</p>
<hr />
<p>不過呢, proxy server 那邊的playbook 也弄好了, client 這邊也知道怎麼跑了</p> <p>不過呢, proxy server 那邊的playbook 也弄好了, client 這邊也知道怎麼跑了</p>
<p>但是讓user可以透過proxy server 存取internet 的簽呈還是一直沒有下來 &hellip;.</p> <p>但是讓user可以透過proxy server 存取internet 的簽呈還是一直沒有下來 &hellip;.</p>
<p>都什麼年代了還有半數以上的client 無法存取internet</p> <p>都什麼年代了還有半數以上的client 無法存取internet</p>
<p>我實在是想不透啊..</p> <p>我實在是想不透啊..</p>
</article> </article>
</div> </div>
@ -689,7 +653,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -701,7 +665,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 還是 Ansible Selectattr ", "name" : "[筆記] 還是 Ansible Selectattr ",
"headline" : "[筆記] 還是 Ansible Selectattr ", "headline" : "[筆記] 還是 Ansible Selectattr ",
"description" : "\x3cp\x3e在上一篇 \x3ca href=\x22https:\/\/h.cowbay.org\/post\/ansible-selectattr\/\x22\x3eAnsible how to use \x26lsquo;list\x26rsquo; in yaml file \x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e有提到怎麼用 with_items \/ set_fact 來取得在yaml 檔案中的清單\x3c\/p\x3e\n\n\x3cp\x3e不過就是有點醜\x3c\/p\x3e", "description" : "\x3cp\x3e在上一篇 \x3ca href=\x22https:\/\/h.cowbay.org\/post\/ansible-selectattr\/\x22\x3eAnsible how to use \x26lsquo;list\x26rsquo; in yaml file \x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e有提到怎麼用 with_items \/ set_fact 來取得在yaml 檔案中的清單\x3c\/p\x3e\n\x3cp\x3e不過就是有點醜\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,31 +305,21 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>在上一篇 <a href="https://h.cowbay.org/post/ansible-selectattr/">Ansible how to use &lsquo;list&rsquo; in yaml file </a></p> <p>在上一篇 <a href="https://h.cowbay.org/post/ansible-selectattr/">Ansible how to use &lsquo;list&rsquo; in yaml file </a></p>
<p>有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單</p> <p>有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單</p>
<p>不過就是有點醜</p> <p>不過就是有點醜</p>
<p>這兩天又修改了一下,不需要用 when 來指定條件,改成用 filter 來篩選資料</p> <p>這兩天又修改了一下,不需要用 when 來指定條件,改成用 filter 來篩選資料</p>
<p>將list整理成我們需要的「部份」資料就好而不是所有資料都塞進來</p> <p>將list整理成我們需要的「部份」資料就好而不是所有資料都塞進來</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">- <span style="color:#66d9ef">name</span>: set dc_users
<pre><code class="language-yaml">- name: set dc_users <span style="color:#66d9ef">tags</span>:
tags:
- dcusers - dcusers
- depot_folder - depot_folder
- env - env
set_fact: <span style="color:#66d9ef">set_fact</span>:
dc_users: &quot;{{ item.users }}&quot; <span style="color:#66d9ef">dc_users</span>: <span style="color:#e6db74">&#34;{{ item.users }}&#34;</span>
with_items: &quot;{{ teams|selectattr('name','equalto','dc')|map(attribute='users')|list }}&quot; <span style="color:#66d9ef">with_items</span>: <span style="color:#e6db74">&#34;{{ teams|selectattr(&#39;name&#39;,&#39;equalto&#39;,&#39;dc&#39;)|map(attribute=&#39;users&#39;)|list }}&#34;</span>
</code></pre> </code></pre></div><p>有沒有比較「優雅」(自己說&hellip;</p>
<p>有沒有比較「優雅」(自己說&hellip;</p>
<p>先把 teams 這個 var 抓進來,然後用 selectattr 這個filter 選出 name == dc 的資料</p> <p>先把 teams 這個 var 抓進來,然後用 selectattr 這個filter 選出 name == dc 的資料</p>
<p>再將篩選後的資料,用 map 去抓出 users 這個屬性,最後轉成 list</p> <p>再將篩選後的資料,用 map 去抓出 users 這個屬性,最後轉成 list</p>
<p>這樣子就可以直接得到 users 了</p> <p>這樣子就可以直接得到 users 了</p>
</article> </article>
</div> </div>
@ -609,7 +595,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -621,7 +607,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[ansible] 引用事先定義好的yaml檔裡面的變數 - Ansible Selectattr From List in Dictionary file", "name" : "[ansible] 引用事先定義好的yaml檔裡面的變數 - Ansible Selectattr From List in Dictionary file",
"headline" : "[ansible] 引用事先定義好的yaml檔裡面的變數 - Ansible Selectattr From List in Dictionary file", "headline" : "[ansible] 引用事先定義好的yaml檔裡面的變數 - Ansible Selectattr From List in Dictionary file",
"description" : "\x3cp\x3e在ansible中關於如何引用自定義的變數一直讓我很頭疼\x3c\/p\x3e\n\n\x3cp\x3e尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數\x3c\/p\x3e\n\n\x3cp\x3e這次還是用selectattr 來處理,希望下次能夠記得\x26hellip;\x3c\/p\x3e", "description" : "\x3cp\x3e在ansible中關於如何引用自定義的變數一直讓我很頭疼\x3c\/p\x3e\n\x3cp\x3e尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數\x3c\/p\x3e\n\x3cp\x3e這次還是用selectattr 來處理,希望下次能夠記得\x26hellip;\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,13 +305,9 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>在ansible中關於如何引用自定義的變數一直讓我很頭疼</p> <p>在ansible中關於如何引用自定義的變數一直讓我很頭疼</p>
<p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p> <p>尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數</p>
<p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p> <p>這次還是用selectattr 來處理,希望下次能夠記得&hellip;</p>
<p>首先是導入的yaml檔案內容長這樣</p> <p>首先是導入的yaml檔案內容長這樣</p>
<pre><code>client_hosts: <pre><code>client_hosts:
abc.com: abc.com:
- host: hqdc021 - host: hqdc021
@ -357,27 +349,17 @@ if (!doNotTrack) {
</code></pre> </code></pre><p>在playbook中首先先導入這個檔案</p>
<p>在playbook中首先先導入這個檔案</p>
<pre><code>- name: load client_host <pre><code>- name: load client_host
include_vars: include_vars:
file: client_hosts.yml file: client_hosts.yml
name: ch name: ch
</code></pre> </code></pre><p>然後用這個剛剛導入的檔案,去做出想要的清單</p>
<p>然後用這個剛剛導入的檔案,去做出想要的清單</p>
<p>像底下這個就是指定了client_hosts的 abc.com 這個域名底下iuser有被定義的資料再轉成list</p> <p>像底下這個就是指定了client_hosts的 abc.com 這個域名底下iuser有被定義的資料再轉成list</p>
<pre><code>- name: get internet user list <pre><code>- name: get internet user list
set_fact: set_fact:
iuser_list: &quot;{{ ch['client_host']['abc.com']|selectattr('iuser','defined')|list }}&quot; iuser_list: &quot;{{ ch['client_host']['abc.com']|selectattr('iuser','defined')|list }}&quot;
</code></pre> </code></pre><p>然後就可以用來做condition了</p>
<p>然後就可以用來做condition了</p>
<pre><code>- name: copy environment block to /etc/environment <pre><code>- name: copy environment block to /etc/environment
copy: copy:
content: | content: |
@ -664,7 +646,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -676,7 +658,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] Ansible how to use \x27list\x27 in yaml file ", "name" : "[筆記] Ansible how to use \x27list\x27 in yaml file ",
"headline" : "[筆記] Ansible how to use \x27list\x27 in yaml file ", "headline" : "[筆記] Ansible how to use \x27list\x27 in yaml file ",
"description" : "\x3cp\x3e這幾天在玩ansible 時,碰到一個問題\x3c\/p\x3e\n\n\x3cp\x3e假如我有個yaml檔作為資料來源檔名是 abc.yml\x3c\/p\x3e\n\n\x3cp\x3e大概長這樣\x3c\/p\x3e\n\n\x3cpre\x3e\x3ccode\x3e \x26quot;teams\x26quot;: [\n {\n \x26quot;chinese_name\x26quot;: \x26quot;TEAM1\x26quot;,\n \x26quot;description\x26quot;: \x26quot;TEAM1\x26quot;,\n \x26quot;gid\x26quot;: 10125,\n \x26quot;location\x26quot;: [\n \x26quot;hq\x26quot;\n ],\n \x26quot;name\x26quot;: \x26quot;aa\x26quot;,\n \x26quot;users\x26quot;: [\n \x26quot;chen\x26quot;,\n \x26quot;chou\x26quot;,\n \x26quot;huani\x26quot;,\n \x26quot;yey\x26quot;,\n \x26quot;wa\x26quot;\n ]\n },\n {\n \x26quot;chinese_name\x26quot;: \x26quot;TEAM2\x26quot;,\n \x26quot;description\x26quot;: \x26quot;TEAM2\x26quot;,\n \x26quot;gid\x26quot;: 10126,\n \x26quot;location\x26quot;: [\n \x26quot;hq\x26quot;\n ],\n \x26quot;name\x26quot;: \x26quot;bb\x26quot;,\n \x26quot;users\x26quot;: [\n \x26quot;chhiao\x26quot;,\n \x26quot;chgc\x26quot;,\n \x26quot;chy\x26quot;,\n \x26quot;hsi\x26quot;,\n \x26quot;li\x26quot;,\n \x26quot;li\x26quot;,\n \x26quot;chgchi\x26quot;\n ]\n }\n\t\t]\n\t\t\n\x3c\/code\x3e\x3c\/pre\x3e", "description" : "\x3cp\x3e這幾天在玩ansible 時,碰到一個問題\x3c\/p\x3e\n\x3cp\x3e假如我有個yaml檔作為資料來源檔名是 abc.yml\x3c\/p\x3e\n\x3cp\x3e大概長這樣\x3c\/p\x3e\n\x3cpre\x3e\x3ccode\x3e \x26quot;teams\x26quot;: [\n {\n \x26quot;chinese_name\x26quot;: \x26quot;TEAM1\x26quot;,\n \x26quot;description\x26quot;: \x26quot;TEAM1\x26quot;,\n \x26quot;gid\x26quot;: 10125,\n \x26quot;location\x26quot;: [\n \x26quot;hq\x26quot;\n ],\n \x26quot;name\x26quot;: \x26quot;aa\x26quot;,\n \x26quot;users\x26quot;: [\n \x26quot;chen\x26quot;,\n \x26quot;chou\x26quot;,\n \x26quot;huani\x26quot;,\n \x26quot;yey\x26quot;,\n \x26quot;wa\x26quot;\n ]\n },\n {\n \x26quot;chinese_name\x26quot;: \x26quot;TEAM2\x26quot;,\n \x26quot;description\x26quot;: \x26quot;TEAM2\x26quot;,\n \x26quot;gid\x26quot;: 10126,\n \x26quot;location\x26quot;: [\n \x26quot;hq\x26quot;\n ],\n \x26quot;name\x26quot;: \x26quot;bb\x26quot;,\n \x26quot;users\x26quot;: [\n \x26quot;chhiao\x26quot;,\n \x26quot;chgc\x26quot;,\n \x26quot;chy\x26quot;,\n \x26quot;hsi\x26quot;,\n \x26quot;li\x26quot;,\n \x26quot;li\x26quot;,\n \x26quot;chgchi\x26quot;\n ]\n }\n\t\t]\n\t\t\n\x3c\/code\x3e\x3c\/pre\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,11 +305,8 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這幾天在玩ansible 時,碰到一個問題</p> <p>這幾天在玩ansible 時,碰到一個問題</p>
<p>假如我有個yaml檔作為資料來源檔名是 abc.yml</p> <p>假如我有個yaml檔作為資料來源檔名是 abc.yml</p>
<p>大概長這樣</p> <p>大概長這樣</p>
<pre><code> &quot;teams&quot;: [ <pre><code> &quot;teams&quot;: [
{ {
&quot;chinese_name&quot;: &quot;TEAM1&quot;, &quot;chinese_name&quot;: &quot;TEAM1&quot;,
@ -351,10 +344,7 @@ if (!doNotTrack) {
} }
] ]
</code></pre> </code></pre><p>稍微整理一下,比較容易看</p>
<p>稍微整理一下,比較容易看</p>
<pre><code> &quot;teams&quot;: [ <pre><code> &quot;teams&quot;: [
{ {
&quot;chinese_name&quot;: &quot;TEAM1&quot;, &quot;chinese_name&quot;: &quot;TEAM1&quot;,
@ -374,38 +364,24 @@ if (!doNotTrack) {
} }
] ]
</code></pre> </code></pre><p>在 ansible playbook 中,我用 include_vars 把這個檔案叫進來</p>
<p>在 ansible playbook 中,我用 include_vars 把這個檔案叫進來</p>
<pre><code>- name: load teams.yml <pre><code>- name: load teams.yml
tags: env tags: env
include_vars: include_vars:
file: files/kw/teams.yml file: files/kw/teams.yml
</code></pre> </code></pre><p>這時候在這個執行階段,就會有一個變數叫 teams 裡面有 chinese_name/description/gid 等等這些屬性</p>
<p>這時候在這個執行階段,就會有一個變數叫 teams 裡面有 chinese_name/description/gid 等等這些屬性</p>
<p>其中的 location/users 又是另外一個 list</p> <p>其中的 location/users 又是另外一個 list</p>
<p>那如果我想要用users這個清單中的id作為建立帳號的來源</p> <p>那如果我想要用users這個清單中的id作為建立帳號的來源</p>
<p>我就可以用底下這段,先把 users 裡面的內容,指給 dc_users 這個 localvar</p> <p>我就可以用底下這段,先把 users 裡面的內容,指給 dc_users 這個 localvar</p>
<p>然後加上 when 的條件,限定只有 name == aa 的 users 才會被指定給 dc_users</p> <p>然後加上 when 的條件,限定只有 name == aa 的 users 才會被指定給 dc_users</p>
<pre><code>- name: set aa_users <pre><code>- name: set aa_users
tags: env tags: env
set_fact: set_fact:
aa_users: &quot;{{ item.users }}&quot; aa_users: &quot;{{ item.users }}&quot;
when: item.name == 'aa' when: item.name == 'aa'
with_items: &quot;{{ teams }}&quot; with_items: &quot;{{ teams }}&quot;
</code></pre> </code></pre><p>這樣子執行下來是沒有問題的,不過就是醜了點 XD</p>
<p>這樣子執行下來是沒有問題的,不過就是醜了點 XD</p>
<p>之後要抓 user 帳號時,就可以直接用 aa_users 來跑迴圈</p> <p>之後要抓 user 帳號時,就可以直接用 aa_users 來跑迴圈</p>
<pre><code>- name: create folder for aa_users <pre><code>- name: create folder for aa_users
tags: env tags: env
file: file:
@ -414,35 +390,20 @@ if (!doNotTrack) {
group: &quot;{{ item }}&quot; group: &quot;{{ item }}&quot;
state: directory state: directory
with_items: &quot;{{ aa_users }}&quot; with_items: &quot;{{ aa_users }}&quot;
</code></pre> </code></pre><p>很簡單的概念,因為一開始在 teams 這個 var 裡面</p>
<p>很簡單的概念,因為一開始在 teams 這個 var 裡面</p>
<p>users 這個屬性是一個 list</p> <p>users 這個屬性是一個 list</p>
<p>p.s 講話一定要參雜用英文單字,這樣看起來比較屌&hellip;</p> <p>p.s 講話一定要參雜用英文單字,這樣看起來比較屌&hellip;</p>
<p>所以沒辦法直接在底下的create folder task 直接叫出來</p> <p>所以沒辦法直接在底下的create folder task 直接叫出來</p>
<p>如果直接叫 teams.users ,那會是一個清單</p> <p>如果直接叫 teams.users ,那會是一個清單</p>
<pre><code> [&quot;chen&quot;,&quot;chou&quot;,&quot;huani&quot;,&quot;yey&quot;,&quot;wa&quot;] <pre><code> [&quot;chen&quot;,&quot;chou&quot;,&quot;huani&quot;,&quot;yey&quot;,&quot;wa&quot;]
</code></pre> </code></pre><p>然後 ansible 也很厲害,就這個樣子,他還是會去忠實的執行建立目錄</p>
<p>然後 ansible 也很厲害,就這個樣子,他還是會去忠實的執行建立目錄</p>
<p>所以在 /tmp 底下就會多出一個</p> <p>所以在 /tmp 底下就會多出一個</p>
<blockquote> <blockquote>
<p>[&ldquo;chen&rdquo;,&ldquo;chou&rdquo;,&ldquo;huani&rdquo;,&ldquo;yey&rdquo;,&ldquo;wa&rdquo;]</p> <p>[&ldquo;chen&rdquo;,&ldquo;chou&rdquo;,&ldquo;huani&rdquo;,&ldquo;yey&rdquo;,&ldquo;wa&rdquo;]</p>
</blockquote> </blockquote>
<p>這個樣子的目錄 &hellip;.</p> <p>這個樣子的目錄 &hellip;.</p>
<p>所以我的處理方式就是先把這個清單丟給一個local變數 ( aa_users )</p> <p>所以我的處理方式就是先把這個清單丟給一個local變數 ( aa_users )</p>
<p>後面的task再用這個 {{ aa_users }} 來跑,這樣子就 OK 了</p> <p>後面的task再用這個 {{ aa_users }} 來跑,這樣子就 OK 了</p>
<p>雖說很簡單,但是卡了我一整天吶&hellip;</p> <p>雖說很簡單,但是卡了我一整天吶&hellip;</p>
</article> </article>
</div> </div>
@ -720,7 +681,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -732,7 +693,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] ansible 設定 ssh_args 開啟 ForwardX11 \/ config ansible ssh_args to enable forwardagent", "name" : "[筆記] ansible 設定 ssh_args 開啟 ForwardX11 \/ config ansible ssh_args to enable forwardagent",
"headline" : "[筆記] ansible 設定 ssh_args 開啟 ForwardX11 \/ config ansible ssh_args to enable forwardagent", "headline" : "[筆記] ansible 設定 ssh_args 開啟 ForwardX11 \/ config ansible ssh_args to enable forwardagent",
"description" : "\x3cp\x3e正確來說我不曉得到底怎麼「稱呼」這個 forwardx11 \/ forwardagent\x3c\/p\x3e\n\n\x3cp\x3e總之就是在寫一隻ansible playbook\x3c\/p\x3e\n\n\x3cp\x3e目的是用來安裝、設定 firefox\x3c\/p\x3e\n\n\x3cp\x3e包含安裝 firefox addon\x3c\/p\x3e\n\n\x3cp\x3e但是一開始在執行的時候碰到了一些錯誤\x3c\/p\x3e", "description" : "\x3cp\x3e正確來說我不曉得到底怎麼「稱呼」這個 forwardx11 \/ forwardagent\x3c\/p\x3e\n\x3cp\x3e總之就是在寫一隻ansible playbook\x3c\/p\x3e\n\x3cp\x3e目的是用來安裝、設定 firefox\x3c\/p\x3e\n\x3cp\x3e包含安裝 firefox addon\x3c\/p\x3e\n\x3cp\x3e但是一開始在執行的時候碰到了一些錯誤\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,19 +305,12 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent</p> <p>正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent</p>
<p>總之就是在寫一隻ansible playbook</p> <p>總之就是在寫一隻ansible playbook</p>
<p>目的是用來安裝、設定 firefox</p> <p>目的是用來安裝、設定 firefox</p>
<p>包含安裝 firefox addon</p> <p>包含安裝 firefox addon</p>
<p>但是一開始在執行的時候,碰到了一些錯誤</p> <p>但是一開始在執行的時候,碰到了一些錯誤</p>
<h3 id="錯誤訊息">錯誤訊息</h3> <h3 id="錯誤訊息">錯誤訊息</h3>
<p>playbook 在執行時的錯誤訊息如下</p> <p>playbook 在執行時的錯誤訊息如下</p>
<pre><code>TASK [firefox : Create profiles] ************************************************************************************************* <pre><code>TASK [firefox : Create profiles] *************************************************************************************************
Tuesday 24 December 2019 14:28:58 +0800 (0:00:00.067) 0:00:00.946 ****** Tuesday 24 December 2019 14:28:58 +0800 (0:00:00.067) 0:00:00.946 ******
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Exception: b'Error: no DISPLAY environment variable specified\n' An exception occurred during task execution. To see the full traceback, use -vvv. The error was: Exception: b'Error: no DISPLAY environment variable specified\n'
@ -365,18 +354,11 @@ Shared connection to 192.168.11.75 closed.
PLAY RECAP *********************************************************************************************************************** PLAY RECAP ***********************************************************************************************************************
hqdc075 : ok=3 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 hqdc075 : ok=3 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
</code></pre> </code></pre><p>稍微google 一下,都說是要設定 ssh forwardagent</p>
<p>稍微google 一下,都說是要設定 ssh forwardagent</p>
<p>所以翻了一下 ansible 的設定文件,看要怎麼做</p> <p>所以翻了一下 ansible 的設定文件,看要怎麼做</p>
<p>發現可以用 ssh_args 加入-o xxxxxx</p> <p>發現可以用 ssh_args 加入-o xxxxxx</p>
<p>可是又找不到 ssh 怎麼用這個 -o</p> <p>可是又找不到 ssh 怎麼用這個 -o</p>
<p>只好又回去找辣個男人問看看ssh的參數</p> <p>只好又回去找辣個男人問看看ssh的參數</p>
<pre><code> -o option <pre><code> -o option
Can be used to give options in the format used in the configuration file. This is useful for specifying options Can be used to give options in the format used in the configuration file. This is useful for specifying options
for which there is no separate command-line flag. For full details of the options listed below, and their possi for which there is no separate command-line flag. For full details of the options listed below, and their possi
@ -424,33 +406,18 @@ hqdc075 : ok=3 changed=1 unreachable=0 failed=1 s
IdentitiesOnly IdentitiesOnly
..... .....
..... .....
</code></pre> </code></pre><p>很長,就不全部列出來了</p>
<p>很長,就不全部列出來了</p>
<p>看到重點是 ForwardAgent / ForwardX11 了</p> <p>看到重點是 ForwardAgent / ForwardX11 了</p>
<p>但是真的不曉得怎麼區分這兩種</p> <p>但是真的不曉得怎麼區分這兩種</p>
<p>反正只有兩個,就 try and error 吧</p> <p>反正只有兩個,就 try and error 吧</p>
<p>在ansible 中修改inventory file ,在想要修改的 host 後面加入 ssh_args=&rdquo;-o ForwardAgent=yes&rdquo;</p>
<p>在ansible 中修改inventory file ,在想要修改的 host 後面加入 ssh_args=&ldquo;-o ForwardAgent=yes&rdquo;</p>
<pre><code>hqdc075 ansible_host=192.168.11.75 ssh_args=&quot;-o ForwardAgent=yes&quot; <pre><code>hqdc075 ansible_host=192.168.11.75 ssh_args=&quot;-o ForwardAgent=yes&quot;
</code></pre> </code></pre><p>或者 ansible.cfg</p>
<p>或者 ansible.cfg</p>
<p>在[ssh_connection]區段中</p> <p>在[ssh_connection]區段中</p>
<p>加入</p> <p>加入</p>
<pre><code>ssh_args=&quot;-o ForwardAgent=yes&quot; <pre><code>ssh_args=&quot;-o ForwardAgent=yes&quot;
</code></pre> </code></pre><p>再跑一次 就看到正常執行了</p>
<p>再跑一次 就看到正常執行了</p>
<pre><code>PLAY RECAP ************************************************************************************************ <pre><code>PLAY RECAP ************************************************************************************************
hqdc075 : ok=7 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 hqdc075 : ok=7 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
@ -464,21 +431,12 @@ firefox : export display -------- 0.44s
firefox : Configure profiles ---- 0.10s firefox : Configure profiles ---- 0.10s
firefox : debug ex ---- 0.07s firefox : debug ex ---- 0.07s
</code></pre> </code></pre><p>這次的過程順便了解了ssh 加入 -X 可以在ssh session 中執行遠端主機上的圖形界面程式</p>
<p>這次的過程順便了解了ssh 加入 -X 可以在ssh session 中執行遠端主機上的圖形界面程式</p>
<p>例如</p> <p>例如</p>
<pre><code>ssh -X username@hostname firefox <pre><code>ssh -X username@hostname firefox
</code></pre> </code></pre><p>就可以透過ssh 執行遠端的firefox</p>
<p>就可以透過ssh 執行遠端的firefox</p>
<p>如下圖</p> <p>如下圖</p>
<p><img src="https://i.imgur.com/5xoDFRe.png" alt=""></p>
<p><img src="https://i.imgur.com/5xoDFRe.png" alt="" /></p>
<p>很酷!</p> <p>很酷!</p>
</article> </article>
</div> </div>
@ -758,7 +716,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -770,7 +728,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 超強的ALL-in-One VPN Server streisand \/ Awesome All in One Vpn Server Streisand", "name" : "[筆記] 超強的ALL-in-One VPN Server streisand \/ Awesome All in One Vpn Server Streisand",
"headline" : "[筆記] 超強的ALL-in-One VPN Server streisand \/ Awesome All in One Vpn Server Streisand", "headline" : "[筆記] 超強的ALL-in-One VPN Server streisand \/ Awesome All in One Vpn Server Streisand",
"description" : "\x3cp\x3e最近上班閒得發慌沒事就上 github 找看看有沒有什麼好玩的專案\x3c\/p\x3e\n\n\x3cp\x3e就不小心發現了這個 streisand\x3c\/p\x3e\n\n\x3cp\x3e\x3ca href=\x22https:\/\/github.com\/StreisandEffect\/streisand\x22\x3ehttps:\/\/github.com\/StreisandEffect\/streisand\x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e玩了一下發現這根本就是終極的VPN Server solution ..\x3c\/p\x3e", "description" : "\x3cp\x3e最近上班閒得發慌沒事就上 github 找看看有沒有什麼好玩的專案\x3c\/p\x3e\n\x3cp\x3e就不小心發現了這個 streisand\x3c\/p\x3e\n\x3cp\x3e\x3ca href=\x22https:\/\/github.com\/StreisandEffect\/streisand\x22\x3ehttps:\/\/github.com\/StreisandEffect\/streisand\x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e玩了一下發現這根本就是終極的VPN Server solution ..\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,24 +305,17 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案</p> <p>最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案</p>
<p>就不小心發現了這個 streisand</p> <p>就不小心發現了這個 streisand</p>
<p><a href="https://github.com/StreisandEffect/streisand">https://github.com/StreisandEffect/streisand</a></p> <p><a href="https://github.com/StreisandEffect/streisand">https://github.com/StreisandEffect/streisand</a></p>
<p>玩了一下發現這根本就是終極的VPN Server solution ..</p> <p>玩了一下發現這根本就是終極的VPN Server solution ..</p>
<p>包含了各種常見的VPN 套件,像是</p> <p>包含了各種常見的VPN 套件,像是</p>
<ul> <ul>
<li>OpenConnect / Cisco AnyConnect</li> <li>OpenConnect / Cisco AnyConnect</li>
<li>OpenVPN</li> <li>OpenVPN</li>
<li>Shadowsocks</li> <li>Shadowsocks</li>
<li>WireGuard</li> <li>WireGuard</li>
</ul> </ul>
<p>並且直接整合了幾間比較大的雲端主機服務商</p> <p>並且直接整合了幾間比較大的雲端主機服務商</p>
<ul> <ul>
<li>Amazon Web Services (AWS)</li> <li>Amazon Web Services (AWS)</li>
<li>Microsoft Azure</li> <li>Microsoft Azure</li>
@ -335,15 +324,10 @@ if (!doNotTrack) {
<li>Linode</li> <li>Linode</li>
<li>Rackspace</li> <li>Rackspace</li>
</ul> </ul>
<p>透過指令,可以簡單的在上述的空間建立一台新的 VPS (可惜沒有vultr)</p> <p>透過指令,可以簡單的在上述的空間建立一台新的 VPS (可惜沒有vultr)</p>
<p>安裝步驟什麼的就不說了,因為整合了 ansible 所以過程很簡單</p> <p>安裝步驟什麼的就不說了,因為整合了 ansible 所以過程很簡單</p>
<p>而且在安裝完成後,會自動生成相關文件</p> <p>而且在安裝完成後,會自動生成相關文件</p>
<p>文件中包含了怎麼連線的方式,以及連線設定檔,甚至連 QRCODE 都幫你做好</p> <p>文件中包含了怎麼連線的方式,以及連線設定檔,甚至連 QRCODE 都幫你做好</p>
<p>真的是超級方便的VPN工具</p> <p>真的是超級方便的VPN工具</p>
</article> </article>
</div> </div>
@ -621,7 +605,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -633,7 +617,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -24,7 +24,7 @@
"datePublished": "2019-09-05 11:42:28 \x2b0800 CST", "datePublished": "2019-09-05 11:42:28 \x2b0800 CST",
"dateModified" : "2019-09-05 11:42:28 \x2b0800 CST", "dateModified" : "2019-09-05 11:42:28 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/post\/backup-restore-postgresql-with-pgbackrest\/", "url" : "https:\/\/h.cowbay.org\/post\/backup-restore-postgresql-with-pgbackrest\/",
"wordCount" : "818", "wordCount" : "816",
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-15.jpg"", "image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-15.jpg"",
"keywords" : [ ""postgresql"","Blog" ] "keywords" : [ ""postgresql"","Blog" ]
} }
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,28 +305,18 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這兩天在測試pgbackrest ,簡單筆記一下測試狀況</p> <p>這兩天在測試pgbackrest ,簡單筆記一下測試狀況</p>
<h4 id="install">install</h4> <h4 id="install">install</h4>
<p>在ubuntu 18.04 安裝pgbackrest 很簡單內建在apt裡面所以可以直接用</p> <p>在ubuntu 18.04 安裝pgbackrest 很簡單內建在apt裡面所以可以直接用</p>
<pre><code>sudo apt install pgbackrest <pre><code>sudo apt install pgbackrest
</code></pre> </code></pre><p>進行安裝</p>
<p>進行安裝</p>
<h4 id="config">config</h4> <h4 id="config">config</h4>
<p>pgbackrest 的設定檔在 /etc/pgbackrest/pgbackrest.conf <p>pgbackrest 的設定檔在 /etc/pgbackrest/pgbackrest.conf
如果是用apt 安裝,預設會建立一個 /etc/pgbackrest.conf 如果是用apt 安裝,預設會建立一個 /etc/pgbackrest.conf
但是這個路徑是錯誤的 但是這個路徑是錯誤的
執行 pgbackrest的時候預設還是會去讀取 /etc/pgbackrest/pgbackrest.conf 執行 pgbackrest的時候預設還是會去讀取 /etc/pgbackrest/pgbackrest.conf
要特別注意要不就是每次都指定config路徑要不就是把那個錯誤的設定檔幹掉</p> 要特別注意要不就是每次都指定config路徑要不就是把那個錯誤的設定檔幹掉</p>
<h4 id="config-內容">config 內容</h4> <h4 id="config-內容">config 內容</h4>
<p>內容其實很簡單</p> <p>內容其實很簡單</p>
<pre><code>postgres@hqdc039:~$ cat /etc/pgbackrest/pgbackrest.conf <pre><code>postgres@hqdc039:~$ cat /etc/pgbackrest/pgbackrest.conf
[demo] [demo]
pg1-path=/database/11/main pg1-path=/database/11/main
@ -344,47 +330,37 @@ repo1-retention-full=2
[global:archive-push] [global:archive-push]
compress-level=3 compress-level=3
process-max=4 process-max=4
</code></pre> </code></pre><p><strong>[demo]</strong> 用來指定這個 &ldquo;stanza&rdquo; 的名稱</p>
<ul>
<p><strong>[demo]</strong> 用來指定這個 &ldquo;stanza&rdquo; 的名稱 <li>pg1-path 是資料庫存放的路徑</li>
* pg1-path 是資料庫存放的路徑</p> </ul>
<p><strong>[global]</strong> 中的兩個cipher 用途我不清楚,不設定也沒關係</p> <p><strong>[global]</strong> 中的兩個cipher 用途我不清楚,不設定也沒關係</p>
<ul> <ul>
<li>&ldquo;repo1-path&rdquo; 則是用來存放備份的路徑</li> <li>&ldquo;repo1-path&rdquo; 則是用來存放備份的路徑</li>
<li>&ldquo;repo1-retention-full&rdquo; 定義要保留幾次 full backup</li> <li>&ldquo;repo1-retention-full&rdquo; 定義要保留幾次 full backup</li>
</ul> </ul>
<p><strong>[global:archive-push]</strong> 似乎是用來定義在備份/還原時的選項</p>
<p><strong>[global:archive-push]</strong> 似乎是用來定義在備份/還原時的選項 <ul>
* process-max 指定要用多少process (平行處理)</p> <li>process-max 指定要用多少process (平行處理)</li>
</ul>
<h4 id="簡單流程">簡單流程</h4> <h4 id="簡單流程">簡單流程</h4>
<ul> <ul>
<li>config (pgbackrest &amp; postgresql )</li> <li>config (pgbackrest &amp; postgresql )</li>
<li>建立 stanza</li> <li>建立 stanza</li>
<li>建立備份</li> <li>建立備份</li>
<li>(還原,如果有需要的話)</li> <li>(還原,如果有需要的話)</li>
</ul> </ul>
<h4 id="其他部份">其他部份</h4> <h4 id="其他部份">其他部份</h4>
<ul> <ul>
<li>清除 stanza (刪除備份)</li> <li>清除 stanza (刪除備份)</li>
<li>踩到的地雷</li> <li>踩到的地雷</li>
</ul> </ul>
<hr>
<hr /> <h4 id="設定-pgbackrest--postgresql">設定 pgbackrest &amp; postgresql</h4>
<h4 id="設定-pgbackrest-postgresql">設定 pgbackrest &amp; postgresql</h4>
<p>pgbackrest 基本上設定很簡單,內容就跟上面的一樣就可以跑了。 <p>pgbackrest 基本上設定很簡單,內容就跟上面的一樣就可以跑了。
當然要新增其他進階的,就要自己研究了,內容有夠長 當然要新增其他進階的,就要自己研究了,內容有夠長
<a href="https://pgbackrest.org/configuration.html">https://pgbackrest.org/configuration.html</a></p> <a href="https://pgbackrest.org/configuration.html">https://pgbackrest.org/configuration.html</a></p>
<p>在postgresql 中,要新增一些設定,主要是 archive_command</p> <p>在postgresql 中,要新增一些設定,主要是 archive_command</p>
<pre><code>postgres@hqdc039:~$ grep -A 100 &quot;for pgbackrest&quot; /etc/postgresql/11/main/postgresql.conf <pre><code>postgres@hqdc039:~$ grep -A 100 &quot;for pgbackrest&quot; /etc/postgresql/11/main/postgresql.conf
#for pgbackrest #for pgbackrest
archive_command = 'pgbackrest --stanza=demo archive-push %p' archive_command = 'pgbackrest --stanza=demo archive-push %p'
@ -394,52 +370,34 @@ log_line_prefix = ''
max_wal_senders = 3 max_wal_senders = 3
wal_level = replica wal_level = replica
postgres@hqdc039:~$ postgres@hqdc039:~$
</code></pre> </code></pre><p><strong>archive_command</strong>
<p><strong>archive_command</strong>
這個因為要帶stanza 名稱進來,所以<strong>需要跟pgbackrest.conf 裡面定義的名稱一致</strong></p> 這個因為要帶stanza 名稱進來,所以<strong>需要跟pgbackrest.conf 裡面定義的名稱一致</strong></p>
<p><strong>max_wal_senders</strong> <p><strong>max_wal_senders</strong>
簡單說就是定義在抄寫wal 的時候,可以同時抄給幾台 簡單說就是定義在抄寫wal 的時候,可以同時抄給幾台
這是postgresql 的說明</p> 這是postgresql 的說明</p>
<pre><code>the maximum number of simultaneously running WAL sender processes <pre><code>the maximum number of simultaneously running WAL sender processes
</code></pre> </code></pre><p><strong>wal_level</strong>
<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> 有三種等級,參考 <a href="https://blog.csdn.net/pg_hgdb/article/details/78666719">https://blog.csdn.net/pg_hgdb/article/details/78666719</a></p>
<ul> <ul>
<li>minimal &ndash;不能通过基础备份和wal日志恢复数据库。</li> <li>minimal &ndash;不能通过基础备份和wal日志恢复数据库。</li>
<li>replica = 9.6版本以前的archive和hot_standby &ndash;该级别支持wal归档和复制。</li> <li>replica = 9.6版本以前的archive和hot_standby &ndash;该级别支持wal归档和复制。</li>
<li>logical &ndash;在replica级别的基础上添加了支持逻辑解码所需的信息。</li> <li>logical &ndash;在replica级别的基础上添加了支持逻辑解码所需的信息。</li>
</ul> </ul>
<p>設定完成後,重起 postgresql 就可以了</p> <p>設定完成後,重起 postgresql 就可以了</p>
<h4 id="建立-stanza">建立 stanza</h4> <h4 id="建立-stanza">建立 stanza</h4>
<p>stanza 這名詞我是第一次聽到,直接翻譯就是 <strong>&quot;&quot;(詩的)節,段&rdquo;</strong></p>
<p>stanza 這名詞我是第一次聽到,直接翻譯就是 <strong>&rdquo;&ldquo;(詩的)節,段&rdquo;</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><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 <p>在pgbackrest中可以一次定義多個 stanza用來備份不同的DB
這次環境很簡單,所以就只有設定一個 這次環境很簡單,所以就只有設定一個
依照上面的pgbackrest.conf 內容設定好了需要先建立這個stanza 依照上面的pgbackrest.conf 內容設定好了需要先建立這個stanza
指令:</p> 指令:</p>
<pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo stanza-create --log-level-console=detail <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=&lt;redacted&gt; --repo1-cipher-type=aes-256-cbc --repo1-path=/var/lib/pgbackrest --stanza=demo 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=&lt;redacted&gt; --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) 2019-09-04 16:21:41.525 P00 INFO: stanza-create command end: completed successfully (825ms)
postgres@hqdc039:~$ postgres@hqdc039:~$
</code></pre> </code></pre><p>接著就可以執行備份了</p>
<p>接著就可以執行備份了</p>
<h4 id="backup">backup</h4> <h4 id="backup">backup</h4>
<p>備份指令也很簡單要注意的是如果不帶參數pgbackrest 會自行決定要用incremental或者是 full backup</p> <p>備份指令也很簡單要注意的是如果不帶參數pgbackrest 會自行決定要用incremental或者是 full backup</p>
<pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo --log-level-console=detail backup <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=&lt;redacted&gt; --repo1-cipher-type=aes-256-cbc --repo1-path=/var/lib/pgbackrest --repo1-retention-full=2 --stanza=demo 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=&lt;redacted&gt; --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:17.697 P00 INFO: last backup label = 20190904-134245F, version = 2.16
@ -466,10 +424,7 @@ WARN: a timeline switch has occurred since the last backup, enabling delta check
2019-09-04 16:41:25.215 P00 DETAIL: no archive to remove, archiveId = 11-1 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) 2019-09-04 16:41:25.215 P00 INFO: expire command end: completed successfully (21ms)
postgres@hqdc039:~$ postgres@hqdc039:~$
</code></pre> </code></pre><p>執行後,可以檢查一下</p>
<p>執行後,可以檢查一下</p>
<pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo --log-level-console=info info <pre><code>postgres@hqdc039:~$ pgbackrest --stanza=demo --log-level-console=info info
stanza: demo stanza: demo
status: ok status: ok
@ -491,30 +446,19 @@ stanza: demo
repository size: 547MB, repository backup size: 220.4KB repository size: 547MB, repository backup size: 220.4KB
backup reference list: 20190904-134245F backup reference list: 20190904-134245F
postgres@hqdc039:~$ postgres@hqdc039:~$
</code></pre> </code></pre><h4 id="還原測試">還原測試</h4>
<h4 id="還原測試">還原測試</h4>
<p>pgbackrest 的還原因為透過WAL ,所以有一些觀念需要先釐清 <p>pgbackrest 的還原因為透過WAL ,所以有一些觀念需要先釐清
本來我的測試是先做好備份,然後直接砍掉 DB接著再用restore還原 本來我的測試是先做好備份,然後直接砍掉 DB接著再用restore還原
卻發現砍掉的DB居然沒有回來.. 卻發現砍掉的DB居然沒有回來..
後來看了這一篇,然後又研究了一下 <strong>Point-in-Time Recovery</strong> 後來看了這一篇,然後又研究了一下 <strong>Point-in-Time Recovery</strong>
<a href="https://github.com/pgbackrest/pgbackrest/issues/800">https://github.com/pgbackrest/pgbackrest/issues/800</a> <a href="https://github.com/pgbackrest/pgbackrest/issues/800">https://github.com/pgbackrest/pgbackrest/issues/800</a>
才找到正確的用法</p> 才找到正確的用法</p>
<p>先把DB整個砍掉</p> <p>先把DB整個砍掉</p>
<pre><code>postgres@hqdc034:/zp/database$ time dropdb demo <pre><code>postgres@hqdc034:/zp/database$ time dropdb demo
</code></pre> </code></pre><p>然後停止postgresql 服務</p>
<p>然後停止postgresql 服務</p>
<pre><code>postgres@hqdc034:/zp/database$ pg_ctlcluster 10 main stop <pre><code>postgres@hqdc034:/zp/database$ pg_ctlcluster 10 main stop
sudo systemctl stop postgresql@10-main sudo systemctl stop postgresql@10-main
</code></pre> </code></pre><p>接著就可以來下指令還原了</p>
<p>接著就可以來下指令還原了</p>
<pre><code>postgres@hqdc034:/zp/database$ time pgbackrest --stanza=demo --log-level-console=info --delta --type=time &quot;--target=2019-09-05 11:00:00.268248+08&quot; --target-action=promote restore <pre><code>postgres@hqdc034:/zp/database$ time pgbackrest --stanza=demo --log-level-console=info --delta --type=time &quot;--target=2019-09-05 11:00:00.268248+08&quot; --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=&quot;2019-09-05 11:00:00.268248+08&quot; --target-action=promote --type=time 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=&quot;2019-09-05 11:00:00.268248+08&quot; --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.624 P00 INFO: restore backup set 20190905-111109F
@ -527,25 +471,16 @@ postgres@hqdc039:~$
real 0m3.328s real 0m3.328s
user 0m6.896s user 0m6.896s
sys 0m0.832s sys 0m0.832s
</code></pre> </code></pre><p>在DB目錄中會產生一個recovery.conf這是用來給 postgresql 看的檔案,裡面會紀錄怎麼還原、以及還原的類型、時間點,這邊指定要恢復到 <em><strong>2019-09-05 11:00:00.268248+08</strong></em>
<p>在DB目錄中會產生一個recovery.conf這是用來給 postgresql 看的檔案,裡面會紀錄怎麼還原、以及還原的類型、時間點,這邊指定要恢復到 <strong><em>2019-09-05 11:00:00.268248+08</em></strong>
這個時間格式要看資料庫的設定,可以藉由以下指令得到</p> 這個時間格式要看資料庫的設定,可以藉由以下指令得到</p>
<pre><code>postgres@hqdc034:/zp/database$ psql -Atc &quot;select current_timestamp&quot; <pre><code>postgres@hqdc034:/zp/database$ psql -Atc &quot;select current_timestamp&quot;
2019-09-05 11:14:27.268248+08 2019-09-05 11:14:27.268248+08
</code></pre> </code></pre><p>檢查一下recovery.conf</p>
<p>檢查一下recovery.conf</p>
<pre><code>postgres@hqdc034:/zp/database$ cat /zp/database/10/main/recovery.conf <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 &quot;%p&quot;' restore_command = 'pgbackrest --log-level-console=info --stanza=demo archive-get %f &quot;%p&quot;'
recovery_target_time = '2019-09-05 11:00:00.268248+08' recovery_target_time = '2019-09-05 11:00:00.268248+08'
recovery_target_action = 'promote' recovery_target_action = 'promote'
</code></pre> </code></pre><p>重新啟動postgresql 然後看看被砍掉的demo DB有沒有回來</p>
<p>重新啟動postgresql 然後看看被砍掉的demo DB有沒有回來</p>
<pre><code>postgres@hqdc034:/zp/database$ pg_ctlcluster 10 main start <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: Warning: the cluster will not be running as a systemd service. Consider using systemctl:
sudo systemctl start postgresql@10-main sudo systemctl start postgresql@10-main
@ -567,10 +502,7 @@ postgres=# \l
postgres=# \q postgres=# \q
postgres@hqdc034:/zp/database$ postgres@hqdc034:/zp/database$
</code></pre> </code></pre><p>很好, demo DB 有順利的還原回來了先暫時測試到這邊。接下來要來玩postgresql on zfs</p>
<p>很好, demo DB 有順利的還原回來了先暫時測試到這邊。接下來要來玩postgresql on zfs</p>
<p>後續如果想更深入測試 pgbackrest可以試試看異機備份還原。</p> <p>後續如果想更深入測試 pgbackrest可以試試看異機備份還原。</p>
</article> </article>
</div> </div>
@ -846,7 +778,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -858,7 +790,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -311,14 +307,10 @@ if (!doNotTrack) {
<p>前幾天在淘寶上買了個 SSK 的USB 3.1 Gen2 (type-c) NVME SSD 外接盒 <p>前幾天在淘寶上買了個 SSK 的USB 3.1 Gen2 (type-c) NVME SSD 外接盒
手邊也剛好有一條多的intel 600p nvme ssd 就順手來做個比較 手邊也剛好有一條多的intel 600p nvme ssd 就順手來做個比較
目標是看看有沒有可能直接用外接的SSD來跑postgresql</p> 目標是看看有沒有可能直接用外接的SSD來跑postgresql</p>
<p>把600p 裝進去外接盒之後,就先來看一些簡單的資訊 <p>把600p 裝進去外接盒之後,就先來看一些簡單的資訊
不過沒想到用了幾個指令,都沒辦法辨別出正確的型號</p> 不過沒想到用了幾個指令,都沒辦法辨別出正確的型號</p>
<h4 id="fdisk">fdisk</h4> <h4 id="fdisk">fdisk</h4>
<p>沒有看到廠牌、型號</p> <p>沒有看到廠牌、型號</p>
<pre><code>2019-09-10 13:20:55 [minion@hqdc075 ~]$ sudo fdisk /dev/sdb <pre><code>2019-09-10 13:20:55 [minion@hqdc075 ~]$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.31.1). Welcome to fdisk (util-linux 2.31.1).
@ -337,25 +329,17 @@ Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 500118191 500116144 238.5G 83 Linux /dev/sdb1 2048 500118191 500116144 238.5G 83 Linux
Command (m for help): q Command (m for help): q
</code></pre> </code></pre><h4 id="inxi">inxi</h4>
<h4 id="inxi">inxi</h4>
<p>內接的intel ssd 有看到不過外接的這顆SSD沒有model 可是可以看到序號 <p>內接的intel ssd 有看到不過外接的這顆SSD沒有model 可是可以看到序號
我在想這個序號應該是外接盒的序號而不是SSD的</p> 我在想這個序號應該是外接盒的序號而不是SSD的</p>
<pre><code>2019-09-10 13:21:51 [minion@hqdc075 ~]$ sudo inxi -Dxx <pre><code>2019-09-10 13:21:51 [minion@hqdc075 ~]$ sudo inxi -Dxx
Drives: HDD Total Size: 640.2GB (11.3% used) Drives: HDD Total Size: 640.2GB (11.3% used)
ID-1: /dev/nvme0n1 model: INTEL_SSDPEKKF256G7L size: 256.1GB serial: BTPYXXXXX firmware: 123P ID-1: /dev/nvme0n1 model: INTEL_SSDPEKKF256G7L size: 256.1GB serial: BTPYXXXXX firmware: 123P
ID-2: USB /dev/sda model: SD/MMC size: 128.1GB serial: 201205XXXXXX-0:0 temp: 0C ID-2: USB /dev/sda model: SD/MMC size: 128.1GB serial: 201205XXXXXX-0:0 temp: 0C
ID-3: USB /dev/sdb model: N/A size: 256.1GB serial: DF564XXXXXX:0 temp: 0C ID-3: USB /dev/sdb model: N/A size: 256.1GB serial: DF564XXXXXX:0 temp: 0C
2019-09-10 13:21:55 [minion@hqdc075 ~]$ 2019-09-10 13:21:55 [minion@hqdc075 ~]$
</code></pre> </code></pre><h4 id="dmesg">dmesg</h4>
<h4 id="dmesg">dmesg</h4>
<p>一樣,也是認不出 SSD ,但是有抓到外接盒</p> <p>一樣,也是認不出 SSD ,但是有抓到外接盒</p>
<pre><code>[16622.930915] hub 4-0:1.0: USB hub found <pre><code>[16622.930915] hub 4-0:1.0: USB hub found
[16622.930926] hub 4-0:1.0: 2 ports detected [16622.930926] hub 4-0:1.0: 2 ports detected
[16623.372533] usb 4-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd [16623.372533] usb 4-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd
@ -364,13 +348,9 @@ Drives: HDD Total Size: 640.2GB (11.3% used)
[16623.393853] usb 4-1: Product: SSK Storage [16623.393853] usb 4-1: Product: SSK Storage
[16623.393856] usb 4-1: Manufacturer: SSK [16623.393856] usb 4-1: Manufacturer: SSK
[16623.393858] usb 4-1: SerialNumber: DF56419883B20 [16623.393858] usb 4-1: SerialNumber: DF56419883B20
</code></pre> </code></pre><h4 id="直接測試吧">直接測試吧</h4>
<h4 id="直接測試吧">直接測試吧</h4>
<p>不看型號了,直接測試吧!先切好分割、格式化,然後掛載到 /mnt再用 dd 測試寫入 <p>不看型號了,直接測試吧!先切好分割、格式化,然後掛載到 /mnt再用 dd 測試寫入
結果如下</p> 結果如下</p>
<pre><code>2019-09-10 13:24:03 [minion@hqdc075 ~]$ for i in {4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384};do sudo dd if=/dev/zero of=/mnt/&quot;$i&quot;k bs=&quot;$i&quot;k count=1k;done <pre><code>2019-09-10 13:24:03 [minion@hqdc075 ~]$ for i in {4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384};do sudo dd if=/dev/zero of=/mnt/&quot;$i&quot;k bs=&quot;$i&quot;k count=1k;done
1024+0 records in 1024+0 records in
1024+0 records out 1024+0 records out
@ -412,20 +392,13 @@ Drives: HDD Total Size: 640.2GB (11.3% used)
1024+0 records out 1024+0 records out
17179869184 bytes (17 GB, 16 GiB) copied, 153.142 s, 112 MB/s 17179869184 bytes (17 GB, 16 GiB) copied, 153.142 s, 112 MB/s
2019-09-10 13:28:58 [minion@hqdc075 ~]$ 2019-09-10 13:28:58 [minion@hqdc075 ~]$
</code></pre> </code></pre><p>可以發現,<strong>當寫入8G檔案的時候速度開始急遽下降</strong>
<p>可以發現,<strong>當寫入8G檔案的時候速度開始急遽下降</strong>
翻了一下google 看到這張表格</p> 翻了一下google 看到這張表格</p>
<p><a href="https://www.anandtech.com/show/10850/the-intel-ssd-600p-512gb-review">https://www.anandtech.com/show/10850/the-intel-ssd-600p-512gb-review</a></p> <p><a href="https://www.anandtech.com/show/10850/the-intel-ssd-600p-512gb-review">https://www.anandtech.com/show/10850/the-intel-ssd-600p-512gb-review</a></p>
<p>intel 600p 256G 的SLC Cache 只有8.5GB <p>intel 600p 256G 的SLC Cache 只有8.5GB
合理解釋了為什麼當寫入8G的檔案時速度會掉那麼慘跟SATA硬碟差不多了</p> 合理解釋了為什麼當寫入8G的檔案時速度會掉那麼慘跟SATA硬碟差不多了</p>
<h4 id="用iobench-測試看看">用iobench 測試看看</h4> <h4 id="用iobench-測試看看">用iobench 測試看看</h4>
<p>得到一樣的結論8G左右就會把cache塞暴然後掉速</p> <p>得到一樣的結論8G左右就會把cache塞暴然後掉速</p>
<pre><code>2019-09-10 13:44:59 [changch@hqdc075 iobench]$ sudo ./iobench.sh --sync --dir /mnt --megabytes 8192 <pre><code>2019-09-10 13:44:59 [changch@hqdc075 iobench]$ sudo ./iobench.sh --sync --dir /mnt --megabytes 8192
Target directory: /mnt Target directory: /mnt
Testfile size: 8192 x 1 Megabyte Testfile size: 8192 x 1 Megabyte
@ -458,10 +431,7 @@ Start 5 of 5...
Done. Done.
2019-09-10 13:47:40 [changch@hqdc075 iobench]$ 2019-09-10 13:47:40 [changch@hqdc075 iobench]$
</code></pre> </code></pre><p>那如果不用8G的檔案大小來測試呢看起來是比較正常一點</p>
<p>那如果不用8G的檔案大小來測試呢看起來是比較正常一點</p>
<pre><code>2019-09-10 13:47:40 [changch@hqdc075 iobench]$ sudo ./iobench.sh --sync --dir /mnt --megabytes 4096 <pre><code>2019-09-10 13:47:40 [changch@hqdc075 iobench]$ sudo ./iobench.sh --sync --dir /mnt --megabytes 4096
Target directory: /mnt Target directory: /mnt
Testfile size: 4096 x 1 Megabyte Testfile size: 4096 x 1 Megabyte
@ -494,16 +464,10 @@ Start 5 of 5...
Done. Done.
2019-09-10 13:50:09 [changch@hqdc075 iobench]$ 2019-09-10 13:50:09 [changch@hqdc075 iobench]$
</code></pre> </code></pre><h4 id="跑看看pgbench-">跑看看pgbench ??</h4>
<h4 id="跑看看pgbench">跑看看pgbench ??</h4>
<p>試試看這次的目標,用 external nvme ssd 跑資料庫會不會跟放在本機的PCI-E SSD 有所差距?</p> <p>試試看這次的目標,用 external nvme ssd 跑資料庫會不會跟放在本機的PCI-E SSD 有所差距?</p>
<h4 id="data_directory-in-internal-pcie-ssd">data_directory in internal pcie-ssd</h4>
<h4 id="data-directory-in-internal-pcie-ssd">data_directory in internal pcie-ssd</h4>
<p><strong>initialize pgbench database</strong></p> <p><strong>initialize pgbench database</strong></p>
<pre><code>2019-09-10 13:52:35 [minion@hqdc075 ~]$ sudo su - postgres <pre><code>2019-09-10 13:52:35 [minion@hqdc075 ~]$ sudo su - postgres
postgres@hqdc075:~$ createdb pgbench postgres@hqdc075:~$ createdb pgbench
postgres@hqdc075:~$ pgbench -i -U postgres -s 10 pgbench postgres@hqdc075:~$ pgbench -i -U postgres -s 10 pgbench
@ -525,10 +489,7 @@ creating tables...
vacuum... vacuum...
set primary keys... set primary keys...
done. done.
</code></pre> </code></pre><p><strong>run pgbench</strong></p>
<p><strong>run pgbench</strong></p>
<pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench <pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench
starting vacuum...end. starting vacuum...end.
transaction type: &lt;builtin: select only&gt; transaction type: &lt;builtin: select only&gt;
@ -553,12 +514,8 @@ number of transactions actually processed: 100000/100000
latency average = 3.753 ms latency average = 3.753 ms
tps = 26643.223990 (including connections establishing) tps = 26643.223990 (including connections establishing)
tps = 26659.061459 (excluding connections establishing) tps = 26659.061459 (excluding connections establishing)
</code></pre> </code></pre><h4 id="data_directory-in-external-nvme-ssd">data_directory in external NVME SSD</h4>
<h4 id="data-directory-in-external-nvme-ssd">data_directory in external NVME SSD</h4>
<p><strong>initialize pgbench database</strong></p> <p><strong>initialize pgbench database</strong></p>
<pre><code>postgres@hqdc075:~$ pgbench -i -U postgres -s 10 pgbench <pre><code>postgres@hqdc075:~$ pgbench -i -U postgres -s 10 pgbench
creating tables... creating tables...
100000 of 1000000 tuples (10%) done (elapsed 0.08 s, remaining 0.70 s) 100000 of 1000000 tuples (10%) done (elapsed 0.08 s, remaining 0.70 s)
@ -574,12 +531,9 @@ creating tables...
vacuum... vacuum...
set primary keys... set primary keys...
done. done.
</code></pre> </code></pre><p><strong>run pgbench</strong>
<p><strong>run pgbench</strong>
可以看到兩邊的結果其實是差不多的,作為資料庫備份是一定沒有問題 可以看到兩邊的結果其實是差不多的,作為資料庫備份是一定沒有問題
至於能不能直接作為資料庫空間使用?我想也許可以嘗試看看..</p> 至於能不能直接作為資料庫空間使用?我想也許可以嘗試看看..</p>
<pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench <pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench
starting vacuum...end. starting vacuum...end.
transaction type: &lt;builtin: select only&gt; transaction type: &lt;builtin: select only&gt;
@ -605,17 +559,11 @@ latency average = 3.758 ms
tps = 26610.771423 (including connections establishing) tps = 26610.771423 (including connections establishing)
tps = 26626.871871 (excluding connections establishing) tps = 26626.871871 (excluding connections establishing)
postgres@hqdc075:~$ postgres@hqdc075:~$
</code></pre> </code></pre><p>update:</p>
<p>update:</p>
<p>剛剛看了一下,發現這樣只有測試到 read (select only) <p>剛剛看了一下,發現這樣只有測試到 read (select only)
或許要找找看其他的測試方法</p> 或許要找找看其他的測試方法</p>
<hr>
<hr />
<p>接下來直接用 restore 測試</p> <p>接下來直接用 restore 測試</p>
<pre><code>#### restore 5G database with external nvme ssd <pre><code>#### restore 5G database with external nvme ssd
postgres@hqdc075:~$ createdb demo postgres@hqdc075:~$ createdb demo
postgres@hqdc075:~$ time psql demo &lt; /tmp/demo.sql postgres@hqdc075:~$ time psql demo &lt; /tmp/demo.sql
@ -627,10 +575,7 @@ real 4m1.184s
user 0m2.894s user 0m2.894s
sys 0m0.504s sys 0m0.504s
postgres@hqdc075:~$ postgres@hqdc075:~$
</code></pre> </code></pre><h4 id="restore-5g-database-with-internal-pci-e-nvme-ssd">restore 5G database with internal pci-e nvme ssd</h4>
<h4 id="restore-5g-database-with-internal-pci-e-nvme-ssd">restore 5G database with internal pci-e nvme ssd</h4>
<pre><code>postgres@hqdc075:~$ dropdb demo <pre><code>postgres@hqdc075:~$ dropdb demo
postgres@hqdc075:~$ createdb demo postgres@hqdc075:~$ createdb demo
postgres@hqdc075:~$ time psql demo &lt; /tmp/demo.sql postgres@hqdc075:~$ time psql demo &lt; /tmp/demo.sql
@ -642,14 +587,9 @@ real 4m1.636s
user 0m2.909s user 0m2.909s
sys 0m0.612s sys 0m0.612s
postgres@hqdc075:~$ postgres@hqdc075:~$
</code></pre> </code></pre><p>看起來是沒有什麼區別,那如果是外接的 SATA SSD呢</p>
<hr>
<p>看起來是沒有什麼區別,那如果是外接的 SATA SSD呢</p>
<hr />
<p>dmesg 看得到型號耶..</p> <p>dmesg 看得到型號耶..</p>
<pre><code>[23995.478928] usb 2-4: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd <pre><code>[23995.478928] usb 2-4: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[23995.506134] usb 2-4: New USB device found, idVendor=2109, idProduct=0715, bcdDevice= 3.36 [23995.506134] usb 2-4: New USB device found, idVendor=2109, idProduct=0715, bcdDevice= 3.36
[23995.506141] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [23995.506141] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
@ -667,12 +607,8 @@ postgres@hqdc075:~$
[23995.540806] sdc: [23995.540806] sdc:
[23995.544089] sd 2:0:0:0: [sdc] Attached SCSI disk [23995.544089] sd 2:0:0:0: [sdc] Attached SCSI disk
2019-09-10 14:24:54 [minion@hqdc075 ~]$ 2019-09-10 14:24:54 [minion@hqdc075 ~]$
</code></pre> </code></pre><p><strong>restore 5G database with external sata SSD</strong></p>
<p><strong>restore 5G database with external sata SSD</strong></p>
<p>很意外的,速度居然還是差不多??</p> <p>很意外的,速度居然還是差不多??</p>
<pre><code>postgres@hqdc075:~$ createdb demo <pre><code>postgres@hqdc075:~$ createdb demo
postgres@hqdc075:~$ time psql demo &lt; /tmp/demo.sql postgres@hqdc075:~$ time psql demo &lt; /tmp/demo.sql
SET SET
@ -683,12 +619,8 @@ real 4m9.950s
user 0m2.752s user 0m2.752s
sys 0m0.640s sys 0m0.640s
postgres@hqdc075:~$ postgres@hqdc075:~$
</code></pre> </code></pre><p><strong>run pgebnech</strong></p>
<p><strong>run pgebnech</strong></p>
<p>這個差很多了tps 從前面的 26000 掉到剩下 2800 ,差十倍左右!</p> <p>這個差很多了tps 從前面的 26000 掉到剩下 2800 ,差十倍左右!</p>
<pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench <pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench
starting vacuum...end. starting vacuum...end.
transaction type: &lt;builtin: select only&gt; transaction type: &lt;builtin: select only&gt;
@ -702,10 +634,7 @@ latency average = 35.267 ms
tps = 2835.526770 (including connections establishing) tps = 2835.526770 (including connections establishing)
tps = 2855.642604 (excluding connections establishing) tps = 2855.642604 (excluding connections establishing)
postgres@hqdc075:~$ postgres@hqdc075:~$
</code></pre> </code></pre><p>疑問:</p>
<p>疑問:</p>
<ol> <ol>
<li>什麼原因會讓外接/內建 nvme ssd 和外接SATA SSD 在 restore db時花了差不多時間但是 tps 差異那麼大呢?</li> <li>什麼原因會讓外接/內建 nvme ssd 和外接SATA SSD 在 restore db時花了差不多時間但是 tps 差異那麼大呢?</li>
<li>這樣測試似乎沒有真正測出外接nvme ssd 跑資料庫時候的效能?</li> <li>這樣測試似乎沒有真正測出外接nvme ssd 跑資料庫時候的效能?</li>
@ -988,7 +917,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -1000,7 +929,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "Bookstack Docker", "name" : "Bookstack Docker",
"headline" : "Bookstack Docker", "headline" : "Bookstack Docker",
"description" : "\x3cp\x3eBookstack 是一套非常好用的線上\x26rdquo;筆記\x26rdquo;系統\x3c\/p\x3e\n\n\x3cp\x3e他用圖書館\/書本的概念,讓使用者可以建立自己的\x26rdquo;圖書館\x26rdquo;\x3c\/p\x3e\n\n\x3cp\x3e同時在圖書館內建立不同的\x26rdquo;書籍\x26rdquo;\x3c\/p\x3e\n\n\x3cp\x3e而且支援 Markdown 語法\x3c\/p\x3e\n\n\x3cp\x3e其他的方式像是在nextcloud上編輯 md檔案(字體太小)\x3c\/p\x3e\n\n\x3cp\x3e或者是boostnote(只能在本機)\x3c\/p\x3e\n\n\x3cp\x3e都或多或少有點小缺點\x3c\/p\x3e\n\n\x3cp\x3eBookstack則是沒有這些問題不過就是系統「大」了點\x26hellip;\x3c\/p\x3e\n\n\x3cp\x3e不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)\x3c\/p\x3e", "description" : "\x3cp\x3eBookstack 是一套非常好用的線上\x26quot;筆記\x26quot;系統\x3c\/p\x3e\n\x3cp\x3e他用圖書館\/書本的概念,讓使用者可以建立自己的\x26quot;圖書館\x26rdquo;\x3c\/p\x3e\n\x3cp\x3e同時在圖書館內建立不同的\x26quot;書籍\x26rdquo;\x3c\/p\x3e\n\x3cp\x3e而且支援 Markdown 語法\x3c\/p\x3e\n\x3cp\x3e其他的方式像是在nextcloud上編輯 md檔案(字體太小)\x3c\/p\x3e\n\x3cp\x3e或者是boostnote(只能在本機)\x3c\/p\x3e\n\x3cp\x3e都或多或少有點小缺點\x3c\/p\x3e\n\x3cp\x3eBookstack則是沒有這些問題不過就是系統「大」了點\x26hellip;\x3c\/p\x3e\n\x3cp\x3e不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -308,42 +304,24 @@ if (!doNotTrack) {
<div class="entry-container"> <div class="entry-container">
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>Bookstack 是一套非常好用的線上&rdquo;筆記&rdquo;系統</p> <p>Bookstack 是一套非常好用的線上&quot;筆記&quot;系統</p>
<p>他用圖書館/書本的概念,讓使用者可以建立自己的&quot;圖書館&rdquo;</p>
<p>他用圖書館/書本的概念,讓使用者可以建立自己的&rdquo;圖書館&rdquo;</p> <p>同時在圖書館內建立不同的&quot;書籍&rdquo;</p>
<p>同時在圖書館內建立不同的&rdquo;書籍&rdquo;</p>
<p>而且支援 Markdown 語法</p> <p>而且支援 Markdown 語法</p>
<p>其他的方式像是在nextcloud上編輯 md檔案(字體太小)</p> <p>其他的方式像是在nextcloud上編輯 md檔案(字體太小)</p>
<p>或者是boostnote(只能在本機)</p> <p>或者是boostnote(只能在本機)</p>
<p>都或多或少有點小缺點</p> <p>都或多或少有點小缺點</p>
<p>Bookstack則是沒有這些問題不過就是系統「大」了點&hellip;</p> <p>Bookstack則是沒有這些問題不過就是系統「大」了點&hellip;</p>
<p>不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)</p> <p>不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)</p>
<p>這個是專案的名稱</p> <p>這個是專案的名稱</p>
<h4 id="solidnerddocker-bookstack">solidnerd/docker-bookstack</h4>
<h4 id="solidnerd-docker-bookstack">solidnerd/docker-bookstack</h4>
<p>gihub上的連結</p> <p>gihub上的連結</p>
<p><a href="https://github.com/solidnerd/docker-bookstack">https://github.com/solidnerd/docker-bookstack</a></p> <p><a href="https://github.com/solidnerd/docker-bookstack">https://github.com/solidnerd/docker-bookstack</a></p>
<p>因為都轉成docker了所以安裝很簡單 <p>因為都轉成docker了所以安裝很簡單
先git clone回來</p> 先git clone回來</p>
<pre><code>git clone https://github.com/solidnerd/docker-bookstack <pre><code>git clone https://github.com/solidnerd/docker-bookstack
</code></pre> </code></pre><p>然後依照他的說明建立一個docker-compose.yml檔案再視情況修改</p>
<p>然後依照他的說明建立一個docker-compose.yml檔案再視情況修改</p>
<p>底下是我的docker-compose.yml內容</p> <p>底下是我的docker-compose.yml內容</p>
<pre><code> version: '2' <pre><code> version: '2'
services: services:
mysql: mysql:
@ -375,29 +353,17 @@ if (!doNotTrack) {
mysql-data: mysql-data:
uploads: uploads:
storage-uploads: storage-uploads:
</code></pre> </code></pre><p>原則上我沒有修改什麼設定先確認一下現在的bookstack版本 0.24.1 是目前最新的了</p>
<p>原則上我沒有修改什麼設定先確認一下現在的bookstack版本 0.24.1 是目前最新的了</p>
<p>然後把 port 改成8003 ,避免去強碰 80 port</p> <p>然後把 port 改成8003 ,避免去強碰 80 port</p>
<p>如果前面搭配 caddy 之類的反向代理,那不用去記 port 也沒關係。</p> <p>如果前面搭配 caddy 之類的反向代理,那不用去記 port 也沒關係。</p>
<p>好了之後,就執行 docker-compose up -d</p> <p>好了之後,就執行 docker-compose up -d</p>
<p>然後 docker ps -a 看一下執行狀況</p> <p>然後 docker ps -a 看一下執行狀況</p>
<pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES <pre><code>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6b3333eabf30 solidnerd/bookstack:0.24.1 &quot;/docker-entrypoint.…&quot; 4 hours ago Exited (0) About an hour ago docker-bookstack_bookstack_1 6b3333eabf30 solidnerd/bookstack:0.24.1 &quot;/docker-entrypoint.…&quot; 4 hours ago Exited (0) About an hour ago docker-bookstack_bookstack_1
b8d74048eba1 mysql:5.7.21 &quot;docker-entrypoint.s…&quot; 4 hours ago Exited (0) About an hour ago docker-bookstack_mysql_1 b8d74048eba1 mysql:5.7.21 &quot;docker-entrypoint.s…&quot; 4 hours ago Exited (0) About an hour ago docker-bookstack_mysql_1
</code></pre> </code></pre><p>應該可以順利跑起來</p>
<p><img src="https://i.imgur.com/NIUCJhN.png" alt="bookstack運作畫面"></p>
<p>應該可以順利跑起來</p>
<p><img src="https://i.imgur.com/NIUCJhN.png" alt="bookstack運作畫面" /></p>
<p>沒啥難度,簡單作一下紀錄</p> <p>沒啥難度,簡單作一下紀錄</p>
<p>後面再來看看能不能在一個地方新增 md 檔案,然後可以自動傳到 hexo/hugo/ghost 的目錄,接著自動生成靜態檔案出來&hellip;</p> <p>後面再來看看能不能在一個地方新增 md 檔案,然後可以自動傳到 hexo/hugo/ghost 的目錄,接著自動生成靜態檔案出來&hellip;</p>
</article> </article>
</div> </div>
@ -675,7 +641,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -687,7 +653,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 為了metabase 修改 firefox 開啟網頁時使用的預設語言 change the preferred language in firefox for metabase", "name" : "[筆記] 為了metabase 修改 firefox 開啟網頁時使用的預設語言 change the preferred language in firefox for metabase",
"headline" : "[筆記] 為了metabase 修改 firefox 開啟網頁時使用的預設語言 change the preferred language in firefox for metabase", "headline" : "[筆記] 為了metabase 修改 firefox 開啟網頁時使用的預設語言 change the preferred language in firefox for metabase",
"description" : "\x3cp\x3e最近在測試metabase記得幾個月前就有測試過\x3c\/p\x3e\n\n\x3cp\x3e但是當時的界面和現在的樣子差很多看樣子改版還滿勤勞的\x3c\/p\x3e\n\n\x3cp\x3e所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)\x3c\/p\x3e\n\n\x3cp\x3e不過呢很討厭的是一進去就發現語系採用的是簡體中文\x3c\/p\x3e", "description" : "\x3cp\x3e最近在測試metabase記得幾個月前就有測試過\x3c\/p\x3e\n\x3cp\x3e但是當時的界面和現在的樣子差很多看樣子改版還滿勤勞的\x3c\/p\x3e\n\x3cp\x3e所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)\x3c\/p\x3e\n\x3cp\x3e不過呢很討厭的是一進去就發現語系採用的是簡體中文\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,67 +305,36 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近在測試metabase記得幾個月前就有測試過</p> <p>最近在測試metabase記得幾個月前就有測試過</p>
<p>但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的</p> <p>但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的</p>
<p>所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)</p> <p>所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)</p>
<p>不過呢,很討厭的是,一進去就發現語系採用的是簡體中文</p> <p>不過呢,很討厭的是,一進去就發現語系採用的是簡體中文</p>
<p>來看看這張圖 <p>來看看這張圖
<img src="https://i.imgur.com/oK6WmtJ.png" alt="metabase的簡體中文界面" /></p> <img src="https://i.imgur.com/oK6WmtJ.png" alt="metabase的簡體中文界面"></p>
<p>WHAT THE FUCK !!!</p> <p>WHAT THE FUCK !!!</p>
<p>這是哪一國的翻譯??我相信對岸人才濟濟,絕對不至於翻譯出這種結果來..</p> <p>這是哪一國的翻譯??我相信對岸人才濟濟,絕對不至於翻譯出這種結果來..</p>
<p>想當然爾,我認為這個問題可以暫時不管,反正進入系統後,再去使用者界面設定就好</p> <p>想當然爾,我認為這個問題可以暫時不管,反正進入系統後,再去使用者界面設定就好</p>
<p>BUT .. (對又是這個他X的BUT)</p> <p>BUT .. (對又是這個他X的BUT)</p>
<p>使用者設置裡面根本沒什麼可以改!</p> <p>使用者設置裡面根本沒什麼可以改!</p>
<p><img src="https://i.imgur.com/DBRE5J6.png" alt="metabase超陽春的使用者設置"></p>
<p><img src="https://i.imgur.com/DBRE5J6.png" alt="metabase超陽春的使用者設置" /></p>
<p>對,沒錯,就只有這樣!! 請容許我再罵一次 WHAT THE FUCK !!!</p> <p>對,沒錯,就只有這樣!! 請容許我再罵一次 WHAT THE FUCK !!!</p>
<hr>
<hr />
<p>好吧,罵完就算了,還是要想辦法解決,於是切到管理界面,的確是有語言設置</p> <p>好吧,罵完就算了,還是要想辦法解決,於是切到管理界面,的確是有語言設置</p>
<p>然後,我要再罵第三次 WHAT THE FUCK !!!</p> <p>然後,我要再罵第三次 WHAT THE FUCK !!!</p>
<p><img src="https://i.imgur.com/HCSf8Ba.png" alt="metabase管理界面"></p>
<p><img src="https://i.imgur.com/HCSf8Ba.png" alt="metabase管理界面" /></p>
<pre><code>The default language for this Metabase instance.This only applies to emails, Pulses, etc. Users' browsers will specify the language used in the user interface. <pre><code>The default language for this Metabase instance.This only applies to emails, Pulses, etc. Users' browsers will specify the language used in the user interface.
</code></pre> </code></pre><p>簡單說,這邊的語言設定「不影響」使用者界面,界面使用的語系,由各個瀏覽器決定!</p>
<p>簡單說,這邊的語言設定「不影響」使用者界面,界面使用的語系,由各個瀏覽器決定!</p>
<p>那我去修改firefox 的語言看看</p> <p>那我去修改firefox 的語言看看</p>
<p>開啟 firefox ,點選右上角的三橫槓,找到語言選項</p> <p>開啟 firefox ,點選右上角的三橫槓,找到語言選項</p>
<p>我一開始改成這樣</p> <p>我一開始改成這樣</p>
<p><img src="https://i.imgur.com/630BBJF.png" alt="firefox settings"></p>
<p><img src="https://i.imgur.com/630BBJF.png" alt="firefox settings" /></p>
<p>結果不管重開幾次開啟metabase還是那個殘體中文字</p> <p>結果不管重開幾次開啟metabase還是那個殘體中文字</p>
<p>後來想說,啊,會不會是「英語」「美語」的差異?</p> <p>後來想說,啊,會不會是「英語」「美語」的差異?</p>
<p>所以我把順序改成</p> <p>所以我把順序改成</p>
<p><img src="https://i.imgur.com/pfdSWaC.png" alt="firefox language settings for metabase"></p>
<p><img src="https://i.imgur.com/pfdSWaC.png" alt="firefox language settings for metabase" /></p>
<p>然後再開 metabase ,結果就如我所願的,改成英文界面了</p> <p>然後再開 metabase ,結果就如我所願的,改成英文界面了</p>
<p><img src="https://i.imgur.com/rc6SLSC.png" alt="metabase in English"></p>
<p><img src="https://i.imgur.com/rc6SLSC.png" alt="metabase in English" /></p>
<p>真的是比殘體中文好太多了..</p> <p>真的是比殘體中文好太多了..</p>
<p>另外關於繁體中文的部份也到metabase的官方論壇去留言了</p> <p>另外關於繁體中文的部份也到metabase的官方論壇去留言了</p>
<p>就看看官方要不要處理這個問題&hellip;</p> <p>就看看官方要不要處理這個問題&hellip;</p>
</article> </article>
</div> </div>
@ -649,7 +614,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -661,7 +626,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 修改 docker 容器內的時區 - Change Timezone in Docker", "name" : "[筆記] 修改 docker 容器內的時區 - Change Timezone in Docker",
"headline" : "[筆記] 修改 docker 容器內的時區 - Change Timezone in Docker", "headline" : "[筆記] 修改 docker 容器內的時區 - Change Timezone in Docker",
"description" : "\x3cp\x3e最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致\x3c\/p\x3e\n\n\x3cp\x3e有的用 UTC有的用localtime就是沒碰到用 Asia\/Taipei 的\x26hellip;.\x3c\/p\x3e", "description" : "\x3cp\x3e最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致\x3c\/p\x3e\n\x3cp\x3e有的用 UTC有的用localtime就是沒碰到用 Asia\/Taipei 的\x26hellip;.\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,23 +305,14 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致</p> <p>最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致</p>
<p>有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&hellip;.</p> <p>有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&hellip;.</p>
<p>之前因為沒有要上線,所以這個問題可以當烏龜忽略過去</p> <p>之前因為沒有要上線,所以這個問題可以當烏龜忽略過去</p>
<p>不過測試了一陣子的librenms 打算正式上線了</p> <p>不過測試了一陣子的librenms 打算正式上線了</p>
<p>又不想重作一次,導致累積滿久的圖表資料都消失</p> <p>又不想重作一次,導致累積滿久的圖表資料都消失</p>
<p>所以開始找尋方法來面對這個問題</p> <p>所以開始找尋方法來面對這個問題</p>
<p>本來看了這篇 <a href="https://www.arthurtoday.com/2016/07/how-to-setup-docker-container-timezone-host.html">https://www.arthurtoday.com/2016/07/how-to-setup-docker-container-timezone-host.html</a></p> <p>本來看了這篇 <a href="https://www.arthurtoday.com/2016/07/how-to-setup-docker-container-timezone-host.html">https://www.arthurtoday.com/2016/07/how-to-setup-docker-container-timezone-host.html</a></p>
<p>想說來試試看好了</p> <p>想說來試試看好了</p>
<p>不過呢一開始依照這篇的說明在docker-compose.yml 內加入</p> <p>不過呢一開始依照這篇的說明在docker-compose.yml 內加入</p>
<pre><code>web: <pre><code>web:
image: jarischaefer/docker-librenms image: jarischaefer/docker-librenms
hostname: librenms hostname: librenms
@ -337,22 +324,14 @@ if (!doNotTrack) {
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
environment: environment:
- TZ=&quot;Asia/Taipei&quot; - TZ=&quot;Asia/Taipei&quot;
</code></pre> </code></pre><p>重起之後沒作用 0rz</p>
<p>重起之後沒作用 0rz</p>
<p>於是我又加入了</p> <p>於是我又加入了</p>
<pre><code> volumes: <pre><code> volumes:
- /etc/hosts:/etc/hosts - /etc/hosts:/etc/hosts
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
</code></pre> </code></pre><p>結果啟動直接報錯誤了..</p>
<p>結果啟動直接報錯誤了..</p>
<p>看一下 log</p> <p>看一下 log</p>
<pre><code>May 21 09:09:12 bbs012 syslog-ng[12]: syslog-ng starting up; version='3.13.2' <pre><code>May 21 09:09:12 bbs012 syslog-ng[12]: syslog-ng starting up; version='3.13.2'
*** Running /etc/my_init.d/librenms_100_cron... *** Running /etc/my_init.d/librenms_100_cron...
*** Running /etc/my_init.d/librenms_101_ssl... *** Running /etc/my_init.d/librenms_101_ssl...
@ -362,12 +341,8 @@ if (!doNotTrack) {
*** /etc/my_init.d/librenms_103_timezone failed with status 1 *** /etc/my_init.d/librenms_103_timezone failed with status 1
*** Killing all processes... *** Killing all processes...
</code></pre> </code></pre><p>所以這個檔案不能改成 ro 不過如果不能唯獨那啟動docker的時候應該會被蓋掉吧</p>
<p>所以這個檔案不能改成 ro 不過如果不能唯獨那啟動docker的時候應該會被蓋掉吧</p>
<p>先來看一下那個 librenms_103_timezone 在幹什麼好了</p> <p>先來看一下那個 librenms_103_timezone 在幹什麼好了</p>
<pre><code>docker exec -it librenms_web_1 cat /etc/my_init.d/librenms_103_timezone <pre><code>docker exec -it librenms_web_1 cat /etc/my_init.d/librenms_103_timezone
#!/bin/bash -e #!/bin/bash -e
@ -383,41 +358,25 @@ if [ -n &quot;$TZ&quot; ]; then
fi fi
fi fi
2019-05-21 17:33:46 [mini@s013 librenms]$ 2019-05-21 17:33:46 [mini@s013 librenms]$
</code></pre> </code></pre><p>OK ,這裡的確是用傳進來的 $TZ 在設定timezone 沒錯</p>
<p>OK ,這裡的確是用傳進來的 $TZ 在設定timezone 沒錯</p>
<p>可是我前面已經改過 docker-compose.yml</p> <p>可是我前面已經改過 docker-compose.yml</p>
<p>有把 TZ帶進來了啊再來確認一下</p> <p>有把 TZ帶進來了啊再來確認一下</p>
<pre><code>docker exec -it librenms_web_1 cat /etc/timezone <pre><code>docker exec -it librenms_web_1 cat /etc/timezone
&quot;Asia/Taipei&quot; &quot;Asia/Taipei&quot;
</code></pre> </code></pre><p>咦,沒錯啊? 欸斗,等等,那兩個 &quot;&rdquo; 有點刺眼&hellip;</p>
<p>咦,沒錯啊? 欸斗,等等,那兩個 &ldquo;&rdquo; 有點刺眼&hellip;</p>
<p>跟本機的比對一下看看</p> <p>跟本機的比對一下看看</p>
<pre><code>2019-05-21 17:36:20 [mini@s013 librenms]$ docker exec -it librenms_web_1 cat /etc/timezone <pre><code>2019-05-21 17:36:20 [mini@s013 librenms]$ docker exec -it librenms_web_1 cat /etc/timezone
&quot;Asia/Taipei&quot; &quot;Asia/Taipei&quot;
2019-05-21 17:36:23 [mini@s013 librenms]$ cat /etc/timezone 2019-05-21 17:36:23 [mini@s013 librenms]$ cat /etc/timezone
Asia/Taipei Asia/Taipei
2019-05-21 17:37:10 [mini@s013 librenms]$ 2019-05-21 17:37:10 [mini@s013 librenms]$
</code></pre> </code></pre><p>嗯,的確,本機的格式的確不包含那兩個 &quot;&rdquo;</p>
<p>嗯,的確,本機的格式的確不包含那兩個 &ldquo;&rdquo;</p>
<p>那就改掉再來試試看吧&hellip;改成底下這樣</p> <p>那就改掉再來試試看吧&hellip;改成底下這樣</p>
<pre><code> environment: <pre><code> environment:
- TZ=Asia/Taipei - TZ=Asia/Taipei
</code></pre> </code></pre><p>重起 docker ,然後確認時間看看</p>
<p>重起 docker ,然後確認時間看看</p>
<pre><code>2019-05-21 17:39:00 [mini@s013 librenms]$ docker-compose down;docker-compose up -d <pre><code>2019-05-21 17:39:00 [mini@s013 librenms]$ docker-compose down;docker-compose up -d
Stopping librenms_web_1 ... done Stopping librenms_web_1 ... done
Stopping librenms_mysql_1 ... done Stopping librenms_mysql_1 ... done
@ -432,10 +391,7 @@ Asia/Taipei
2019-05-21 17:39:42 [mini@s013 librenms]$ docker exec -it librenms_web_1 date 2019-05-21 17:39:42 [mini@s013 librenms]$ docker exec -it librenms_web_1 date
Tue May 21 17:39:48 CST 2019 Tue May 21 17:39:48 CST 2019
2019-05-21 17:39:48 [mini@s013 librenms]$ 2019-05-21 17:39:48 [mini@s013 librenms]$
</code></pre> </code></pre><p>OK ,果然沒有問題了!</p>
<p>OK ,果然沒有問題了!</p>
<p>雖然是小小的&rdquo;&rdquo; ,還是要特別注意啊!</p> <p>雖然是小小的&rdquo;&rdquo; ,還是要特別注意啊!</p>
</article> </article>
</div> </div>
@ -713,7 +669,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -725,7 +681,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在openwrt 中檢查網路埠的連接速度\/ Check Port Speed in Openwrt", "name" : "[筆記] 在openwrt 中檢查網路埠的連接速度\/ Check Port Speed in Openwrt",
"headline" : "[筆記] 在openwrt 中檢查網路埠的連接速度\/ Check Port Speed in Openwrt", "headline" : "[筆記] 在openwrt 中檢查網路埠的連接速度\/ Check Port Speed in Openwrt",
"description" : "\x3cp\x3e最近在玩ansible \x2b openwrt \x2b wireguard\x3c\/p\x3e\n\n\x3cp\x3eansible 腳本寫好之後可以把config 佈署到 openwrt 上\x3c\/p\x3e\n\n\x3cp\x3e當然前提是最好用同樣的機器不同的機器在config 上會有一些差異\x3c\/p\x3e\n\n\x3cp\x3e但是這些差異常常就會造成無法連線、無法使用的狀況\x3c\/p\x3e\n\n\x3cp\x3eBTW 我是用 ubiquiti 的 edgerouter X 來做\x3c\/p\x3e\n\n\x3cp\x3e都弄好之後就想說來跑個iperf3 測試一下連線速度\x3c\/p\x3e\n\n\x3cp\x3e也好和之前做的 IPSEC 比較一下\x3c\/p\x3e\n\n\x3cp\x3e結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config\x3c\/p\x3e\n\n\x3cp\x3e但是有一台edgerouter X 的VPN 連接速度就是特別慢\x3c\/p\x3e\n\n\x3cp\x3e而且速度都剛好卡在 99.X Mb 左右\x3c\/p\x3e\n\n\x3cp\x3e就讓我很納悶了\x26hellip;\x3c\/p\x3e", "description" : "\x3cp\x3e最近在玩ansible \x2b openwrt \x2b wireguard\x3c\/p\x3e\n\x3cp\x3eansible 腳本寫好之後可以把config 佈署到 openwrt 上\x3c\/p\x3e\n\x3cp\x3e當然前提是最好用同樣的機器不同的機器在config 上會有一些差異\x3c\/p\x3e\n\x3cp\x3e但是這些差異常常就會造成無法連線、無法使用的狀況\x3c\/p\x3e\n\x3cp\x3eBTW 我是用 ubiquiti 的 edgerouter X 來做\x3c\/p\x3e\n\x3cp\x3e都弄好之後就想說來跑個iperf3 測試一下連線速度\x3c\/p\x3e\n\x3cp\x3e也好和之前做的 IPSEC 比較一下\x3c\/p\x3e\n\x3cp\x3e結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config\x3c\/p\x3e\n\x3cp\x3e但是有一台edgerouter X 的VPN 連接速度就是特別慢\x3c\/p\x3e\n\x3cp\x3e而且速度都剛好卡在 99.X Mb 左右\x3c\/p\x3e\n\x3cp\x3e就讓我很納悶了\x26hellip;\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,478 +305,445 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近在玩ansible + openwrt + wireguard</p> <p>最近在玩ansible + openwrt + wireguard</p>
<p>ansible 腳本寫好之後可以把config 佈署到 openwrt 上</p> <p>ansible 腳本寫好之後可以把config 佈署到 openwrt 上</p>
<p>當然前提是最好用同樣的機器不同的機器在config 上會有一些差異</p> <p>當然前提是最好用同樣的機器不同的機器在config 上會有一些差異</p>
<p>但是這些差異常常就會造成無法連線、無法使用的狀況</p> <p>但是這些差異常常就會造成無法連線、無法使用的狀況</p>
<p>BTW 我是用 ubiquiti 的 edgerouter X 來做</p> <p>BTW 我是用 ubiquiti 的 edgerouter X 來做</p>
<p>都弄好之後就想說來跑個iperf3 測試一下連線速度</p> <p>都弄好之後就想說來跑個iperf3 測試一下連線速度</p>
<p>也好和之前做的 IPSEC 比較一下</p> <p>也好和之前做的 IPSEC 比較一下</p>
<p>結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config</p> <p>結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config</p>
<p>但是有一台edgerouter X 的VPN 連接速度就是特別慢</p> <p>但是有一台edgerouter X 的VPN 連接速度就是特別慢</p>
<p>而且速度都剛好卡在 99.X Mb 左右</p> <p>而且速度都剛好卡在 99.X Mb 左右</p>
<p>就讓我很納悶了&hellip;</p> <p>就讓我很納悶了&hellip;</p>
<p>於是想說來檢查一下網路孔的狀態</p> <p>於是想說來檢查一下網路孔的狀態</p>
<p>但是因為openwrt 精簡了很多指令所以一些linux 上常用的指令都看不到實際的連線速度</p> <p>但是因為openwrt 精簡了很多指令所以一些linux 上常用的指令都看不到實際的連線速度</p>
<p>後來終於找到這一篇</p> <p>後來終於找到這一篇</p>
<p><a href="https://forum.openwrt.org/t/change-interface-br-lan-from-100-mb-to-1-gigabit-help-me/21914">https://forum.openwrt.org/t/change-interface-br-lan-from-100-mb-to-1-gigabit-help-me/21914</a></p> <p><a href="https://forum.openwrt.org/t/change-interface-br-lan-from-100-mb-to-1-gigabit-help-me/21914">https://forum.openwrt.org/t/change-interface-br-lan-from-100-mb-to-1-gigabit-help-me/21914</a></p>
<p>其中有提到這個指令</p> <p>其中有提到這個指令</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">swconfig dev switch0 show
<pre><code class="language-shell">swconfig dev switch0 show </code></pre></div><p>所以在有問題的那台機器跑一次結果就發現了port0 的連線速度只有100BaseT</p>
</code></pre> <div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">root@OpenWrt-15:~# swconfig dev switch0 show
<p>所以在有問題的那台機器跑一次結果就發現了port0 的連線速度只有100BaseT</p>
<pre><code class="language-shell">root@OpenWrt-15:~# swconfig dev switch0 show
Global attributes: Global attributes:
enable_vlan: 1 enable_vlan: <span style="color:#ae81ff">1</span>
mib: Switch MIB counters mib: Switch MIB counters
PPE_AC_BCNT0: 0 PPE_AC_BCNT0: <span style="color:#ae81ff">0</span>
PPE_AC_PCNT0: 0 PPE_AC_PCNT0: <span style="color:#ae81ff">0</span>
PPE_AC_BCNT63: 0 PPE_AC_BCNT63: <span style="color:#ae81ff">0</span>
PPE_AC_PCNT63: 0 PPE_AC_PCNT63: <span style="color:#ae81ff">0</span>
PPE_MTR_CNT0: 0 PPE_MTR_CNT0: <span style="color:#ae81ff">0</span>
PPE_MTR_CNT63: 0 PPE_MTR_CNT63: <span style="color:#ae81ff">0</span>
GDM1_TX_GBCNT: 0 GDM1_TX_GBCNT: <span style="color:#ae81ff">0</span>
GDM1_TX_GPCNT: 0 GDM1_TX_GPCNT: <span style="color:#ae81ff">0</span>
GDM1_TX_SKIPCNT: 0 GDM1_TX_SKIPCNT: <span style="color:#ae81ff">0</span>
GDM1_TX_COLCNT: 0 GDM1_TX_COLCNT: <span style="color:#ae81ff">0</span>
GDM1_RX_GBCNT1: 0 GDM1_RX_GBCNT1: <span style="color:#ae81ff">0</span>
GDM1_RX_GPCNT1: 0 GDM1_RX_GPCNT1: <span style="color:#ae81ff">0</span>
GDM1_RX_OERCNT: 0 GDM1_RX_OERCNT: <span style="color:#ae81ff">0</span>
GDM1_RX_FERCNT: 0 GDM1_RX_FERCNT: <span style="color:#ae81ff">0</span>
GDM1_RX_SERCNT: 0 GDM1_RX_SERCNT: <span style="color:#ae81ff">0</span>
GDM1_RX_LERCNT: 0 GDM1_RX_LERCNT: <span style="color:#ae81ff">0</span>
GDM1_RX_CERCNT: 0 GDM1_RX_CERCNT: <span style="color:#ae81ff">0</span>
GDM1_RX_FCCNT: 0 GDM1_RX_FCCNT: <span style="color:#ae81ff">0</span>
GDM2_TX_GBCNT: 0 GDM2_TX_GBCNT: <span style="color:#ae81ff">0</span>
GDM2_TX_GPCNT: 0 GDM2_TX_GPCNT: <span style="color:#ae81ff">0</span>
GDM2_TX_SKIPCNT: 0 GDM2_TX_SKIPCNT: <span style="color:#ae81ff">0</span>
GDM2_TX_COLCNT: 0 GDM2_TX_COLCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_GBCNT: 0 GDM2_RX_GBCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_GPCNT: 0 GDM2_RX_GPCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_OERCNT: 0 GDM2_RX_OERCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_FERCNT: 0 GDM2_RX_FERCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_SERCNT: 0 GDM2_RX_SERCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_LERCNT: 0 GDM2_RX_LERCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_CERCNT: 0 GDM2_RX_CERCNT: <span style="color:#ae81ff">0</span>
GDM2_RX_FCCNT: 0 GDM2_RX_FCCNT: <span style="color:#ae81ff">0</span>
Port 0: Port 0:
mib: Port 0 MIB counters mib: Port <span style="color:#ae81ff">0</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 6861716 TxUni : <span style="color:#ae81ff">6861716</span>
TxMulti : 8 TxMulti : <span style="color:#ae81ff">8</span>
TxBroad : 12 TxBroad : <span style="color:#ae81ff">12</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 4056 Tx64Byte : <span style="color:#ae81ff">4056</span>
Tx65Byte : 11645 Tx65Byte : <span style="color:#ae81ff">11645</span>
Tx128Byte : 13210 Tx128Byte : <span style="color:#ae81ff">13210</span>
Tx256Byte : 249 Tx256Byte : <span style="color:#ae81ff">249</span>
Tx512Byte : 169 Tx512Byte : <span style="color:#ae81ff">169</span>
Tx1024Byte : 6832407 Tx1024Byte : <span style="color:#ae81ff">6832407</span>
TxByte : 10238376166 TxByte : <span style="color:#ae81ff">10238376166</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 49 RxFiltered : <span style="color:#ae81ff">49</span>
RxUni : 963037 RxUni : <span style="color:#ae81ff">963037</span>
RxMulti : 1200795 RxMulti : <span style="color:#ae81ff">1200795</span>
RxBroad : 54114 RxBroad : <span style="color:#ae81ff">54114</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 56679 Rx64Byte : <span style="color:#ae81ff">56679</span>
Rx65Byte : 117104 Rx65Byte : <span style="color:#ae81ff">117104</span>
Rx128Byte : 1359908 Rx128Byte : <span style="color:#ae81ff">1359908</span>
Rx256Byte : 181766 Rx256Byte : <span style="color:#ae81ff">181766</span>
Rx512Byte : 198823 Rx512Byte : <span style="color:#ae81ff">198823</span>
Rx1024Byte : 303666 Rx1024Byte : <span style="color:#ae81ff">303666</span>
RxByte : 889985596 RxByte : <span style="color:#ae81ff">889985596</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 2 pvid: <span style="color:#ae81ff">2</span>
link: port:0 link:up speed:100baseT full-duplex link: port:0 link:up speed:100baseT full-duplex
Port 1: Port 1:
mib: Port 1 MIB counters mib: Port <span style="color:#ae81ff">1</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 948176 TxUni : <span style="color:#ae81ff">948176</span>
TxMulti : 170 TxMulti : <span style="color:#ae81ff">170</span>
TxBroad : 3 TxBroad : <span style="color:#ae81ff">3</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 1557 Tx64Byte : <span style="color:#ae81ff">1557</span>
Tx65Byte : 930766 Tx65Byte : <span style="color:#ae81ff">930766</span>
Tx128Byte : 1302 Tx128Byte : <span style="color:#ae81ff">1302</span>
Tx256Byte : 528 Tx256Byte : <span style="color:#ae81ff">528</span>
Tx512Byte : 75 Tx512Byte : <span style="color:#ae81ff">75</span>
Tx1024Byte : 14121 Tx1024Byte : <span style="color:#ae81ff">14121</span>
TxByte : 87870052 TxByte : <span style="color:#ae81ff">87870052</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 0 RxFiltered : <span style="color:#ae81ff">0</span>
RxUni : 6849258 RxUni : <span style="color:#ae81ff">6849258</span>
RxMulti : 187 RxMulti : <span style="color:#ae81ff">187</span>
RxBroad : 0 RxBroad : <span style="color:#ae81ff">0</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 911 Rx64Byte : <span style="color:#ae81ff">911</span>
Rx65Byte : 14343 Rx65Byte : <span style="color:#ae81ff">14343</span>
Rx128Byte : 298 Rx128Byte : <span style="color:#ae81ff">298</span>
Rx256Byte : 88 Rx256Byte : <span style="color:#ae81ff">88</span>
Rx512Byte : 56 Rx512Byte : <span style="color:#ae81ff">56</span>
Rx1024Byte : 6833749 Rx1024Byte : <span style="color:#ae81ff">6833749</span>
RxByte : 9828214886 RxByte : <span style="color:#ae81ff">9828214886</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 1 pvid: <span style="color:#ae81ff">1</span>
link: port:1 link:up speed:1000baseT full-duplex link: port:1 link:up speed:1000baseT full-duplex
Port 2: Port 2:
mib: Port 2 MIB counters mib: Port <span style="color:#ae81ff">2</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 0 TxUni : <span style="color:#ae81ff">0</span>
TxMulti : 0 TxMulti : <span style="color:#ae81ff">0</span>
TxBroad : 0 TxBroad : <span style="color:#ae81ff">0</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 0 Tx64Byte : <span style="color:#ae81ff">0</span>
Tx65Byte : 0 Tx65Byte : <span style="color:#ae81ff">0</span>
Tx128Byte : 0 Tx128Byte : <span style="color:#ae81ff">0</span>
Tx256Byte : 0 Tx256Byte : <span style="color:#ae81ff">0</span>
Tx512Byte : 0 Tx512Byte : <span style="color:#ae81ff">0</span>
Tx1024Byte : 0 Tx1024Byte : <span style="color:#ae81ff">0</span>
TxByte : 0 TxByte : <span style="color:#ae81ff">0</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 0 RxFiltered : <span style="color:#ae81ff">0</span>
RxUni : 0 RxUni : <span style="color:#ae81ff">0</span>
RxMulti : 0 RxMulti : <span style="color:#ae81ff">0</span>
RxBroad : 0 RxBroad : <span style="color:#ae81ff">0</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 0 Rx64Byte : <span style="color:#ae81ff">0</span>
Rx65Byte : 0 Rx65Byte : <span style="color:#ae81ff">0</span>
Rx128Byte : 0 Rx128Byte : <span style="color:#ae81ff">0</span>
Rx256Byte : 0 Rx256Byte : <span style="color:#ae81ff">0</span>
Rx512Byte : 0 Rx512Byte : <span style="color:#ae81ff">0</span>
Rx1024Byte : 0 Rx1024Byte : <span style="color:#ae81ff">0</span>
RxByte : 0 RxByte : <span style="color:#ae81ff">0</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 1 pvid: <span style="color:#ae81ff">1</span>
link: port:2 link:down link: port:2 link:down
Port 3: Port 3:
mib: Port 3 MIB counters mib: Port <span style="color:#ae81ff">3</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 0 TxUni : <span style="color:#ae81ff">0</span>
TxMulti : 0 TxMulti : <span style="color:#ae81ff">0</span>
TxBroad : 0 TxBroad : <span style="color:#ae81ff">0</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 0 Tx64Byte : <span style="color:#ae81ff">0</span>
Tx65Byte : 0 Tx65Byte : <span style="color:#ae81ff">0</span>
Tx128Byte : 0 Tx128Byte : <span style="color:#ae81ff">0</span>
Tx256Byte : 0 Tx256Byte : <span style="color:#ae81ff">0</span>
Tx512Byte : 0 Tx512Byte : <span style="color:#ae81ff">0</span>
Tx1024Byte : 0 Tx1024Byte : <span style="color:#ae81ff">0</span>
TxByte : 0 TxByte : <span style="color:#ae81ff">0</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 0 RxFiltered : <span style="color:#ae81ff">0</span>
RxUni : 0 RxUni : <span style="color:#ae81ff">0</span>
RxMulti : 0 RxMulti : <span style="color:#ae81ff">0</span>
RxBroad : 0 RxBroad : <span style="color:#ae81ff">0</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 0 Rx64Byte : <span style="color:#ae81ff">0</span>
Rx65Byte : 0 Rx65Byte : <span style="color:#ae81ff">0</span>
Rx128Byte : 0 Rx128Byte : <span style="color:#ae81ff">0</span>
Rx256Byte : 0 Rx256Byte : <span style="color:#ae81ff">0</span>
Rx512Byte : 0 Rx512Byte : <span style="color:#ae81ff">0</span>
Rx1024Byte : 0 Rx1024Byte : <span style="color:#ae81ff">0</span>
RxByte : 0 RxByte : <span style="color:#ae81ff">0</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 1 pvid: <span style="color:#ae81ff">1</span>
link: port:3 link:down link: port:3 link:down
Port 4: Port 4:
mib: Port 4 MIB counters mib: Port <span style="color:#ae81ff">4</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 0 TxUni : <span style="color:#ae81ff">0</span>
TxMulti : 0 TxMulti : <span style="color:#ae81ff">0</span>
TxBroad : 0 TxBroad : <span style="color:#ae81ff">0</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 0 Tx64Byte : <span style="color:#ae81ff">0</span>
Tx65Byte : 0 Tx65Byte : <span style="color:#ae81ff">0</span>
Tx128Byte : 0 Tx128Byte : <span style="color:#ae81ff">0</span>
Tx256Byte : 0 Tx256Byte : <span style="color:#ae81ff">0</span>
Tx512Byte : 0 Tx512Byte : <span style="color:#ae81ff">0</span>
Tx1024Byte : 0 Tx1024Byte : <span style="color:#ae81ff">0</span>
TxByte : 0 TxByte : <span style="color:#ae81ff">0</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 0 RxFiltered : <span style="color:#ae81ff">0</span>
RxUni : 0 RxUni : <span style="color:#ae81ff">0</span>
RxMulti : 0 RxMulti : <span style="color:#ae81ff">0</span>
RxBroad : 0 RxBroad : <span style="color:#ae81ff">0</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 0 Rx64Byte : <span style="color:#ae81ff">0</span>
Rx65Byte : 0 Rx65Byte : <span style="color:#ae81ff">0</span>
Rx128Byte : 0 Rx128Byte : <span style="color:#ae81ff">0</span>
Rx256Byte : 0 Rx256Byte : <span style="color:#ae81ff">0</span>
Rx512Byte : 0 Rx512Byte : <span style="color:#ae81ff">0</span>
Rx1024Byte : 0 Rx1024Byte : <span style="color:#ae81ff">0</span>
RxByte : 0 RxByte : <span style="color:#ae81ff">0</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 1 pvid: <span style="color:#ae81ff">1</span>
link: port:4 link:down link: port:4 link:down
Port 5: Port 5:
mib: Port 5 MIB counters mib: Port <span style="color:#ae81ff">5</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 0 TxUni : <span style="color:#ae81ff">0</span>
TxMulti : 0 TxMulti : <span style="color:#ae81ff">0</span>
TxBroad : 0 TxBroad : <span style="color:#ae81ff">0</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 0 Tx64Byte : <span style="color:#ae81ff">0</span>
Tx65Byte : 0 Tx65Byte : <span style="color:#ae81ff">0</span>
Tx128Byte : 0 Tx128Byte : <span style="color:#ae81ff">0</span>
Tx256Byte : 0 Tx256Byte : <span style="color:#ae81ff">0</span>
Tx512Byte : 0 Tx512Byte : <span style="color:#ae81ff">0</span>
Tx1024Byte : 0 Tx1024Byte : <span style="color:#ae81ff">0</span>
TxByte : 0 TxByte : <span style="color:#ae81ff">0</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 0 RxFiltered : <span style="color:#ae81ff">0</span>
RxUni : 0 RxUni : <span style="color:#ae81ff">0</span>
RxMulti : 0 RxMulti : <span style="color:#ae81ff">0</span>
RxBroad : 0 RxBroad : <span style="color:#ae81ff">0</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 0 Rx64Byte : <span style="color:#ae81ff">0</span>
Rx65Byte : 0 Rx65Byte : <span style="color:#ae81ff">0</span>
Rx128Byte : 0 Rx128Byte : <span style="color:#ae81ff">0</span>
Rx256Byte : 0 Rx256Byte : <span style="color:#ae81ff">0</span>
Rx512Byte : 0 Rx512Byte : <span style="color:#ae81ff">0</span>
Rx1024Byte : 0 Rx1024Byte : <span style="color:#ae81ff">0</span>
RxByte : 0 RxByte : <span style="color:#ae81ff">0</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 0 pvid: <span style="color:#ae81ff">0</span>
link: port:5 link:down link: port:5 link:down
Port 6: Port 6:
mib: Port 6 MIB counters mib: Port <span style="color:#ae81ff">6</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 7812303 TxUni : <span style="color:#ae81ff">7812303</span>
TxMulti : 1200937 TxMulti : <span style="color:#ae81ff">1200937</span>
TxBroad : 54112 TxBroad : <span style="color:#ae81ff">54112</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 13632 TxPause : <span style="color:#ae81ff">13632</span>
Tx64Byte : 13632 Tx64Byte : <span style="color:#ae81ff">13632</span>
Tx65Byte : 188400 Tx65Byte : <span style="color:#ae81ff">188400</span>
Tx128Byte : 1360750 Tx128Byte : <span style="color:#ae81ff">1360750</span>
Tx256Byte : 181926 Tx256Byte : <span style="color:#ae81ff">181926</span>
Tx512Byte : 198875 Tx512Byte : <span style="color:#ae81ff">198875</span>
Tx1024Byte : 7137402 Tx1024Byte : <span style="color:#ae81ff">7137402</span>
TxByte : 10755312044 TxByte : <span style="color:#ae81ff">10755312044</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 51 RxFiltered : <span style="color:#ae81ff">51</span>
RxUni : 7809918 RxUni : <span style="color:#ae81ff">7809918</span>
RxMulti : 201 RxMulti : <span style="color:#ae81ff">201</span>
RxBroad : 30 RxBroad : <span style="color:#ae81ff">30</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 89 RxPause : <span style="color:#ae81ff">89</span>
Rx64Byte : 5720 Rx64Byte : <span style="color:#ae81ff">5720</span>
Rx65Byte : 942425 Rx65Byte : <span style="color:#ae81ff">942425</span>
Rx128Byte : 14535 Rx128Byte : <span style="color:#ae81ff">14535</span>
Rx256Byte : 778 Rx256Byte : <span style="color:#ae81ff">778</span>
Rx512Byte : 249 Rx512Byte : <span style="color:#ae81ff">249</span>
Rx1024Byte : 6846531 Rx1024Byte : <span style="color:#ae81ff">6846531</span>
RxByte : 10357481140 RxByte : <span style="color:#ae81ff">10357481140</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 0 pvid: <span style="color:#ae81ff">0</span>
link: port:6 link:up speed:1000baseT full-duplex link: port:6 link:up speed:1000baseT full-duplex
Port 7: Port 7:
mib: Port 7 MIB counters mib: Port <span style="color:#ae81ff">7</span> MIB counters
TxDrop : 0 TxDrop : <span style="color:#ae81ff">0</span>
TxCRC : 0 TxCRC : <span style="color:#ae81ff">0</span>
TxUni : 0 TxUni : <span style="color:#ae81ff">0</span>
TxMulti : 0 TxMulti : <span style="color:#ae81ff">0</span>
TxBroad : 0 TxBroad : <span style="color:#ae81ff">0</span>
TxCollision: 0 TxCollision: <span style="color:#ae81ff">0</span>
TxSingleCol: 0 TxSingleCol: <span style="color:#ae81ff">0</span>
TxMultiCol : 0 TxMultiCol : <span style="color:#ae81ff">0</span>
TxDefer : 0 TxDefer : <span style="color:#ae81ff">0</span>
TxLateCol : 0 TxLateCol : <span style="color:#ae81ff">0</span>
TxExcCol : 0 TxExcCol : <span style="color:#ae81ff">0</span>
TxPause : 0 TxPause : <span style="color:#ae81ff">0</span>
Tx64Byte : 0 Tx64Byte : <span style="color:#ae81ff">0</span>
Tx65Byte : 0 Tx65Byte : <span style="color:#ae81ff">0</span>
Tx128Byte : 0 Tx128Byte : <span style="color:#ae81ff">0</span>
Tx256Byte : 0 Tx256Byte : <span style="color:#ae81ff">0</span>
Tx512Byte : 0 Tx512Byte : <span style="color:#ae81ff">0</span>
Tx1024Byte : 0 Tx1024Byte : <span style="color:#ae81ff">0</span>
TxByte : 0 TxByte : <span style="color:#ae81ff">0</span>
RxDrop : 0 RxDrop : <span style="color:#ae81ff">0</span>
RxFiltered : 0 RxFiltered : <span style="color:#ae81ff">0</span>
RxUni : 0 RxUni : <span style="color:#ae81ff">0</span>
RxMulti : 0 RxMulti : <span style="color:#ae81ff">0</span>
RxBroad : 0 RxBroad : <span style="color:#ae81ff">0</span>
RxAlignErr : 0 RxAlignErr : <span style="color:#ae81ff">0</span>
RxCRC : 0 RxCRC : <span style="color:#ae81ff">0</span>
RxUnderSize: 0 RxUnderSize: <span style="color:#ae81ff">0</span>
RxFragment : 0 RxFragment : <span style="color:#ae81ff">0</span>
RxOverSize : 0 RxOverSize : <span style="color:#ae81ff">0</span>
RxJabber : 0 RxJabber : <span style="color:#ae81ff">0</span>
RxPause : 0 RxPause : <span style="color:#ae81ff">0</span>
Rx64Byte : 0 Rx64Byte : <span style="color:#ae81ff">0</span>
Rx65Byte : 0 Rx65Byte : <span style="color:#ae81ff">0</span>
Rx128Byte : 0 Rx128Byte : <span style="color:#ae81ff">0</span>
Rx256Byte : 0 Rx256Byte : <span style="color:#ae81ff">0</span>
Rx512Byte : 0 Rx512Byte : <span style="color:#ae81ff">0</span>
Rx1024Byte : 0 Rx1024Byte : <span style="color:#ae81ff">0</span>
RxByte : 0 RxByte : <span style="color:#ae81ff">0</span>
RxCtrlDrop : 0 RxCtrlDrop : <span style="color:#ae81ff">0</span>
RxIngDrop : 0 RxIngDrop : <span style="color:#ae81ff">0</span>
RxARLDrop : 0 RxARLDrop : <span style="color:#ae81ff">0</span>
pvid: 0 pvid: <span style="color:#ae81ff">0</span>
link: port:7 link:down link: port:7 link:down
VLAN 1: VLAN 1:
vid: 1 vid: <span style="color:#ae81ff">1</span>
ports: 1 2 3 4 6t ports: <span style="color:#ae81ff">1</span> <span style="color:#ae81ff">2</span> <span style="color:#ae81ff">3</span> <span style="color:#ae81ff">4</span> 6t
VLAN 2: VLAN 2:
vid: 2 vid: <span style="color:#ae81ff">2</span>
ports: 0 6t ports: <span style="color:#ae81ff">0</span> 6t
</code></pre> </code></pre></div><p>WTF !?</p>
<p>WTF !?</p>
<p>既然另外幾台都沒有問題,那麼應該就是這台機器的網路孔、或者網路線有問題了!</p> <p>既然另外幾台都沒有問題,那麼應該就是這台機器的網路孔、或者網路線有問題了!</p>
<p>那就換換看網路線吧!</p> <p>那就換換看網路線吧!</p>
<p>果然從原本的 CAT 5E 換成 CAT 6 之後,連線速率就變成 1000 Mb了</p> <p>果然從原本的 CAT 5E 換成 CAT 6 之後,連線速率就變成 1000 Mb了</p>
<p>但是CAT 5E 應該要能支援到1000Mb 才對啊!</p> <p>但是CAT 5E 應該要能支援到1000Mb 才對啊!</p>
<p>所以就是這條 CAT 5E 要不就是偷工減料,要不就是年紀到了,衰退了??</p> <p>所以就是這條 CAT 5E 要不就是偷工減料,要不就是年紀到了,衰退了??</p>
<p>以後還是不要用 CAT 5E 的線了&hellip;</p> <p>以後還是不要用 CAT 5E 的線了&hellip;</p>
<p>這邊太多的古董,總是藏著一些奇奇怪怪的臭蟲 &hellip;.</p> <p>這邊太多的古董,總是藏著一些奇奇怪怪的臭蟲 &hellip;.</p>
<p>同場加映一下 wireguard 連線的速率</p> <p>同場加映一下 wireguard 連線的速率</p>
<p>大概都能跑到200 Mb 左右</p> <p>大概都能跑到200 Mb 左右</p>
<p>比起原本strongswan 打的 IPSEC 只有 30 Mb 左右 ,那是進步太多太多了!</p> <p>比起原本strongswan 打的 IPSEC 只有 30 Mb 左右 ,那是進步太多太多了!</p>
<p>strongswan 的設定又囉唆,該是讓他退場的時候了!</p> <p>strongswan 的設定又囉唆,該是讓他退場的時候了!</p>
<p><img src="https://i.imgur.com/QwQLH2V.png" alt=""></p>
<p><img src="https://i.imgur.com/QwQLH2V.png" alt="" /></p>
</article> </article>
</div> </div>
@ -1055,7 +1018,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -1067,7 +1030,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] WEB 檔案管理 Cloudcmd Web File Manager", "name" : "[筆記] WEB 檔案管理 Cloudcmd Web File Manager",
"headline" : "[筆記] WEB 檔案管理 Cloudcmd Web File Manager", "headline" : "[筆記] WEB 檔案管理 Cloudcmd Web File Manager",
"description" : "\x3cp\x3e最近又接到之前處理過的需求要讓使用者可以在外部上傳、編輯 yaml 檔案\x3c\/p\x3e\n\n\x3cp\x3e之前是用 gohttpd 來做\x3c\/p\x3e\n\n\x3cp\x3e可是不支援線上編輯 yaml 檔案\x3c\/p\x3e", "description" : "\x3cp\x3e最近又接到之前處理過的需求要讓使用者可以在外部上傳、編輯 yaml 檔案\x3c\/p\x3e\n\x3cp\x3e之前是用 gohttpd 來做\x3c\/p\x3e\n\x3cp\x3e可是不支援線上編輯 yaml 檔案\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,57 +305,31 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案</p> <p>最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案</p>
<p>之前是用 gohttpd 來做</p> <p>之前是用 gohttpd 來做</p>
<p>可是不支援線上編輯 yaml 檔案</p> <p>可是不支援線上編輯 yaml 檔案</p>
<p>這次找到了 cloudcmd</p> <p>這次找到了 cloudcmd</p>
<p><a href="https://github.com/coderaiser/cloudcmd">https://github.com/coderaiser/cloudcmd</a></p> <p><a href="https://github.com/coderaiser/cloudcmd">https://github.com/coderaiser/cloudcmd</a></p>
<p>簡單好用、不需要太多設定但是想要的設定大致上也都有、有提供docker-compose</p> <p>簡單好用、不需要太多設定但是想要的設定大致上也都有、有提供docker-compose</p>
<p>同時也支援多種檔案的預覽、編輯功能</p> <p>同時也支援多種檔案的預覽、編輯功能</p>
<p>算是很不錯的一個web-based 的檔案管理系統</p> <p>算是很不錯的一個web-based 的檔案管理系統</p>
<h3 id="登入時會詢問帳號密碼">登入時,會詢問帳號密碼</h3>
<h3 id="登入時-會詢問帳號密碼">登入時,會詢問帳號密碼</h3>
<p>也可以設定成不詢問直接進入</p> <p>也可以設定成不詢問直接進入</p>
<p><img src="https://i.imgur.com/29NVQ66.png" alt="login" title="login_pass"></p>
<p><img src="https://i.imgur.com/29NVQ66.png" alt="login" title="login_pass" /></p>
<h3 id="支援多種檔案的預覽和編輯">支援多種檔案的預覽和編輯</h3> <h3 id="支援多種檔案的預覽和編輯">支援多種檔案的預覽和編輯</h3>
<p>MP4 影片</p> <p>MP4 影片</p>
<p><img src="https://i.imgur.com/9adI50o.png" alt="previer1" title="preview1"></p>
<p><img src="https://i.imgur.com/9adI50o.png" alt="previer1" title="preview1" /></p>
<p>JPG檔案</p> <p>JPG檔案</p>
<p><img src="https://i.imgur.com/ZHQMgI7.png" alt="preview_2" title="preview2"></p>
<p><img src="https://i.imgur.com/ZHQMgI7.png" alt="preview_2" title="preview2" /></p>
<p>CSV 檔案</p> <p>CSV 檔案</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091231-image.png" alt="20210720091231-image.png"></p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091231-image.png" alt="20210720091231-image.png" /></p>
<p>編輯YAML</p> <p>編輯YAML</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091330-image.png" alt="20210720091330-image.png"></p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091330-image.png" alt="20210720091330-image.png" /></p>
<p>空白處按右鍵的功能表</p> <p>空白處按右鍵的功能表</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091445-image.png" alt="20210720091445-image.png"></p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091445-image.png" alt="20210720091445-image.png" /></p>
<p>檔案功能表</p> <p>檔案功能表</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091514-image.png" alt="20210720091514-image.png"></p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091514-image.png" alt="20210720091514-image.png" /></p>
<p>系統功能設定</p> <p>系統功能設定</p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091635-image.png" alt="20210720091635-image.png"></p>
<p><img src="https://raw.githubusercontent.com/changchichung/imagebed/main/20210720091635-image.png" alt="20210720091635-image.png" /></p>
<p>目前用起來感覺還不錯應該會推薦這套上去給老闆決定要不要開給user使用</p> <p>目前用起來感覺還不錯應該會推薦這套上去給老闆決定要不要開給user使用</p>
</article> </article>
</div> </div>
@ -637,7 +607,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -649,7 +619,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 測試mail server 的SSL憑證的指令 Command to test mailserver SSL", "name" : "[筆記] 測試mail server 的SSL憑證的指令 Command to test mailserver SSL",
"headline" : "[筆記] 測試mail server 的SSL憑證的指令 Command to test mailserver SSL", "headline" : "[筆記] 測試mail server 的SSL憑證的指令 Command to test mailserver SSL",
"description" : "\x3cp\x3e今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信\x3c\/p\x3e\n\n\x3cp\x3e然後google 不知道跟人家改了什麼,結果不接受原本的認證了\x26hellip; WTF \x26hellip;.\x3c\/p\x3e\n\n\x3cp\x3e然後這問題應該很久了結果現在才在講 \x26hellip;.\x3c\/p\x3e", "description" : "\x3cp\x3e今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信\x3c\/p\x3e\n\x3cp\x3e然後google 不知道跟人家改了什麼,結果不接受原本的認證了\x26hellip; WTF \x26hellip;.\x3c\/p\x3e\n\x3cp\x3e然後這問題應該很久了結果現在才在講 \x26hellip;.\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -24,7 +24,7 @@
"datePublished": "2019-03-20 11:42:47 \x2b0800 CST", "datePublished": "2019-03-20 11:42:47 \x2b0800 CST",
"dateModified" : "2019-03-20 11:42:47 \x2b0800 CST", "dateModified" : "2019-03-20 11:42:47 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/post\/command_to_test_main_ssl\/", "url" : "https:\/\/h.cowbay.org\/post\/command_to_test_main_ssl\/",
"wordCount" : "665", "wordCount" : "660",
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-10.jpg"", "image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-10.jpg"",
"keywords" : [ "Blog" ] "keywords" : [ "Blog" ]
} }
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -303,24 +299,14 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信</p> <p>今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信</p>
<p>然後google 不知道跟人家改了什麼,結果不接受原本的認證了&hellip; WTF &hellip;.</p> <p>然後google 不知道跟人家改了什麼,結果不接受原本的認證了&hellip; WTF &hellip;.</p>
<p>然後,這問題應該很久了,結果現在才在講 &hellip;.</p> <p>然後,這問題應該很久了,結果現在才在講 &hellip;.</p>
<p>底下都是用linux 主機來進行測試</p> <p>底下都是用linux 主機來進行測試</p>
<p>windows環境應該也可以只是要自己去安裝 openssl 軟體</p> <p>windows環境應該也可以只是要自己去安裝 openssl 軟體</p>
<p>To verify SSL, connect to any Linux server via SSH and use the instructions below:</p> <p>To verify SSL, connect to any Linux server via SSH and use the instructions below:</p>
<p><strong>測試 SSL-IMAP 993 port</strong></p> <p><strong>測試 SSL-IMAP 993 port</strong></p>
<pre><code>openssl s_client -showcerts -connect mail.example.com:993 <pre><code>openssl s_client -showcerts -connect mail.example.com:993
</code></pre> </code></pre><p>結果應該會像是這樣</p>
<p>結果應該會像是這樣</p>
<pre><code>2019-03-20 11:21:02 [changch@hqdc034 ~]$ openssl s_client -showcerts -connect mail.abc.com:993 <pre><code>2019-03-20 11:21:02 [changch@hqdc034 ~]$ openssl s_client -showcerts -connect mail.abc.com:993
CONNECTED(00000003) CONNECTED(00000003)
depth=0 C = TW, ST = Taipei, L = Taipei, O = iredmail02.abc.com, OU = IT, CN = iredmail02.abc.com, emailAddress = root@iredmail02.abc.com depth=0 C = TW, ST = Taipei, L = Taipei, O = iredmail02.abc.com, OU = IT, CN = iredmail02.abc.com, emailAddress = root@iredmail02.abc.com
@ -401,16 +387,10 @@ SSL-Session:
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot (Ubuntu) ready. * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot (Ubuntu) ready.
2019-03-20 11:21:47 [changch@hqdc034 ~]$ 2019-03-20 11:21:47 [changch@hqdc034 ~]$
</code></pre> </code></pre><p><strong>測試SMTP TLS 587 port</strong></p>
<p><strong>測試SMTP TLS 587 port</strong></p>
<pre><code>openssl s_client -starttls smtp -showcerts -connect mail.example.com:587 <pre><code>openssl s_client -starttls smtp -showcerts -connect mail.example.com:587
</code></pre> </code></pre><p>指令有點不同,要加上 startls smtp 的參數
<p>指令有點不同,要加上 startls smtp 的參數
回應應該會是這樣</p> 回應應該會是這樣</p>
<pre><code>2019-03-20 11:50:48 [changch@hqdc034 ~]$ openssl s_client -starttls smtp -showcerts -connect mail.abc.com:587 <pre><code>2019-03-20 11:50:48 [changch@hqdc034 ~]$ openssl s_client -starttls smtp -showcerts -connect mail.abc.com:587
CONNECTED(00000003) CONNECTED(00000003)
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3 depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
@ -510,14 +490,10 @@ SSL-Session:
--- ---
250 DSN 250 DSN
</code></pre> </code></pre><p><strong>測試 SMTP SSL port 465</strong>
指令</p>
<p><strong>測試 SMTP SSL port 465</strong> <!-- raw HTML omitted -->
指令 <!-- raw HTML omitted -->
<pre>
openssl s_client -showcerts -connect mail.example.com:465
</pre></p>
<p>不過因為我沒開這個port ,所以就不測試了</p> <p>不過因為我沒開這個port ,所以就不測試了</p>
</article> </article>
</div> </div>
@ -790,7 +766,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -802,7 +778,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 設定ubuntu 18.04 的NetworkManager config 不要更改 \/etc\/resolv.conf", "name" : "[筆記] 設定ubuntu 18.04 的NetworkManager config 不要更改 \/etc\/resolv.conf",
"headline" : "[筆記] 設定ubuntu 18.04 的NetworkManager config 不要更改 \/etc\/resolv.conf", "headline" : "[筆記] 設定ubuntu 18.04 的NetworkManager config 不要更改 \/etc\/resolv.conf",
"description" : "\x3cp\x3eubuntu 18.04 的 DNS 設定很煩\x3c\/p\x3e\n\n\x3cp\x3e系統預設會用NetworkManager 去管理\x3c\/p\x3e\n\n\x3cp\x3e然後NetworkManager 又很「靈活」的許多種修改 \/etc\/resolv.conf 的方式\x3c\/p\x3e\n\n\x3cp\x3e之前都是很粗暴的停用 NetworkManager\x3c\/p\x3e\n\n\x3cp\x3e但是用筆電的user 又需要用 NetworkManager 來管理無線網路\x3c\/p\x3e\n\n\x3cp\x3e今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 \/etc\/resolv.conf\x3c\/p\x3e", "description" : "\x3cp\x3eubuntu 18.04 的 DNS 設定很煩\x3c\/p\x3e\n\x3cp\x3e系統預設會用NetworkManager 去管理\x3c\/p\x3e\n\x3cp\x3e然後NetworkManager 又很「靈活」的許多種修改 \/etc\/resolv.conf 的方式\x3c\/p\x3e\n\x3cp\x3e之前都是很粗暴的停用 NetworkManager\x3c\/p\x3e\n\x3cp\x3e但是用筆電的user 又需要用 NetworkManager 來管理無線網路\x3c\/p\x3e\n\x3cp\x3e今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 \/etc\/resolv.conf\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,25 +305,15 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>ubuntu 18.04 的 DNS 設定很煩</p> <p>ubuntu 18.04 的 DNS 設定很煩</p>
<p>系統預設會用NetworkManager 去管理</p> <p>系統預設會用NetworkManager 去管理</p>
<p>然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式</p> <p>然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式</p>
<p>之前都是很粗暴的停用 NetworkManager</p> <p>之前都是很粗暴的停用 NetworkManager</p>
<p>但是用筆電的user 又需要用 NetworkManager 來管理無線網路</p> <p>但是用筆電的user 又需要用 NetworkManager 來管理無線網路</p>
<p>今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf</p> <p>今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf</p>
<p>主要參考這篇文件</p> <p>主要參考這篇文件</p>
<p><a href="https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html">https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html</a></p> <p><a href="https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html">https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html</a></p>
<p>看一下 dns/rc-manager 這兩個部份</p> <p>看一下 dns/rc-manager 這兩個部份</p>
<p>然後修改 /etc/NetworkManager/NetworkManager.conf</p> <p>然後修改 /etc/NetworkManager/NetworkManager.conf</p>
<pre><code>[main] <pre><code>[main]
plugins=ifupdown,keyfile plugins=ifupdown,keyfile
dns=none dns=none
@ -338,28 +324,17 @@ managed=false
[device] [device]
wifi.scan-rand-mac-address=no wifi.scan-rand-mac-address=no
</code></pre> </code></pre><p>主要就加入第三行和第四行</p>
<p>主要就加入第三行和第四行</p>
<p>接著安裝 resolvconf 這個套件</p> <p>接著安裝 resolvconf 這個套件</p>
<pre><code>sudo apt install resolvconf <pre><code>sudo apt install resolvconf
</code></pre> </code></pre><p>修改resolvconf 的config</p>
<p>修改resolvconf 的config</p>
<pre><code>sudo vim /etc/resolvconf/resolv.conf.d/head <pre><code>sudo vim /etc/resolvconf/resolv.conf.d/head
加入以下內容 加入以下內容
nameserver 168.95.1.1 nameserver 168.95.1.1
nameserver 8.8.8.8 nameserver 8.8.8.8
</code></pre> </code></pre><p>然後重新啟動 NetworkManager 還有 resolvconf 或者重新開機</p>
<p>然後重新啟動 NetworkManager 還有 resolvconf 或者重新開機</p>
<p>就可以用 resolvconf 來管理 /etc/resolv.conf</p> <p>就可以用 resolvconf 來管理 /etc/resolv.conf</p>
<p>不會再發生DNS 被改成 127.0.0.53 這種怪東西了</p> <p>不會再發生DNS 被改成 127.0.0.53 這種怪東西了</p>
</article> </article>
</div> </div>
@ -639,7 +614,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -651,7 +626,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "PostgreSQL 直接從已經存在的使用者複製權限到另一個使用者", "name" : "PostgreSQL 直接從已經存在的使用者複製權限到另一個使用者",
"headline" : "PostgreSQL 直接從已經存在的使用者複製權限到另一個使用者", "headline" : "PostgreSQL 直接從已經存在的使用者複製權限到另一個使用者",
"description" : "\x3cp\x3e因為工作上的需求有個資料庫需要開放給不同team的人去存取\x3c\/p\x3e\n\n\x3cp\x3e雖然都是在同一台機器上的同一個資料庫\x3c\/p\x3e\n\n\x3cp\x3e但是希望能夠不同team的人用不同的資料庫使用者\x3c\/p\x3e\n\n\x3cp\x3e這樣萬一出事會比較好抓兇手\x3c\/p\x3e", "description" : "\x3cp\x3e因為工作上的需求有個資料庫需要開放給不同team的人去存取\x3c\/p\x3e\n\x3cp\x3e雖然都是在同一台機器上的同一個資料庫\x3c\/p\x3e\n\x3cp\x3e但是希望能夠不同team的人用不同的資料庫使用者\x3c\/p\x3e\n\x3cp\x3e這樣萬一出事會比較好抓兇手\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,27 +305,16 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>因為工作上的需求有個資料庫需要開放給不同team的人去存取</p> <p>因為工作上的需求有個資料庫需要開放給不同team的人去存取</p>
<p>雖然都是在同一台機器上的同一個資料庫</p> <p>雖然都是在同一台機器上的同一個資料庫</p>
<p>但是希望能夠不同team的人用不同的資料庫使用者</p> <p>但是希望能夠不同team的人用不同的資料庫使用者</p>
<p>這樣萬一出事,會比較好抓兇手??</p> <p>這樣萬一出事,會比較好抓兇手??</p>
<p>總之呢,這個需求一直反覆出現</p> <p>總之呢,這個需求一直反覆出現</p>
<p>每次開發不同的AP就要求一個不同的代號實在有點煩</p> <p>每次開發不同的AP就要求一個不同的代號實在有點煩</p>
<p>之前都是用pgadmin來處理現在就改用psql來弄</p> <p>之前都是用pgadmin來處理現在就改用psql來弄</p>
<p>其實也很簡單</p> <p>其實也很簡單</p>
<pre><code>CREATE ROLE b LOGIN; <pre><code>CREATE ROLE b LOGIN;
GRANT a TO b; GRANT a TO b;
</code></pre> </code></pre><p>可以帶入script 用script 或者用ansible去跑就好了</p>
<p>可以帶入script 用script 或者用ansible去跑就好了</p>
<p>省得每次都要在那邊手動改來改去..</p> <p>省得每次都要在那邊手動改來改去..</p>
</article> </article>
</div> </div>
@ -607,7 +592,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -619,7 +604,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 建立一個帶著走的 VIM 環境 Creating portable Vim environment", "name" : "[筆記] 建立一個帶著走的 VIM 環境 Creating portable Vim environment",
"headline" : "[筆記] 建立一個帶著走的 VIM 環境 Creating portable Vim environment", "headline" : "[筆記] 建立一個帶著走的 VIM 環境 Creating portable Vim environment",
"description" : "\x3cp\x3e因為工作的關係現在很多時間都花在VIM的操作上\x3c\/p\x3e\n\n\x3cp\x3e所以之前花了滿多時間調整出一個適合自己的VIM環境\x3c\/p\x3e\n\n\x3cp\x3e原本的作法是把這個設定好的環境丟到自己建立的gitea 上面\x3c\/p\x3e\n\n\x3cp\x3e然後每到一台新的機器就要去clone 下來\x3c\/p\x3e", "description" : "\x3cp\x3e因為工作的關係現在很多時間都花在VIM的操作上\x3c\/p\x3e\n\x3cp\x3e所以之前花了滿多時間調整出一個適合自己的VIM環境\x3c\/p\x3e\n\x3cp\x3e原本的作法是把這個設定好的環境丟到自己建立的gitea 上面\x3c\/p\x3e\n\x3cp\x3e然後每到一台新的機器就要去clone 下來\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,42 +305,23 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>因為工作的關係現在很多時間都花在VIM的操作上</p> <p>因為工作的關係現在很多時間都花在VIM的操作上</p>
<p>所以之前花了滿多時間調整出一個適合自己的VIM環境</p> <p>所以之前花了滿多時間調整出一個適合自己的VIM環境</p>
<p>原本的作法是把這個設定好的環境丟到自己建立的gitea 上面</p> <p>原本的作法是把這個設定好的環境丟到自己建立的gitea 上面</p>
<p>然後每到一台新的機器就要去clone 下來</p> <p>然後每到一台新的機器就要去clone 下來</p>
<p>BUT (對就是這個BUT)</p> <p>BUT (對就是這個BUT)</p>
<p>手邊的機器有滿多不能直接連接internet的(酷吧都什麼年代了還鎖internet)</p> <p>手邊的機器有滿多不能直接連接internet的(酷吧都什麼年代了還鎖internet)</p>
<p>所以常會碰到要做git clone 不能動,還要額外去指定 proxy server 這些設定,挺麻煩的</p> <p>所以常會碰到要做git clone 不能動,還要額外去指定 proxy server 這些設定,挺麻煩的</p>
<p>今天剛好看到這個</p> <p>今天剛好看到這個</p>
<p><a href="https://junegunn.kr/2014/10/creating-portable-vim-environment">https://junegunn.kr/2014/10/creating-portable-vim-environment</a></p> <p><a href="https://junegunn.kr/2014/10/creating-portable-vim-environment">https://junegunn.kr/2014/10/creating-portable-vim-environment</a></p>
<p>裡面介紹的小程式可以把現在使用的vim 環境,打包成一個持行檔</p> <p>裡面介紹的小程式可以把現在使用的vim 環境,打包成一個持行檔</p>
<p>那只要把這個執行檔丟到要控制的機器</p> <p>那只要把這個執行檔丟到要控制的機器</p>
<p>那麼每一台機器都會有相同的vim 環境</p> <p>那麼每一台機器都會有相同的vim 環境</p>
<p>比起之前要先git clone 然後 plugininstall 的作法要更方便許多,而且操作很簡單</p> <p>比起之前要先git clone 然後 plugininstall 的作法要更方便許多,而且操作很簡單</p>
<p>只要先抓下來那個檔案並且執行</p> <p>只要先抓下來那個檔案並且執行</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">bash &lt;<span style="color:#f92672">(</span>curl -L https://raw.githubusercontent.com/junegunn/myvim/master/myvim<span style="color:#f92672">)</span>
<pre><code class="language-shell">bash &lt;(curl -L https://raw.githubusercontent.com/junegunn/myvim/master/myvim) </code></pre></div><p>就會在執行的目錄底下產生一個 vim.$(whoami) 的執行檔</p>
</code></pre>
<p>就會在執行的目錄底下產生一個 vim.$(whoami) 的執行檔</p>
<p>這個就是可以帶著走的 vim環境</p> <p>這個就是可以帶著走的 vim環境</p>
<p>然後就把這個檔案丟到看哪一台server上然後在其他機器上面去下載回來</p> <p>然後就把這個檔案丟到看哪一台server上然後在其他機器上面去下載回來</p>
<p>就可以有完全一樣的 vim 環境了,超級方便的!</p> <p>就可以有完全一樣的 vim 環境了,超級方便的!</p>
</article> </article>
</div> </div>
@ -620,7 +597,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -632,7 +609,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] Debian Buster 伺服器被入侵了!\/ Debian Buster Server Been Hacked", "name" : "[筆記] Debian Buster 伺服器被入侵了!\/ Debian Buster Server Been Hacked",
"headline" : "[筆記] Debian Buster 伺服器被入侵了!\/ Debian Buster Server Been Hacked", "headline" : "[筆記] Debian Buster 伺服器被入侵了!\/ Debian Buster Server Been Hacked",
"description" : "\x3cp\x3e上禮拜某天在開會的時候LINE不斷傳來訊息\x3c\/p\x3e\n\n\x3cp\x3e不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了\x3c\/p\x3e\n\n\x3cp\x3e看來大概有啥事發生\x3c\/p\x3e\n\n\x3cp\x3e不過畢竟不是正職的工作就先放著吧\x3c\/p\x3e\n\n\x3cp\x3e後來變成連學長都直接打來告訴我某間公司的伺服器出事了客戶找不到我\x3c\/p\x3e\n\n\x3cp\x3e叫我趕快連進去看\x3c\/p\x3e\n\n\x3cp\x3e是說啊我又沒跟人家簽維護趕什麼趕\x26hellip;\x3c\/p\x3e\n\n\x3cp\x3e總之開完會後就了解一下狀況\x3c\/p\x3e", "description" : "\x3cp\x3e上禮拜某天在開會的時候LINE不斷傳來訊息\x3c\/p\x3e\n\x3cp\x3e不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了\x3c\/p\x3e\n\x3cp\x3e看來大概有啥事發生\x3c\/p\x3e\n\x3cp\x3e不過畢竟不是正職的工作就先放著吧\x3c\/p\x3e\n\x3cp\x3e後來變成連學長都直接打來告訴我某間公司的伺服器出事了客戶找不到我\x3c\/p\x3e\n\x3cp\x3e叫我趕快連進去看\x3c\/p\x3e\n\x3cp\x3e是說啊我又沒跟人家簽維護趕什麼趕\x26hellip;\x3c\/p\x3e\n\x3cp\x3e總之開完會後就了解一下狀況\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,46 +305,26 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>上禮拜某天在開會的時候LINE不斷傳來訊息</p> <p>上禮拜某天在開會的時候LINE不斷傳來訊息</p>
<p>不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了</p> <p>不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了</p>
<p>看來大概有啥事發生</p> <p>看來大概有啥事發生</p>
<p>不過畢竟不是正職的工作,就先放著吧</p> <p>不過畢竟不是正職的工作,就先放著吧</p>
<p>後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我</p> <p>後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我</p>
<p>叫我趕快連進去看</p> <p>叫我趕快連進去看</p>
<p>是說,啊我又沒跟人家簽維護,趕什麼趕&hellip;</p> <p>是說,啊我又沒跟人家簽維護,趕什麼趕&hellip;</p>
<p>總之,開完會後就了解一下狀況</p> <p>總之,開完會後就了解一下狀況</p>
<p>了解狀況後(user 也只說不能連線..WTF),還是直接連進去看伺服器啥問題好了</p> <p>了解狀況後(user 也只說不能連線..WTF),還是直接連進去看伺服器啥問題好了</p>
<p>連線的過程就發現,主機回應有點慢</p> <p>連線的過程就發現,主機回應有點慢</p>
<p>不過還是可以連上檢查一下ps / netstat 等等訊息,感覺就是有哪裡怪怪的</p> <p>不過還是可以連上檢查一下ps / netstat 等等訊息,感覺就是有哪裡怪怪的</p>
<p>進去etc 看一下,一下 ls -lart 就發現不對,畫面整個跑掉</p> <p>進去etc 看一下,一下 ls -lart 就發現不對,畫面整個跑掉</p>
<p>感覺就多了很多檔案</p> <p>感覺就多了很多檔案</p>
<p>所以先裝個file manager 來看(這樣才能避免ls 被駭客調包的情況)</p> <p>所以先裝個file manager 來看(這樣才能避免ls 被駭客調包的情況)</p>
<p>總之就發現了一些不正常的檔案</p> <p>總之就發現了一些不正常的檔案</p>
<p>/etc/.sh 等等族繁不及備載</p> <p>/etc/.sh 等等族繁不及備載</p>
<p>於是先去FW 把這台機器對外開放的port 先關掉</p> <p>於是先去FW 把這台機器對外開放的port 先關掉</p>
<p>然後開始紀錄邊清</p> <p>然後開始紀錄邊清</p>
<p>底下是一些記錄下來的log 很亂,因為是邊清邊紀錄的關係</p> <p>底下是一些記錄下來的log 很亂,因為是邊清邊紀錄的關係</p>
<p>這是在某個特定日期時間被產生出來的檔案</p> <p>這是在某個特定日期時間被產生出來的檔案</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">/etc/allow.bak
<pre><code class="language-bash">/etc/allow.bak
/etc/deny.bak /etc/deny.bak
/etc/fstab /etc/fstab
/etc/sysctl.conf /etc/sysctl.conf
@ -383,38 +359,26 @@ if (!doNotTrack) {
/var/log/apt/history.log.1.gz /var/log/apt/history.log.1.gz
/usr/lib/systemd /usr/lib/systemd
/usr/lib/mysql/mysql /usr/lib/mysql/mysql
</code></pre> </code></pre></div><p>/etc/.supervisor/conf.d/sh.conf</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash"><span style="color:#f92672">[</span>program:.sh<span style="color:#f92672">]</span>
<p>/etc/.supervisor/conf.d/sh.conf</p> directory<span style="color:#f92672">=</span>/etc/
command<span style="color:#f92672">=</span>/bin/bash -c <span style="color:#e6db74">&#39;cp -f -r -- /etc/spts /bin/.sh 2&gt;/dev/null &amp;&amp; /bin/.sh -c &gt;/dev/null 2&gt;&amp;1 &amp;&amp; rm -rf -- /bin/.sh 2&gt;/dev/null&#39;</span>
<pre><code class="language-bash">[program:.sh] autostart<span style="color:#f92672">=</span>true
directory=/etc/ autorestart<span style="color:#f92672">=</span>true
command=/bin/bash -c 'cp -f -r -- /etc/spts /bin/.sh 2&gt;/dev/null &amp;&amp; /bin/.sh -c &gt;/dev/null 2&gt;&amp;1 &amp;&amp; rm -rf -- /bin/.sh 2&gt;/dev/null' startretries<span style="color:#f92672">=</span><span style="color:#ae81ff">999999999</span>
autostart=true redirect_stderr<span style="color:#f92672">=</span>true
autorestart=true pidfile<span style="color:#f92672">=</span>/etc/psdewo.pid
startretries=999999999 stdout_logfile<span style="color:#f92672">=</span>/etc/usercenter_stdout
redirect_stderr=true </code></pre></div><p>php.sh 這個忘了是在crontab 還是/etc/profile.d/底下看到的</p>
pidfile=/etc/psdewo.pid
stdout_logfile=/etc/usercenter_stdout
</code></pre>
<p>php.sh 這個忘了是在crontab 還是/etc/profile.d/底下看到的</p>
<pre><code>#!/bin/bash <pre><code>#!/bin/bash
cp -f -r -- /bin/shh /bin/.sh 2&gt;/dev/null cp -f -r -- /bin/shh /bin/.sh 2&gt;/dev/null
/bin/.sh -c &gt;/dev/null 2&gt;&amp;1 /bin/.sh -c &gt;/dev/null 2&gt;&amp;1
rm -rf -- .sh 2&gt;/dev/null rm -rf -- .sh 2&gt;/dev/null
</code></pre> </code></pre><p>supervisor.sh</p>
<p>supervisor.sh</p>
<pre><code>#!/bin/bash <pre><code>#!/bin/bash
supervisord -c /etc/.supervisor/supervisord.conf &gt;/dev/null 2&gt;&amp;1 supervisord -c /etc/.supervisor/supervisord.conf &gt;/dev/null 2&gt;&amp;1
supervisorctl reload &gt;/dev/null 2&gt;&amp;1 supervisorctl reload &gt;/dev/null 2&gt;&amp;1
</code></pre> </code></pre><p>某個 service 檔案</p>
<p>某個 service 檔案</p>
<pre><code>[Unit] <pre><code>[Unit]
Description=.sh Description=.sh
@ -429,10 +393,7 @@ KillMode=process
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
</code></pre> </code></pre><p>syslog 部份內容</p>
<p>syslog 部份內容</p>
<pre><code>Jul 7 06:20:01 pve CRON[12502]: (root) CMD (/sbin/httpss) <pre><code>Jul 7 06:20:01 pve CRON[12502]: (root) CMD (/sbin/httpss)
Jul 7 06:20:01 pve CRON[12499]: (root) CMD ( echo /usr/local/lib/libprocesshider.so &gt; /etc/ld.so.preload &amp;&amp; lockr +i /etc/ld.so.preload &gt;/dev/null 2&gt;&amp;1) Jul 7 06:20:01 pve CRON[12499]: (root) CMD ( echo /usr/local/lib/libprocesshider.so &gt; /etc/ld.so.preload &amp;&amp; lockr +i /etc/ld.so.preload &gt;/dev/null 2&gt;&amp;1)
Jul 7 06:21:01 pve CRON[14096]: (root) CMD (/usr/lib/mysql/mysql) Jul 7 06:21:01 pve CRON[14096]: (root) CMD (/usr/lib/mysql/mysql)
@ -451,18 +412,11 @@ Jul 7 06:25:01 pve CRON[21289]: (root) CMD ( cp -f -r -- /etc/.sh /tmp/.sh 2&gt
Jul 7 06:25:01 pve CRON[21290]: (root) CMD (/usr/lib/mysql/mysql) Jul 7 06:25:01 pve CRON[21290]: (root) CMD (/usr/lib/mysql/mysql)
Jul 7 06:25:01 pve CRON[21288]: (root) CMD (test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.daily )) Jul 7 06:25:01 pve CRON[21288]: (root) CMD (test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.daily ))
Jul 7 06:25:01 pve CRON[21291]: (root) CMD ( echo /usr/local/lib/libprocesshider.so &gt; /etc/ld.so.preload &amp;&amp; lockr +i /etc/ld.so.preload &gt;/dev/null 2&gt;&amp;1) Jul 7 06:25:01 pve CRON[21291]: (root) CMD ( echo /usr/local/lib/libprocesshider.so &gt; /etc/ld.so.preload &amp;&amp; lockr +i /etc/ld.so.preload &gt;/dev/null 2&gt;&amp;1)
</code></pre> </code></pre><p>比較特別的是,他會去修改 /etc/fstab 載入一個 swapfile</p>
<p>比較特別的是,他會去修改 /etc/fstab 載入一個 swapfile</p>
<p>WTF 沒事載入自己的 fstab 做啥??</p> <p>WTF 沒事載入自己的 fstab 做啥??</p>
<p>然後還會在系統建立user 可以看一下 /etc/passwd , /etc/group , /etc/gshadow 這些檔案檢查</p> <p>然後還會在系統建立user 可以看一下 /etc/passwd , /etc/group , /etc/gshadow 這些檔案檢查</p>
<p>手邊最好有另一臺乾淨的同樣作業系統的機器</p> <p>手邊最好有另一臺乾淨的同樣作業系統的機器</p>
<p>因為有很多系統指令已經被替換掉(netstat/ss/lsof 等等)</p> <p>因為有很多系統指令已經被替換掉(netstat/ss/lsof 等等)</p>
<p>需要從乾淨的系統弄過來或者是重新從apt 安裝回來</p> <p>需要從乾淨的系統弄過來或者是重新從apt 安裝回來</p>
</article> </article>
</div> </div>
@ -738,7 +692,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -750,7 +704,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在gcp 中用wireguard建立VPN時不要用 10.0.0.0\/16 網段\/Do No Use 10 0 0 0 Private Ipaddr in GCP", "name" : "[筆記] 在gcp 中用wireguard建立VPN時不要用 10.0.0.0\/16 網段\/Do No Use 10 0 0 0 Private Ipaddr in GCP",
"headline" : "[筆記] 在gcp 中用wireguard建立VPN時不要用 10.0.0.0\/16 網段\/Do No Use 10 0 0 0 Private Ipaddr in GCP", "headline" : "[筆記] 在gcp 中用wireguard建立VPN時不要用 10.0.0.0\/16 網段\/Do No Use 10 0 0 0 Private Ipaddr in GCP",
"description" : "\x3cp\x3e最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立\x3c\/p\x3e\n\n\x3cp\x3e想說再打個VPN tunnel 來當跳板連 ptt 好了\x3c\/p\x3e\n\n\x3cp\x3e因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境\x3c\/p\x3e\n\n\x3cp\x3e本來是在vultr 的VPS上面建立這個tunnel\x3c\/p\x3e\n\n\x3cp\x3e但是那台VPS連去ptt 很頓,卡卡的\x3c\/p\x3e\n\n\x3cp\x3e所以改用google cloud platform 的free tier 來做\x3c\/p\x3e\n\n\x3cp\x3e反正只是拿來當跳板不會有什麼流量、運算產生可以一直保持免費的狀態\x3c\/p\x3e", "description" : "\x3cp\x3e最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立\x3c\/p\x3e\n\x3cp\x3e想說再打個VPN tunnel 來當跳板連 ptt 好了\x3c\/p\x3e\n\x3cp\x3e因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境\x3c\/p\x3e\n\x3cp\x3e本來是在vultr 的VPS上面建立這個tunnel\x3c\/p\x3e\n\x3cp\x3e但是那台VPS連去ptt 很頓,卡卡的\x3c\/p\x3e\n\x3cp\x3e所以改用google cloud platform 的free tier 來做\x3c\/p\x3e\n\x3cp\x3e反正只是拿來當跳板不會有什麼流量、運算產生可以一直保持免費的狀態\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,41 +305,23 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立</p> <p>最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立</p>
<p>想說再打個VPN tunnel 來當跳板連 ptt 好了</p> <p>想說再打個VPN tunnel 來當跳板連 ptt 好了</p>
<p>因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境</p> <p>因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境</p>
<p>本來是在vultr 的VPS上面建立這個tunnel</p> <p>本來是在vultr 的VPS上面建立這個tunnel</p>
<p>但是那台VPS連去ptt 很頓,卡卡的</p> <p>但是那台VPS連去ptt 很頓,卡卡的</p>
<p>所以改用google cloud platform 的free tier 來做</p> <p>所以改用google cloud platform 的free tier 來做</p>
<p>反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態</p> <p>反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態</p>
<p>GCP的申請、設定就不多說了</p> <p>GCP的申請、設定就不多說了</p>
<p>這次碰到的怪異現象是當wireguard 都已經設定好client 也都連上了之後</p> <p>這次碰到的怪異現象是當wireguard 都已經設定好client 也都連上了之後</p>
<p>會發生client 開不了 <a href="http://www.google.com.tw">www.google.com.tw</a> / youtube / google map 等等google 服務的狀況</p>
<p>會發生client 開不了 www.google.com.tw / youtube / google map 等等google 服務的狀況</p>
<p>VPN確定是通的我可以在client 這邊連上其他網站但就是google的服務開不了</p> <p>VPN確定是通的我可以在client 這邊連上其他網站但就是google的服務開不了</p>
<p>後來不知道是怎麼樣突然靈機一動因為一開始設定server/peer 都是用 10.0.0.x/24 的IP</p> <p>後來不知道是怎麼樣突然靈機一動因為一開始設定server/peer 都是用 10.0.0.x/24 的IP</p>
<p>想說會不會是因為這個也是google cloud platform 預設的LAN IP 網段,所以沒辦法繞出去</p> <p>想說會不會是因為這個也是google cloud platform 預設的LAN IP 網段,所以沒辦法繞出去</p>
<p>看一下設定,確認一下這個想法對不對,果然是這樣沒錯</p> <p>看一下設定,確認一下這個想法對不對,果然是這樣沒錯</p>
<p><img src="https://i.imgur.com/XkrH4Pa.png" alt=""></p>
<p><img src="https://i.imgur.com/XkrH4Pa.png" alt="" /></p>
<p>解決方法很簡單要不修改VPS的內部IP要不修改wireguard的設定</p> <p>解決方法很簡單要不修改VPS的內部IP要不修改wireguard的設定</p>
<p>當然我是選擇改wireguard ,因為簡單嘛!</p> <p>當然我是選擇改wireguard ,因為簡單嘛!</p>
<p>修改後的configuration 長這樣</p> <p>修改後的configuration 長這樣</p>
<pre><code>[Interface] <pre><code>[Interface]
Address = 192.168.10.1/24 Address = 192.168.10.1/24
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens4 -j MASQUERADE PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens4 -j MASQUERADE
@ -365,14 +343,9 @@ AllowedIPs = 192.168.10.3/32
[Peer] [Peer]
PublicKey = 2.........................................2 PublicKey = 2.........................................2
AllowedIPs = 192.168.10.4/32 AllowedIPs = 192.168.10.4/32
</code></pre> </code></pre><p>重起wireguard (或者說重起 wg0 這個interface)之後client 開google 網頁就正常了</p>
<p>重起wireguard (或者說重起 wg0 這個interface)之後client 開google 網頁就正常了</p>
<p>client 這邊也是簡單設定一下把要透過跳板出去的IP 改走wireguard 出去</p> <p>client 這邊也是簡單設定一下把要透過跳板出去的IP 改走wireguard 出去</p>
<p>底下這個,就是把往台大(140.112.0.0) 和 term.ptt.cc(104.31.0.0)的封包改走wireguard</p> <p>底下這個,就是把往台大(140.112.0.0) 和 term.ptt.cc(104.31.0.0)的封包改走wireguard</p>
<pre><code>[Interface] <pre><code>[Interface]
PrivateKey = e............................e PrivateKey = e............................e
Address = 192.168.10.2/24 Address = 192.168.10.2/24
@ -384,10 +357,7 @@ PublicKey = q...........................q
Endpoint = public_ip_of_gcp:12000 Endpoint = public_ip_of_gcp:12000
AllowedIPs = 140.112.0.0/16,104.31.0.0/16,192.168.10.1/32 AllowedIPs = 140.112.0.0/16,104.31.0.0/16,192.168.10.1/32
PersistentKeepalive = 25 PersistentKeepalive = 25
</code></pre> </code></pre><p>然後看一下路由對不對</p>
<p>然後看一下路由對不對</p>
<pre><code>2019-08-16 10:34:21 [cch@hq34 ~]$ traceroute term.ptt.cc <pre><code>2019-08-16 10:34:21 [cch@hq34 ~]$ traceroute term.ptt.cc
traceroute to term.ptt.cc (104.31.231.9), 30 hops max, 60 byte packets traceroute to term.ptt.cc (104.31.231.9), 30 hops max, 60 byte packets
1 192.168.10.1 (192.168.10.1) 191.826 ms 192.556 ms 192.678 ms 1 192.168.10.1 (192.168.10.1) 191.826 ms 192.556 ms 192.678 ms
@ -396,9 +366,7 @@ traceroute to term.ptt.cc (104.31.231.9), 30 hops max, 60 byte packets
4 * * * 4 * * *
5 104.31.231.9 (104.31.231.9) 203.918 ms 203.982 ms 203.979 ms 5 104.31.231.9 (104.31.231.9) 203.918 ms 203.982 ms 203.979 ms
2019-08-16 10:34:33 [cch@hq34 ~]$ 2019-08-16 10:34:33 [cch@hq34 ~]$
</code></pre> </code></pre><p>果然是走wireguard (192.168.10.1) 出去 ,跳板成功!</p>
<p>果然是走wireguard (192.168.10.1) 出去 ,跳板成功!</p>
</article> </article>
</div> </div>
@ -675,7 +643,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -687,7 +655,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "筆記- 啟用群暉NAS (Synology NAS)的SSH Server 透過Publickey 認證免密碼登入", "name" : "筆記- 啟用群暉NAS (Synology NAS)的SSH Server 透過Publickey 認證免密碼登入",
"headline" : "筆記- 啟用群暉NAS (Synology NAS)的SSH Server 透過Publickey 認證免密碼登入", "headline" : "筆記- 啟用群暉NAS (Synology NAS)的SSH Server 透過Publickey 認證免密碼登入",
"description" : "\x3cp\x3e公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file\n之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來\x3c\/p\x3e\n\n\x3cp\x3e這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體\n像是這篇\x3c\/p\x3e\n\n\x3cp\x3e\x3ca href=\x22https:\/\/www.omgubuntu.co.uk\/2017\/04\/mount-google-drive-ocamlfuse-linux\x22\x3ehttps:\/\/www.omgubuntu.co.uk\/2017\/04\/mount-google-drive-ocamlfuse-linux\x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e或者是這篇\x3c\/p\x3e\n\n\x3cp\x3e\x3ca href=\x22https:\/\/www.maketecheasier.com\/mount-google-drive-ubuntu\/\x22\x3ehttps:\/\/www.maketecheasier.com\/mount-google-drive-ubuntu\/\x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e但是手邊的伺服器原則上除非有必要不然都沒有開放internet\n所以導致明明檔案就在那邊但是要取得就是很麻煩\x3c\/p\x3e", "description" : "\x3cp\x3e公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file\n之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來\x3c\/p\x3e\n\x3cp\x3e這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體\n像是這篇\x3c\/p\x3e\n\x3cp\x3e\x3ca href=\x22https:\/\/www.omgubuntu.co.uk\/2017\/04\/mount-google-drive-ocamlfuse-linux\x22\x3ehttps:\/\/www.omgubuntu.co.uk\/2017\/04\/mount-google-drive-ocamlfuse-linux\x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e或者是這篇\x3c\/p\x3e\n\x3cp\x3e\x3ca href=\x22https:\/\/www.maketecheasier.com\/mount-google-drive-ubuntu\/\x22\x3ehttps:\/\/www.maketecheasier.com\/mount-google-drive-ubuntu\/\x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e但是手邊的伺服器原則上除非有必要不然都沒有開放internet\n所以導致明明檔案就在那邊但是要取得就是很麻煩\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -310,109 +306,60 @@ if (!doNotTrack) {
<article> <article>
<p>公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file <p>公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file
之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來</p> 之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來</p>
<p>這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體 <p>這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體
像是這篇</p> 像是這篇</p>
<p><a href="https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux">https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux</a></p> <p><a href="https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux">https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux</a></p>
<p>或者是這篇</p> <p>或者是這篇</p>
<p><a href="https://www.maketecheasier.com/mount-google-drive-ubuntu/">https://www.maketecheasier.com/mount-google-drive-ubuntu/</a></p> <p><a href="https://www.maketecheasier.com/mount-google-drive-ubuntu/">https://www.maketecheasier.com/mount-google-drive-ubuntu/</a></p>
<p>但是手邊的伺服器原則上除非有必要不然都沒有開放internet <p>但是手邊的伺服器原則上除非有必要不然都沒有開放internet
所以導致明明檔案就在那邊,但是要取得就是很麻煩</p> 所以導致明明檔案就在那邊,但是要取得就是很麻煩</p>
<p>Dev_A upload to google drive &mdash;&gt; Dev_B Download from google drive &mdash;&gt; Dev_B scp download file to me &mdash;&gt; I upload to server.</p> <p>Dev_A upload to google drive &mdash;&gt; Dev_B Download from google drive &mdash;&gt; Dev_B scp download file to me &mdash;&gt; I upload to server.</p>
<p>有沒有是不是很stupid (講話一定要烙英文)</p> <p>有沒有是不是很stupid (講話一定要烙英文)</p>
<p>既然有現成的NAS在那邊幹嘛不用呢(攤手)</p> <p>既然有現成的NAS在那邊幹嘛不用呢(攤手)</p>
<p>聽說之前的人一直沒成功弄出來讓Server可以直接去NAS存取檔案的方式我記得這個不是很難啊 <p>聽說之前的人一直沒成功弄出來讓Server可以直接去NAS存取檔案的方式我記得這個不是很難啊
就順手整理一下</p> 就順手整理一下</p>
<h3 id="新增使用者帳號-確認家目錄存在">新增使用者帳號/ 確認家目錄存在</h3> <h3 id="新增使用者帳號-確認家目錄存在">新增使用者帳號/ 確認家目錄存在</h3>
<p>在NAS 的管理界面上新增一個帳號,假設叫 eric 好了</p> <p>在NAS 的管理界面上新增一個帳號,假設叫 eric 好了</p>
<p><del>建立時,注意一下要指定家目錄路徑</del></p> <p><del>建立時,注意一下要指定家目錄路徑</del></p>
<p>更正: 群暉的界面好像不能指定家目錄</p> <p>更正: 群暉的界面好像不能指定家目錄</p>
<p>預設的路徑如下</p> <p>預設的路徑如下</p>
<pre><code>eric:x:1071:100::/var/services/homes/eric:/sbin/nologin <pre><code>eric:x:1071:100::/var/services/homes/eric:/sbin/nologin
</code></pre> </code></pre><p>不過我覺得怪怪的因為在我手邊的幾台NAS底下 /var/services/homes 都切不過去
<p>不過我覺得怪怪的因為在我手邊的幾台NAS底下 /var/services/homes 都切不過去
確認一下路徑,發現那個 <code>@fake_home_link</code> 根本就不存在啊!</p> 確認一下路徑,發現那個 <code>@fake_home_link</code> 根本就不存在啊!</p>
<pre><code>admin@storage:/volume1$ ls -lart /var/services/homes <pre><code>admin@storage:/volume1$ ls -lart /var/services/homes
lrwxrwxrwx 1 root root 24 May 23 14:14 /var/services/homes -&gt; /volume1/@fake_home_link lrwxrwxrwx 1 root root 24 May 23 14:14 /var/services/homes -&gt; /volume1/@fake_home_link
admin@storage:/volume1$ admin@storage:/volume1$
</code></pre> </code></pre><p>我在想是不是之前的人有改過什麼..
<p>我在想是不是之前的人有改過什麼..
anyway ,反正先不管這邊,直接修改 /etc/passwd檔案</p> anyway ,反正先不管這邊,直接修改 /etc/passwd檔案</p>
<pre><code>sudo vim /etc/passwd <pre><code>sudo vim /etc/passwd
</code></pre> </code></pre><p>修正到正確的路徑順便把shell 也改掉,不然不能登入</p>
<p>修正到正確的路徑順便把shell 也改掉,不然不能登入</p>
<pre><code>eric:x:1071:100::/volume1/homes/eric:/bin/sh <pre><code>eric:x:1071:100::/volume1/homes/eric:/bin/sh
</code></pre> </code></pre><h3 id="修改-etcsshsshd_config">修改 /etc/ssh/sshd_config</h3>
<h3 id="修改-etc-ssh-sshd-config">修改 /etc/ssh/sshd_config</h3>
<p>再來修正預設沒有啟用 Publickey 驗證的 ssh</p> <p>再來修正預設沒有啟用 Publickey 驗證的 ssh</p>
<pre><code>sudo vim /etc/ssh/sshd_config <pre><code>sudo vim /etc/ssh/sshd_config
</code></pre> </code></pre><p>確認底下三行存在</p>
<p>確認底下三行存在</p>
<pre><code>RSAAuthentication yes <pre><code>RSAAuthentication yes
PubkeyAuthentication yes PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys
</code></pre> </code></pre><h3 id="將key傳到-nas上">將KEY傳到 NAS上</h3>
<h3 id="將key傳到-nas上">將KEY傳到 NAS上</h3>
<p>先建立相關目錄,順便修正一下目錄權限</p> <p>先建立相關目錄,順便修正一下目錄權限</p>
<pre><code>chmod 755 /volume1/homes/eric <pre><code>chmod 755 /volume1/homes/eric
mkdir -p /volume1/homes/eric/.ssh mkdir -p /volume1/homes/eric/.ssh
chmod 700 /volume1/homes/eric/.ssh chmod 700 /volume1/homes/eric/.ssh
</code></pre> </code></pre><p>再來把Publickey 傳到NAS複製貼上也好ssh-copy-id也可以同時修正權限</p>
<p>再來把Publickey 傳到NAS複製貼上也好ssh-copy-id也可以同時修正權限</p>
<pre><code>vim /volume1/homes/eric/.ssh/authorized_keys <pre><code>vim /volume1/homes/eric/.ssh/authorized_keys
chmod 0600 /volume1/eric/.ssh/authorized_keys chmod 0600 /volume1/eric/.ssh/authorized_keys
</code></pre> </code></pre><h3 id="重啟ssh">重啟SSH</h3>
<h3 id="重啟ssh">重啟SSH</h3>
<p>本來這個步驟應該可以用</p> <p>本來這個步驟應該可以用</p>
<pre><code>synoservicectl --restart sshd <pre><code>synoservicectl --restart sshd
</code></pre> </code></pre><p>來解決
<p>來解決
但是實際上這個指令只會把你踢出 SSH session &hellip;.( WTF!!! )</p> 但是實際上這個指令只會把你踢出 SSH session &hellip;.( WTF!!! )</p>
<p>所以還是要去NAS的管理界面去關閉再打開SSH (有點蠢..) <p>所以還是要去NAS的管理界面去關閉再打開SSH (有點蠢..)
<img src="https://i.imgur.com/jcDQmI1.png" alt="Synology WEB UI" /></p> <img src="https://i.imgur.com/jcDQmI1.png" alt="Synology WEB UI"></p>
<p>然後就可以測試用Publickey 來登入NAS了</p> <p>然後就可以測試用Publickey 來登入NAS了</p>
<pre><code>2018-11-05 14:47:12 [mini@s009 ansiblecontrol]$ ssh admin@storage <pre><code>2018-11-05 14:47:12 [mini@s009 ansiblecontrol]$ ssh admin@storage
admin@storage:~$ admin@storage:~$
</code></pre> </code></pre><p>確認免密碼登入無誤了!</p>
<p>確認免密碼登入無誤了!</p>
</article> </article>
</div> </div>
@ -693,7 +640,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -705,7 +652,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 第一次玩 Synology High Availability \/ first try synology high availability", "name" : "[筆記] 第一次玩 Synology High Availability \/ first try synology high availability",
"headline" : "[筆記] 第一次玩 Synology High Availability \/ first try synology high availability", "headline" : "[筆記] 第一次玩 Synology High Availability \/ first try synology high availability",
"description" : "\x3cp\x3e上禮拜原本擔任 proxmox cluster 的主要 storage 的 ds415\x2b 掛點了\x3c\/p\x3e\n\n\x3cp\x3e原因應該就是之前的 intel c2000 series cpu 的 bug\x3c\/p\x3e\n\n\x3cp\x3e只是不知道為什麼這台兩三年來都沒有關機的NAS\x3c\/p\x3e\n\n\x3cp\x3e比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)\x3c\/p\x3e\n\n\x3cp\x3e趁著這次機會看看網路上說的換電阻大法有沒有用\x3c\/p\x3e\n\n\x3cp\x3e如果有用就拿這兩台來玩玩 synology high availability !\x3c\/p\x3e", "description" : "\x3cp\x3e上禮拜原本擔任 proxmox cluster 的主要 storage 的 ds415\x2b 掛點了\x3c\/p\x3e\n\x3cp\x3e原因應該就是之前的 intel c2000 series cpu 的 bug\x3c\/p\x3e\n\x3cp\x3e只是不知道為什麼這台兩三年來都沒有關機的NAS\x3c\/p\x3e\n\x3cp\x3e比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)\x3c\/p\x3e\n\x3cp\x3e趁著這次機會看看網路上說的換電阻大法有沒有用\x3c\/p\x3e\n\x3cp\x3e如果有用就拿這兩台來玩玩 synology high availability !\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,86 +305,48 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了</p> <p>上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了</p>
<p>原因應該就是之前的 intel c2000 series cpu 的 bug</p> <p>原因應該就是之前的 intel c2000 series cpu 的 bug</p>
<p>只是不知道為什麼這台兩三年來都沒有關機的NAS</p> <p>只是不知道為什麼這台兩三年來都沒有關機的NAS</p>
<p>比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)</p> <p>比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)</p>
<p>趁著這次機會,看看網路上說的換電阻大法有沒有用!</p> <p>趁著這次機會,看看網路上說的換電阻大法有沒有用!</p>
<p>如果有用,就拿這兩台來玩玩 synology high availability !</p> <p>如果有用,就拿這兩台來玩玩 synology high availability !</p>
<p>先要感謝這一篇的作者!</p> <p>先要感謝這一篇的作者!</p>
<p><a href="https://www.mobile01.com/topicdetail.php?f=494&amp;t=5600042">https://www.mobile01.com/topicdetail.php?f=494&amp;t=5600042</a></p> <p><a href="https://www.mobile01.com/topicdetail.php?f=494&amp;t=5600042">https://www.mobile01.com/topicdetail.php?f=494&amp;t=5600042</a></p>
<p>在網路上訂了一大包的 1/4 w 100Ω 的電阻 (100個才70塊運費都要60了)</p>
<p>在網路上訂了一大包的 <sup>1</sup>&frasl;<sub>4</sub> w 100Ω 的電阻 (100個才70塊運費都要60了)</p>
<p>照著上面那篇的作法把電阻焊上去NAS就順利開機了</p> <p>照著上面那篇的作法把電阻焊上去NAS就順利開機了</p>
<p>__</p> <p>__</p>
<p>架構圖很簡單,只是在做測試而已,又是第一次玩,先不要搞得太複雜</p> <p>架構圖很簡單,只是在做測試而已,又是第一次玩,先不要搞得太複雜</p>
<p><img src="https://i.imgur.com/k7IDZ4Y.png" alt=""></p>
<p><img src="https://i.imgur.com/k7IDZ4Y.png" alt="" /></p>
<p>流程大致如下</p> <p>流程大致如下</p>
<p>設定好NAS Cluster 之後建立NFS 服務</p> <p>設定好NAS Cluster 之後建立NFS 服務</p>
<p>然後在proxmox 主機上掛載這個NFS 空間</p> <p>然後在proxmox 主機上掛載這個NFS 空間</p>
<p>接著在proxmox 上建立一台 VM 存放在NFS 空間上</p> <p>接著在proxmox 上建立一台 VM 存放在NFS 空間上</p>
<p>在這台VM裡面持續 ping NAS cluster VIP 192.168.11.85</p> <p>在這台VM裡面持續 ping NAS cluster VIP 192.168.11.85</p>
<p>接著拔掉 192.168.11.87 的兩條網路線模擬NAS cluster 的主伺服器掛點的狀況</p> <p>接著拔掉 192.168.11.87 的兩條網路線模擬NAS cluster 的主伺服器掛點的狀況</p>
<p>這時候VM 還活著,可以正常建立、刪除、檢視檔案,然後 ping 192.168.11.85 也還持續著</p> <p>這時候VM 還活著,可以正常建立、刪除、檢視檔案,然後 ping 192.168.11.85 也還持續著</p>
<p>NAS的告警信件也正常發出</p> <p>NAS的告警信件也正常發出</p>
<p>08:53 NAS High Availability 叢集 ds415cluster 已執行自動故障轉移。 [詳細資訊:無法偵測到 hqs087 (主伺服器)] <p>08:53 NAS High Availability 叢集 ds415cluster 已執行自動故障轉移。 [詳細資訊:無法偵測到 hqs087 (主伺服器)]
08:58 NAS High Availability 叢集 ds415cluster 狀態異常 [詳細資訊:無法偵測到 hqs087 (副伺服器)]</p> 08:58 NAS High Availability 叢集 ds415cluster 狀態異常 [詳細資訊:無法偵測到 hqs087 (副伺服器)]</p>
<p>9:08 接回hqs087的網路線</p> <p>9:08 接回hqs087的網路線</p>
<p>9:09 收到信件 NAS High Availability 叢集 ds415cluster 停止正常運作 [詳細資訊Split-brain 錯誤]</p> <p>9:09 收到信件 NAS High Availability 叢集 ds415cluster 停止正常運作 [詳細資訊Split-brain 錯誤]</p>
<p>登入管理界面(192.168.11.85:5000) ,操作 HA ,選擇恢復</p> <p>登入管理界面(192.168.11.85:5000) ,操作 HA ,選擇恢復</p>
<p>這時候開始VM 的檔案系統變成是 read only</p> <p>這時候開始VM 的檔案系統變成是 read only</p>
<p>雖然還活著,但是已經無法建立、刪除檔案,連 cat /var/log/syslog 也會卡住</p> <p>雖然還活著,但是已經無法建立、刪除檔案,連 cat /var/log/syslog 也會卡住</p>
<p>9:14 VIP NAS cluster 恢復連線,本來卡住的 cat /var/log/syslog 也可以正常顯示內容了</p> <p>9:14 VIP NAS cluster 恢復連線,本來卡住的 cat /var/log/syslog 也可以正常顯示內容了</p>
<p>但是系統還是 read onlyreboot VM 之後才恢復正常。</p> <p>但是系統還是 read onlyreboot VM 之後才恢復正常。</p>
<p>有幾個問題</p> <p>有幾個問題</p>
<ul> <ul>
<li>split brain 錯誤</li> <li>split brain 錯誤</li>
</ul> </ul>
<p>這個問題我想應該是因為只有兩台組成clsuter 造成的</p> <p>這個問題我想應該是因為只有兩台組成clsuter 造成的</p>
<p>如果有第三臺加入應該就不會有這個split brain 的問題</p> <p>如果有第三臺加入應該就不會有這個split brain 的問題</p>
<ul> <ul>
<li>VM變成 read only</li> <li>VM變成 read only</li>
</ul> </ul>
<p>這個我就不知道為什麼了照理說NAS Cluster 已經開始在恢復</p> <p>這個我就不知道為什麼了照理說NAS Cluster 已經開始在恢復</p>
<p>在我的觀念裡,應該要能夠「正常」的持續服務</p> <p>在我的觀念裡,應該要能夠「正常」的持續服務</p>
<p>但是VM變成 read only ,而且必須要重新開機才能解決</p> <p>但是VM變成 read only ,而且必須要重新開機才能解決</p>
<p>那這樣NAS Cluster 等於沒有太大作用呀..</p> <p>那這樣NAS Cluster 等於沒有太大作用呀..</p>
<p>來問問看群暉客服好了</p> <p>來問問看群暉客服好了</p>
</article> </article>
</div> </div>
@ -664,7 +622,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -676,7 +634,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 解決無法建立zpool 的錯誤 \/ Fix Zpool Device Busy Using dmsetup", "name" : "[筆記] 解決無法建立zpool 的錯誤 \/ Fix Zpool Device Busy Using dmsetup",
"headline" : "[筆記] 解決無法建立zpool 的錯誤 \/ Fix Zpool Device Busy Using dmsetup", "headline" : "[筆記] 解決無法建立zpool 的錯誤 \/ Fix Zpool Device Busy Using dmsetup",
"description" : "\x3cp\x3e今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試\x3c\/p\x3e\n\n\x3cp\x3e想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone\/migrate\x3c\/p\x3e\n\n\x3cp\x3e可是一直出現device busy的錯誤訊息\x3c\/p\x3e", "description" : "\x3cp\x3e今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試\x3c\/p\x3e\n\x3cp\x3e想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone\/migrate\x3c\/p\x3e\n\x3cp\x3e可是一直出現device busy的錯誤訊息\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,24 +305,15 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試</p> <p>今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試</p>
<p>想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate</p> <p>想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate</p>
<p>可是一直出現device busy的錯誤訊息</p> <p>可是一直出現device busy的錯誤訊息</p>
<pre><code>root@pve:~# zpool create zp sdb1 <pre><code>root@pve:~# zpool create zp sdb1
cannot open '/dev/sdb1': Device or resource busy cannot open '/dev/sdb1': Device or resource busy
</code></pre> </code></pre><p>可是我沒有mount 這個分割進來</p>
<p>可是我沒有mount 這個分割進來</p>
<p>而且我也可以用fdisk 去切sdb 代表sdb 沒有真的被使用</p> <p>而且我也可以用fdisk 去切sdb 代表sdb 沒有真的被使用</p>
<p>找了很久終於找到這個dmsetup指令</p> <p>找了很久終於找到這個dmsetup指令</p>
<p>先用 <code>dmsetup info -C </code> 來看現在的狀態</p>
<p>先用 <code>dmsetup info -C</code> 來看現在的狀態</p>
<pre><code>root@pve:~# dmsetup info -C <pre><code>root@pve:~# dmsetup info -C
Name Maj Min Stat Open Targ Event UUID Name Maj Min Stat Open Targ Event UUID
ST2000DM001-1ER164_W4Z3KKJB 253 3 L--w 0 1 0 mpath-ST2000DM001-1ER164_W4Z3KKJB ST2000DM001-1ER164_W4Z3KKJB 253 3 L--w 0 1 0 mpath-ST2000DM001-1ER164_W4Z3KKJB
@ -335,21 +322,15 @@ pve-root 253 1 L--w 1 1 0 LVM-6Hle5UGjtr8N
ST2000DM001-1ER164_W4Z3KM2F-part1 253 5 L--w 0 1 0 part1-mpath-ST2000DM001-1ER164_W4Z3KM2F ST2000DM001-1ER164_W4Z3KM2F-part1 253 5 L--w 0 1 0 part1-mpath-ST2000DM001-1ER164_W4Z3KM2F
ST2000DM001-1ER164_W4Z3KM2F 253 2 L--w 1 1 0 mpath-ST2000DM001-1ER164_W4Z3KM2F ST2000DM001-1ER164_W4Z3KM2F 253 2 L--w 1 1 0 mpath-ST2000DM001-1ER164_W4Z3KM2F
ST2000DM001-1ER164_W4Z3GYNJ 253 4 L--w 0 1 0 mpath-ST2000DM001-1ER164_W4Z3GYNJ ST2000DM001-1ER164_W4Z3GYNJ 253 4 L--w 0 1 0 mpath-ST2000DM001-1ER164_W4Z3GYNJ
</code></pre> </code></pre><p>除了那兩個LVM開頭的以外其他都不應該出現在這裡才對
<p>除了那兩個LVM開頭的以外其他都不應該出現在這裡才對
移除掉應該就可以了 移除掉應該就可以了
要照順序像那個有part1 的,就要先移掉,才能移掉底層</p> 要照順序像那個有part1 的,就要先移掉,才能移掉底層</p>
<pre><code>root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KM2F-part1 <pre><code>root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KM2F-part1
root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KM2F root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KM2F
root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KKJB root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KKJB
root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KM2F root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3KM2F
root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3GYNJ root@pve:~# dmsetup remove ST2000DM001-1ER164_W4Z3GYNJ
</code></pre> </code></pre><p>再來建立zpool 就 OK了</p>
<p>再來建立zpool 就 OK了</p>
<pre><code>root@pve:~# zpool create zp sdb sdc sdd <pre><code>root@pve:~# zpool create zp sdb sdc sdd
root@pve:~# zpool status root@pve:~# zpool status
pool: zp pool: zp
@ -640,7 +621,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -652,7 +633,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[碎念] mdadm 超級慢的rebuild 速度 Incredibly Slow mdadm Rebuild", "name" : "[碎念] mdadm 超級慢的rebuild 速度 Incredibly Slow mdadm Rebuild",
"headline" : "[碎念] mdadm 超級慢的rebuild 速度 Incredibly Slow mdadm Rebuild", "headline" : "[碎念] mdadm 超級慢的rebuild 速度 Incredibly Slow mdadm Rebuild",
"description" : "\x3cp\x3e最近在做一台老機器的P2V\x3c\/p\x3e\n\n\x3cp\x3e偏偏user說不能關機所以我用dd \x2b ssh 做線上移轉\x3c\/p\x3e\n\n\x3cp\x3e這部份有空再來寫\x3c\/p\x3e\n\n\x3cp\x3e只是因為原來的設定有用mdadm 做raid1\x3c\/p\x3e\n\n\x3cp\x3e這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機\x3c\/p\x3e", "description" : "\x3cp\x3e最近在做一台老機器的P2V\x3c\/p\x3e\n\x3cp\x3e偏偏user說不能關機所以我用dd \x2b ssh 做線上移轉\x3c\/p\x3e\n\x3cp\x3e這部份有空再來寫\x3c\/p\x3e\n\x3cp\x3e只是因為原來的設定有用mdadm 做raid1\x3c\/p\x3e\n\x3cp\x3e這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,23 +305,14 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近在做一台老機器的P2V</p> <p>最近在做一台老機器的P2V</p>
<p>偏偏user說不能關機所以我用dd + ssh 做線上移轉</p> <p>偏偏user說不能關機所以我用dd + ssh 做線上移轉</p>
<p>這部份有空再來寫</p> <p>這部份有空再來寫</p>
<p>只是因為原來的設定有用mdadm 做raid1</p> <p>只是因為原來的設定有用mdadm 做raid1</p>
<p>這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機</p> <p>這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機</p>
<p>我的想法是既然開機會出現raid degrade</p> <p>我的想法是既然開機會出現raid degrade</p>
<p>那我就加第二顆硬碟給它,讓它做 rebuild</p> <p>那我就加第二顆硬碟給它,讓它做 rebuild</p>
<p>OK原則上這樣做沒有問題</p> <p>OK原則上這樣做沒有問題</p>
<p>問題是它X的這個mdadm rebuild 的速度也未免太慢了吧!</p> <p>問題是它X的這個mdadm rebuild 的速度也未免太慢了吧!</p>
<pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 11:01:36 2018 <pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 11:01:36 2018
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
@ -337,12 +324,8 @@ md0 : active raid1 sda5[0] sdb5[2]
[&gt;....................] recovery = 0.5% (2468032/487276352) finish=2079.7min speed=3884K/sec [&gt;....................] recovery = 0.5% (2468032/487276352) finish=2079.7min speed=3884K/sec
unused devices: &lt;none&gt; unused devices: &lt;none&gt;
</code></pre> </code></pre><p>這個是一開始跑的速度</p>
<p>這個是一開始跑的速度</p>
<p>然後這個是跑了大概10分鐘之後的速度(有稍稍提昇一點點)</p> <p>然後這個是跑了大概10分鐘之後的速度(有稍稍提昇一點點)</p>
<pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 11:17:31 2018 <pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 11:17:31 2018
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
@ -354,12 +337,8 @@ md0 : active raid1 sda5[0] sdb5[2]
[&gt;....................] recovery = 1.4% (6978688/487276352) finish=1915.9min speed=4177K/sec [&gt;....................] recovery = 1.4% (6978688/487276352) finish=1915.9min speed=4177K/sec
unused devices: &lt;none&gt; unused devices: &lt;none&gt;
</code></pre> </code></pre><p>等等看會不會速度再快一點..</p>
<p>等等看會不會速度再快一點..</p>
<p>一個小時了,還是一樣慢..</p> <p>一個小時了,還是一樣慢..</p>
<pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 12:20:16 2018 <pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 12:20:16 2018
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
@ -372,10 +351,7 @@ md0 : active raid1 sda5[0] sdb5[2]
unused devices: &lt;none&gt; unused devices: &lt;none&gt;
</code></pre> </code></pre><p>突然又加速了,希望能維持下去啊!&hellip;.</p>
<p>突然又加速了,希望能維持下去啊!&hellip;.</p>
<pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 13:33:42 2018 <pre><code>Every 2.0s: cat /proc/mdstat Wed Dec 12 13:33:42 2018
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
@ -663,7 +639,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -675,7 +651,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
<title>Posts on MC部落</title> <title>Posts on MC部落</title>
@ -18,9 +18,7 @@
<guid>https://h.cowbay.org/post/cloudcmd-web-file-manager/</guid> <guid>https://h.cowbay.org/post/cloudcmd-web-file-manager/</guid>
<description>&lt;p&gt;最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案&lt;/p&gt; <description>&lt;p&gt;最近又接到之前處理過的需求,要讓使用者可以在外部上傳、編輯 yaml 檔案&lt;/p&gt;
&lt;p&gt;之前是用 gohttpd 來做&lt;/p&gt; &lt;p&gt;之前是用 gohttpd 來做&lt;/p&gt;
&lt;p&gt;可是不支援線上編輯 yaml 檔案&lt;/p&gt;</description> &lt;p&gt;可是不支援線上編輯 yaml 檔案&lt;/p&gt;</description>
</item> </item>
@ -31,7 +29,6 @@
<guid>https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/</guid> <guid>https://h.cowbay.org/post/various-self-hosted-file-sharing-system-test/</guid>
<description>&lt;p&gt;感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點&lt;/p&gt; <description>&lt;p&gt;感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點&lt;/p&gt;
&lt;p&gt;就把系統弄起來玩玩看順便建立ansible 的playbook&lt;/p&gt;</description> &lt;p&gt;就把系統弄起來玩玩看順便建立ansible 的playbook&lt;/p&gt;</description>
</item> </item>
@ -42,7 +39,6 @@
<guid>https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/</guid> <guid>https://h.cowbay.org/post/install-postgresql-pg_strom-nvidia_driver-cuda-in-ubuntu-20.04/</guid>
<description>&lt;p&gt;最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。&lt;/p&gt; <description>&lt;p&gt;最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。&lt;/p&gt;
&lt;p&gt;Breaks here&lt;/p&gt;</description> &lt;p&gt;Breaks here&lt;/p&gt;</description>
</item> </item>
@ -53,15 +49,10 @@
<guid>https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/</guid> <guid>https://h.cowbay.org/post/ubuntu-letsencrypt-cloudflare-wildcard/</guid>
<description>&lt;p&gt;之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題&lt;/p&gt; <description>&lt;p&gt;之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題&lt;/p&gt;
&lt;p&gt;也不用煩惱怎麼去更新一堆有的沒的&lt;/p&gt; &lt;p&gt;也不用煩惱怎麼去更新一堆有的沒的&lt;/p&gt;
&lt;p&gt;不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況&lt;/p&gt; &lt;p&gt;不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況&lt;/p&gt;
&lt;p&gt;雖然可以從caddy 上面取得這些檔案&lt;/p&gt; &lt;p&gt;雖然可以從caddy 上面取得這些檔案&lt;/p&gt;
&lt;p&gt;但是基本上這些檔案都是綁定一個特定的hostname&lt;/p&gt; &lt;p&gt;但是基本上這些檔案都是綁定一個特定的hostname&lt;/p&gt;
&lt;p&gt;可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )&lt;/p&gt;</description> &lt;p&gt;可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )&lt;/p&gt;</description>
</item> </item>
@ -72,15 +63,10 @@
<guid>https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/</guid> <guid>https://h.cowbay.org/post/wireguard-pihole-in-ubuntu-20.04/</guid>
<description>&lt;p&gt;手機上的廣告越來越討厭了&lt;/p&gt; <description>&lt;p&gt;手機上的廣告越來越討厭了&lt;/p&gt;
&lt;p&gt;但是用手機看頁面、影片的機會越來越高&lt;/p&gt; &lt;p&gt;但是用手機看頁面、影片的機會越來越高&lt;/p&gt;
&lt;p&gt;所以一直想看看有沒有什麼方式可以解決這個問題&lt;/p&gt; &lt;p&gt;所以一直想看看有沒有什麼方式可以解決這個問題&lt;/p&gt;
&lt;p&gt;不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉&lt;/p&gt; &lt;p&gt;不只可以用在safari 上連APP 裡面的廣告最好都能夠擋掉&lt;/p&gt;
&lt;p&gt;在github上面看到有個專案是 wireguard + pihole&lt;/p&gt; &lt;p&gt;在github上面看到有個專案是 wireguard + pihole&lt;/p&gt;
&lt;p&gt;滿有趣的,就來研究一下&lt;/p&gt;</description> &lt;p&gt;滿有趣的,就來研究一下&lt;/p&gt;</description>
</item> </item>
@ -91,25 +77,15 @@
<guid>https://h.cowbay.org/post/check-port-speed-in-openwrt/</guid> <guid>https://h.cowbay.org/post/check-port-speed-in-openwrt/</guid>
<description>&lt;p&gt;最近在玩ansible + openwrt + wireguard&lt;/p&gt; <description>&lt;p&gt;最近在玩ansible + openwrt + wireguard&lt;/p&gt;
&lt;p&gt;ansible 腳本寫好之後可以把config 佈署到 openwrt 上&lt;/p&gt; &lt;p&gt;ansible 腳本寫好之後可以把config 佈署到 openwrt 上&lt;/p&gt;
&lt;p&gt;當然前提是最好用同樣的機器不同的機器在config 上會有一些差異&lt;/p&gt; &lt;p&gt;當然前提是最好用同樣的機器不同的機器在config 上會有一些差異&lt;/p&gt;
&lt;p&gt;但是這些差異常常就會造成無法連線、無法使用的狀況&lt;/p&gt; &lt;p&gt;但是這些差異常常就會造成無法連線、無法使用的狀況&lt;/p&gt;
&lt;p&gt;BTW 我是用 ubiquiti 的 edgerouter X 來做&lt;/p&gt; &lt;p&gt;BTW 我是用 ubiquiti 的 edgerouter X 來做&lt;/p&gt;
&lt;p&gt;都弄好之後就想說來跑個iperf3 測試一下連線速度&lt;/p&gt; &lt;p&gt;都弄好之後就想說來跑個iperf3 測試一下連線速度&lt;/p&gt;
&lt;p&gt;也好和之前做的 IPSEC 比較一下&lt;/p&gt; &lt;p&gt;也好和之前做的 IPSEC 比較一下&lt;/p&gt;
&lt;p&gt;結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config&lt;/p&gt; &lt;p&gt;結果很奇怪的是明明一樣的機器、一樣用ansible 跑出來的config&lt;/p&gt;
&lt;p&gt;但是有一台edgerouter X 的VPN 連接速度就是特別慢&lt;/p&gt; &lt;p&gt;但是有一台edgerouter X 的VPN 連接速度就是特別慢&lt;/p&gt;
&lt;p&gt;而且速度都剛好卡在 99.X Mb 左右&lt;/p&gt; &lt;p&gt;而且速度都剛好卡在 99.X Mb 左右&lt;/p&gt;
&lt;p&gt;就讓我很納悶了&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;就讓我很納悶了&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -120,19 +96,12 @@
<guid>https://h.cowbay.org/post/debian-buster-server-been-hacked/</guid> <guid>https://h.cowbay.org/post/debian-buster-server-been-hacked/</guid>
<description>&lt;p&gt;上禮拜某天在開會的時候LINE不斷傳來訊息&lt;/p&gt; <description>&lt;p&gt;上禮拜某天在開會的時候LINE不斷傳來訊息&lt;/p&gt;
&lt;p&gt;不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了&lt;/p&gt; &lt;p&gt;不過因為我向來開會都很認真(驕傲,所以都沒看,接著就變成來電了&lt;/p&gt;
&lt;p&gt;看來大概有啥事發生&lt;/p&gt; &lt;p&gt;看來大概有啥事發生&lt;/p&gt;
&lt;p&gt;不過畢竟不是正職的工作,就先放著吧&lt;/p&gt; &lt;p&gt;不過畢竟不是正職的工作,就先放著吧&lt;/p&gt;
&lt;p&gt;後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我&lt;/p&gt; &lt;p&gt;後來變成連學長都直接打來告訴我,某間公司的伺服器出事了,客戶找不到我&lt;/p&gt;
&lt;p&gt;叫我趕快連進去看&lt;/p&gt; &lt;p&gt;叫我趕快連進去看&lt;/p&gt;
&lt;p&gt;是說,啊我又沒跟人家簽維護,趕什麼趕&amp;hellip;&lt;/p&gt; &lt;p&gt;是說,啊我又沒跟人家簽維護,趕什麼趕&amp;hellip;&lt;/p&gt;
&lt;p&gt;總之,開完會後就了解一下狀況&lt;/p&gt;</description> &lt;p&gt;總之,開完會後就了解一下狀況&lt;/p&gt;</description>
</item> </item>
@ -143,13 +112,9 @@
<guid>https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/</guid> <guid>https://h.cowbay.org/post/ubuntu-kernel-4-15-0-106-unable-to-start-wireguard-interface/</guid>
<description>&lt;p&gt;工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)&lt;/p&gt; <description>&lt;p&gt;工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)&lt;/p&gt;
&lt;p&gt;結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了&lt;/p&gt; &lt;p&gt;結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了&lt;/p&gt;
&lt;p&gt;手動下指令也啟動不了&lt;/p&gt; &lt;p&gt;手動下指令也啟動不了&lt;/p&gt;
&lt;p&gt;查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包&lt;/p&gt; &lt;p&gt;查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包&lt;/p&gt;
&lt;p&gt;看來就連kernel 最好都不要自動升級&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;看來就連kernel 最好都不要自動升級&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -160,9 +125,7 @@
<guid>https://h.cowbay.org/post/ubuntu-1804-preseeds/</guid> <guid>https://h.cowbay.org/post/ubuntu-1804-preseeds/</guid>
<description>&lt;p&gt;ubuntu 18.04 預設移掉了 /etc/rc.local 的功能&lt;/p&gt; <description>&lt;p&gt;ubuntu 18.04 預設移掉了 /etc/rc.local 的功能&lt;/p&gt;
&lt;p&gt;變成要用 systemd 的方式來運作,可是有點難用…&lt;/p&gt; &lt;p&gt;變成要用 systemd 的方式來運作,可是有點難用…&lt;/p&gt;
&lt;p&gt;紀錄一下步驟,再來研究怎麼整合到 preseed 裡面&lt;/p&gt;</description> &lt;p&gt;紀錄一下步驟,再來研究怎麼整合到 preseed 裡面&lt;/p&gt;</description>
</item> </item>
@ -173,11 +136,8 @@
<guid>https://h.cowbay.org/post/ubuntu-1404-preseed/</guid> <guid>https://h.cowbay.org/post/ubuntu-1404-preseed/</guid>
<description>&lt;p&gt;這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04&lt;/p&gt; <description>&lt;p&gt;這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04&lt;/p&gt;
&lt;p&gt;在安裝完成後,會發出郵件通知管理者已經安裝完成&lt;/p&gt; &lt;p&gt;在安裝完成後,會發出郵件通知管理者已經安裝完成&lt;/p&gt;
&lt;p&gt;可是某次ansible 更新之後,反而沒辦法安裝完成&lt;/p&gt; &lt;p&gt;可是某次ansible 更新之後,反而沒辦法安裝完成&lt;/p&gt;
&lt;p&gt;這次順手修改一下同時更新了ansible 的template&lt;/p&gt;</description> &lt;p&gt;這次順手修改一下同時更新了ansible 的template&lt;/p&gt;</description>
</item> </item>
@ -188,15 +148,10 @@
<guid>https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/</guid> <guid>https://h.cowbay.org/post/config-networkmanager-in-ubuntu-to-stop-modify-resolvconf/</guid>
<description>&lt;p&gt;ubuntu 18.04 的 DNS 設定很煩&lt;/p&gt; <description>&lt;p&gt;ubuntu 18.04 的 DNS 設定很煩&lt;/p&gt;
&lt;p&gt;系統預設會用NetworkManager 去管理&lt;/p&gt; &lt;p&gt;系統預設會用NetworkManager 去管理&lt;/p&gt;
&lt;p&gt;然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式&lt;/p&gt; &lt;p&gt;然後NetworkManager 又很「靈活」的許多種修改 /etc/resolv.conf 的方式&lt;/p&gt;
&lt;p&gt;之前都是很粗暴的停用 NetworkManager&lt;/p&gt; &lt;p&gt;之前都是很粗暴的停用 NetworkManager&lt;/p&gt;
&lt;p&gt;但是用筆電的user 又需要用 NetworkManager 來管理無線網路&lt;/p&gt; &lt;p&gt;但是用筆電的user 又需要用 NetworkManager 來管理無線網路&lt;/p&gt;
&lt;p&gt;今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf&lt;/p&gt;</description> &lt;p&gt;今天找了一下文件讓NetworkManager 可以執行,卻不會去異動 /etc/resolv.conf&lt;/p&gt;</description>
</item> </item>
@ -206,16 +161,11 @@
<pubDate>Wed, 19 Feb 2020 16:22:38 +0800</pubDate> <pubDate>Wed, 19 Feb 2020 16:22:38 +0800</pubDate>
<guid>https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/install-it500u-card-reader-in-ubuntu-1804/</guid>
<description>&lt;p&gt;早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 &lt;sup&gt;4&lt;/sup&gt;&amp;frasl;&lt;sub&gt;17&lt;/sub&gt;&lt;/p&gt; <description>&lt;p&gt;早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 4/17&lt;/p&gt;
&lt;p&gt;想說快到期了,看看能不能線上申請展延&lt;/p&gt; &lt;p&gt;想說快到期了,看看能不能線上申請展延&lt;/p&gt;
&lt;p&gt;結果辦公室沒有Linux 可以用的讀卡機&lt;/p&gt; &lt;p&gt;結果辦公室沒有Linux 可以用的讀卡機&lt;/p&gt;
&lt;p&gt;OOXX 咧我們可是號稱全Linux 環境捏!&lt;/p&gt; &lt;p&gt;OOXX 咧我們可是號稱全Linux 環境捏!&lt;/p&gt;
&lt;p&gt;結果居然沒有對應的硬體!?&lt;/p&gt; &lt;p&gt;結果居然沒有對應的硬體!?&lt;/p&gt;
&lt;p&gt;於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!&lt;/p&gt;</description> &lt;p&gt;於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!&lt;/p&gt;</description>
</item> </item>
@ -226,11 +176,8 @@
<guid>https://h.cowbay.org/post/proxmox-with-synology-high-availability/</guid> <guid>https://h.cowbay.org/post/proxmox-with-synology-high-availability/</guid>
<description>&lt;p&gt;前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+&lt;/p&gt; <description>&lt;p&gt;前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+&lt;/p&gt;
&lt;p&gt;詳情請看 &lt;a href=&#34;https://h.cowbay.org/post/first-try-synology-ha/&#34;&gt;https://h.cowbay.org/post/first-try-synology-ha/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;詳情請看 &lt;a href=&#34;https://h.cowbay.org/post/first-try-synology-ha/&#34;&gt;https://h.cowbay.org/post/first-try-synology-ha/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;今天趁尾牙前夕,手邊沒啥要緊事&lt;/p&gt; &lt;p&gt;今天趁尾牙前夕,手邊沒啥要緊事&lt;/p&gt;
&lt;p&gt;就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境&lt;/p&gt;</description> &lt;p&gt;就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境&lt;/p&gt;</description>
</item> </item>
@ -241,15 +188,10 @@
<guid>https://h.cowbay.org/post/first-try-synology-ha/</guid> <guid>https://h.cowbay.org/post/first-try-synology-ha/</guid>
<description>&lt;p&gt;上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了&lt;/p&gt; <description>&lt;p&gt;上禮拜,原本擔任 proxmox cluster 的主要 storage 的 ds415+ 掛點了&lt;/p&gt;
&lt;p&gt;原因應該就是之前的 intel c2000 series cpu 的 bug&lt;/p&gt; &lt;p&gt;原因應該就是之前的 intel c2000 series cpu 的 bug&lt;/p&gt;
&lt;p&gt;只是不知道為什麼這台兩三年來都沒有關機的NAS&lt;/p&gt; &lt;p&gt;只是不知道為什麼這台兩三年來都沒有關機的NAS&lt;/p&gt;
&lt;p&gt;比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)&lt;/p&gt; &lt;p&gt;比其他三台多撐了那麼久 (已經有兩台送修回來,一台也是同樣症狀,被放在一邊)&lt;/p&gt;
&lt;p&gt;趁著這次機會,看看網路上說的換電阻大法有沒有用!&lt;/p&gt; &lt;p&gt;趁著這次機會,看看網路上說的換電阻大法有沒有用!&lt;/p&gt;
&lt;p&gt;如果有用,就拿這兩台來玩玩 synology high availability !&lt;/p&gt;</description> &lt;p&gt;如果有用,就拿這兩台來玩玩 synology high availability !&lt;/p&gt;</description>
</item> </item>
@ -260,11 +202,8 @@
<guid>https://h.cowbay.org/post/postgresql-pgbench-benchmark/</guid> <guid>https://h.cowbay.org/post/postgresql-pgbench-benchmark/</guid>
<description>&lt;p&gt;昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench&lt;/p&gt; <description>&lt;p&gt;昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench&lt;/p&gt;
&lt;p&gt;分數大概如何,想要跟他的筆電做個比較&lt;/p&gt; &lt;p&gt;分數大概如何,想要跟他的筆電做個比較&lt;/p&gt;
&lt;p&gt;之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本&lt;/p&gt; &lt;p&gt;之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本&lt;/p&gt;
&lt;p&gt;對於pgbench 跑分會有多大的影響&lt;/p&gt;</description> &lt;p&gt;對於pgbench 跑分會有多大的影響&lt;/p&gt;</description>
</item> </item>
@ -275,9 +214,7 @@
<guid>https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/</guid> <guid>https://h.cowbay.org/post/rescue-synology-nas-with-ubuntu-livecd/</guid>
<description>&lt;p&gt;2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!&lt;/p&gt; <description>&lt;p&gt;2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!&lt;/p&gt;
&lt;p&gt;因為群暉的文件在最關鍵的一步寫得亂七八糟!&lt;/p&gt; &lt;p&gt;因為群暉的文件在最關鍵的一步寫得亂七八糟!&lt;/p&gt;
&lt;p&gt;所以在這邊紀錄一下我操作的步驟!&lt;/p&gt;</description> &lt;p&gt;所以在這邊紀錄一下我操作的步驟!&lt;/p&gt;</description>
</item> </item>
@ -288,11 +225,8 @@
<guid>https://h.cowbay.org/post/what-a-piss-in-synology-document/</guid> <guid>https://h.cowbay.org/post/what-a-piss-in-synology-document/</guid>
<description>&lt;p&gt;2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了&lt;/p&gt; <description>&lt;p&gt;2020/01/02 2020 上工的第一天,公司碩果僅存的唯一一台 Synology DS415+ 也終於掛了&lt;/p&gt;
&lt;p&gt;開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況&lt;/p&gt; &lt;p&gt;開機沒多久就連不上,反覆幾次之後,出現了開機時所有燈號都狂閃的狀況&lt;/p&gt;
&lt;p&gt;終於宣告不治&lt;/p&gt; &lt;p&gt;終於宣告不治&lt;/p&gt;
&lt;p&gt;問題很明顯的就是Intel C2000 系列 CPU 的瑕疵&lt;/p&gt;</description> &lt;p&gt;問題很明顯的就是Intel C2000 系列 CPU 的瑕疵&lt;/p&gt;</description>
</item> </item>
@ -303,11 +237,8 @@
<guid>https://h.cowbay.org/post/ansible-get-value-from-loop-register/</guid> <guid>https://h.cowbay.org/post/ansible-get-value-from-loop-register/</guid>
<description>&lt;p&gt;今天在寫一支客製化 firefox 的playbook&lt;/p&gt; <description>&lt;p&gt;今天在寫一支客製化 firefox 的playbook&lt;/p&gt;
&lt;p&gt;因為firefox 會給每個user 建立一個由亂數字串組成的default profile&lt;/p&gt; &lt;p&gt;因為firefox 會給每個user 建立一個由亂數字串組成的default profile&lt;/p&gt;
&lt;p&gt;所以每個user的 default profile 都不同&lt;/p&gt; &lt;p&gt;所以每個user的 default profile 都不同&lt;/p&gt;
&lt;p&gt;也因此在用register處理的時候碰到了一些問題&lt;/p&gt;</description> &lt;p&gt;也因此在用register處理的時候碰到了一些問題&lt;/p&gt;</description>
</item> </item>
@ -318,13 +249,9 @@
<guid>https://h.cowbay.org/post/ansible-ssh-forwardagent/</guid> <guid>https://h.cowbay.org/post/ansible-ssh-forwardagent/</guid>
<description>&lt;p&gt;正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent&lt;/p&gt; <description>&lt;p&gt;正確來說,我不曉得到底怎麼「稱呼」這個 forwardx11 / forwardagent&lt;/p&gt;
&lt;p&gt;總之就是在寫一隻ansible playbook&lt;/p&gt; &lt;p&gt;總之就是在寫一隻ansible playbook&lt;/p&gt;
&lt;p&gt;目的是用來安裝、設定 firefox&lt;/p&gt; &lt;p&gt;目的是用來安裝、設定 firefox&lt;/p&gt;
&lt;p&gt;包含安裝 firefox addon&lt;/p&gt; &lt;p&gt;包含安裝 firefox addon&lt;/p&gt;
&lt;p&gt;但是一開始在執行的時候,碰到了一些錯誤&lt;/p&gt;</description> &lt;p&gt;但是一開始在執行的時候,碰到了一些錯誤&lt;/p&gt;</description>
</item> </item>
@ -335,15 +262,10 @@
<guid>https://h.cowbay.org/post/test-pg_prewarm/</guid> <guid>https://h.cowbay.org/post/test-pg_prewarm/</guid>
<description>&lt;p&gt;老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面&lt;/p&gt; <description>&lt;p&gt;老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面&lt;/p&gt;
&lt;p&gt;但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)&lt;/p&gt; &lt;p&gt;但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)&lt;/p&gt;
&lt;p&gt;在找資料的時候發現了這個postgresql 的 pg_prewarm extension&lt;/p&gt; &lt;p&gt;在找資料的時候發現了這個postgresql 的 pg_prewarm extension&lt;/p&gt;
&lt;p&gt;好像有點意思?就來測試看看吧!&lt;/p&gt; &lt;p&gt;好像有點意思?就來測試看看吧!&lt;/p&gt;
&lt;p&gt;只是目前還不知道該怎麼解讀測試的數據就是了&amp;hellip;&lt;/p&gt; &lt;p&gt;只是目前還不知道該怎麼解讀測試的數據就是了&amp;hellip;&lt;/p&gt;
&lt;p&gt;幹!林北真的不是 DBA 啦 =.=&lt;/p&gt;</description> &lt;p&gt;幹!林北真的不是 DBA 啦 =.=&lt;/p&gt;</description>
</item> </item>
@ -354,9 +276,7 @@
<guid>https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/</guid> <guid>https://h.cowbay.org/post/accidentally-typed-an-extra-space-in-ansible-playbook/</guid>
<description>&lt;p&gt;剛剛在跑一個修改過的playbook卻發現一個詭異的狀況&lt;/p&gt; <description>&lt;p&gt;剛剛在跑一個修改過的playbook卻發現一個詭異的狀況&lt;/p&gt;
&lt;p&gt;在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄&lt;/p&gt; &lt;p&gt;在用template產生檔案之前爲了避免錯誤所以我先用 file module 去建立目錄&lt;/p&gt;
&lt;p&gt;怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤&lt;/p&gt;</description> &lt;p&gt;怪就怪在建立目錄的task沒錯但是要產生檔案時卻出現了目的目錄不存在的錯誤&lt;/p&gt;</description>
</item> </item>
@ -367,11 +287,8 @@
<guid>https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/</guid> <guid>https://h.cowbay.org/post/add-system-wide-favorite-apps-in-dconf/</guid>
<description>&lt;p&gt;這幾天在ansible 寫了一份新的playbook給developer 用&lt;/p&gt; <description>&lt;p&gt;這幾天在ansible 寫了一份新的playbook給developer 用&lt;/p&gt;
&lt;p&gt;然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon&lt;/p&gt; &lt;p&gt;然後user反映說希望能在ubuntu 18.04 內建的dock 裏面新增一個gnome-terminal的icon&lt;/p&gt;
&lt;p&gt;我才發現原來之前的寫法不能用在 ubuntu 18.04 上&lt;/p&gt; &lt;p&gt;我才發現原來之前的寫法不能用在 ubuntu 18.04 上&lt;/p&gt;
&lt;p&gt;只好又弄了一份出來&lt;/p&gt;</description> &lt;p&gt;只好又弄了一份出來&lt;/p&gt;</description>
</item> </item>
@ -382,19 +299,12 @@
<guid>https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/</guid> <guid>https://h.cowbay.org/post/ubuntu-dconf-proxy-settings/</guid>
<description>&lt;p&gt;最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04&lt;/p&gt; <description>&lt;p&gt;最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04&lt;/p&gt;
&lt;p&gt;因為公司政策的關係所以現在要連接internet ,需要申請&lt;/p&gt; &lt;p&gt;因為公司政策的關係所以現在要連接internet ,需要申請&lt;/p&gt;
&lt;p&gt;然後 user 再去系統的proxy 設定新增一個 PAC 檔&lt;/p&gt; &lt;p&gt;然後 user 再去系統的proxy 設定新增一個 PAC 檔&lt;/p&gt;
&lt;p&gt;但是這個動作其實是去叫NetworkManager 這個服務&lt;/p&gt; &lt;p&gt;但是這個動作其實是去叫NetworkManager 這個服務&lt;/p&gt;
&lt;p&gt;可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定&lt;/p&gt; &lt;p&gt;可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定&lt;/p&gt;
&lt;p&gt;所以想試試看有沒有辦法不使用 NetworkManager 服務&lt;/p&gt; &lt;p&gt;所以想試試看有沒有辦法不使用 NetworkManager 服務&lt;/p&gt;
&lt;p&gt;又能夠在 user level 修改 proxy 參數&lt;/p&gt; &lt;p&gt;又能夠在 user level 修改 proxy 參數&lt;/p&gt;
&lt;p&gt;就想到了用 dconf 來做&lt;/p&gt;</description> &lt;p&gt;就想到了用 dconf 來做&lt;/p&gt;</description>
</item> </item>
@ -405,11 +315,8 @@
<guid>https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/</guid> <guid>https://h.cowbay.org/post/awesome-all-in-one-vpn-server-streisand/</guid>
<description>&lt;p&gt;最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案&lt;/p&gt; <description>&lt;p&gt;最近上班閒得發慌,沒事就上 github 找看看有沒有什麼好玩的專案&lt;/p&gt;
&lt;p&gt;就不小心發現了這個 streisand&lt;/p&gt; &lt;p&gt;就不小心發現了這個 streisand&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/StreisandEffect/streisand&#34;&gt;https://github.com/StreisandEffect/streisand&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://github.com/StreisandEffect/streisand&#34;&gt;https://github.com/StreisandEffect/streisand&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;玩了一下發現這根本就是終極的VPN Server solution ..&lt;/p&gt;</description> &lt;p&gt;玩了一下發現這根本就是終極的VPN Server solution ..&lt;/p&gt;</description>
</item> </item>
@ -420,7 +327,6 @@
<guid>https://h.cowbay.org/post/recommended-ulauncher-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/recommended-ulauncher-in-ubuntu-1804/</guid>
<description>&lt;p&gt;這兩天在找關於在 ubuntu 中做搜尋的軟體&lt;/p&gt; <description>&lt;p&gt;這兩天在找關於在 ubuntu 中做搜尋的軟體&lt;/p&gt;
&lt;p&gt;意外找到一個非常好用的工具 ulauncher&lt;/p&gt;</description> &lt;p&gt;意外找到一個非常好用的工具 ulauncher&lt;/p&gt;</description>
</item> </item>
@ -431,15 +337,10 @@
<guid>https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/</guid> <guid>https://h.cowbay.org/post/pg_auto_failover_in_ubuntu_1804_psql_11/</guid>
<description>&lt;p&gt;最近都在弄postgresql&lt;/p&gt; <description>&lt;p&gt;最近都在弄postgresql&lt;/p&gt;
&lt;p&gt;備份、還原測試得差不多了,就等著看到時候要用什麼方式&lt;/p&gt; &lt;p&gt;備份、還原測試得差不多了,就等著看到時候要用什麼方式&lt;/p&gt;
&lt;p&gt;前幾天看到 pg_auto_failover 這個postgresql 的extension&lt;/p&gt; &lt;p&gt;前幾天看到 pg_auto_failover 這個postgresql 的extension&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/citusdata/pg_auto_failover&#34;&gt;https://github.com/citusdata/pg_auto_failover&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://github.com/citusdata/pg_auto_failover&#34;&gt;https://github.com/citusdata/pg_auto_failover&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA&lt;/p&gt; &lt;p&gt;感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA&lt;/p&gt;
&lt;p&gt;不過,反正當作練功嘛,多測試一套也不錯!&lt;/p&gt;</description> &lt;p&gt;不過,反正當作練功嘛,多測試一套也不錯!&lt;/p&gt;</description>
</item> </item>
@ -461,9 +362,7 @@
<guid>https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/</guid> <guid>https://h.cowbay.org/post/postgresql-backup-restore-using-zfs-snapshot/</guid>
<description>&lt;p&gt;前面測試了用pgbarman / pgbackrest 來備份 postgresql&lt;/p&gt; <description>&lt;p&gt;前面測試了用pgbarman / pgbackrest 來備份 postgresql&lt;/p&gt;
&lt;p&gt;這次改從system file level 來下手&lt;/p&gt; &lt;p&gt;這次改從system file level 來下手&lt;/p&gt;
&lt;p&gt;採用zfs 的快照來備份、還原postgresql 資料庫&lt;/p&gt;</description> &lt;p&gt;採用zfs 的快照來備份、還原postgresql 資料庫&lt;/p&gt;</description>
</item> </item>
@ -492,11 +391,8 @@
<guid>https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/</guid> <guid>https://h.cowbay.org/post/pgbarman-in-ubuntu-1804-postgresql-10/</guid>
<description>&lt;p&gt;很久以前就有看到這個用來備份postgresql 的 pgbarman&lt;/p&gt; <description>&lt;p&gt;很久以前就有看到這個用來備份postgresql 的 pgbarman&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.pgbarman.org/&#34;&gt;https://www.pgbarman.org/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.pgbarman.org/&#34;&gt;https://www.pgbarman.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看&lt;/p&gt; &lt;p&gt;前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看&lt;/p&gt;
&lt;p&gt;不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -507,11 +403,8 @@
<guid>https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/</guid> <guid>https://h.cowbay.org/post/install-nvidia-driver-cuda-pgstrom-in-ubuntu-1804/</guid>
<description>&lt;p&gt;因為老闆說要試試看用GPU 來跑postgresql 威力&lt;/p&gt; <description>&lt;p&gt;因為老闆說要試試看用GPU 來跑postgresql 威力&lt;/p&gt;
&lt;p&gt;手邊剛好有一張 geforce gt 720&lt;/p&gt; &lt;p&gt;手邊剛好有一張 geforce gt 720&lt;/p&gt;
&lt;p&gt;一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援&lt;/p&gt; &lt;p&gt;一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援&lt;/p&gt;
&lt;p&gt;就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -522,17 +415,11 @@
<guid>https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/</guid> <guid>https://h.cowbay.org/post/do-no-use-10-0-0-0-private-ipaddr-in-gcp/</guid>
<description>&lt;p&gt;最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立&lt;/p&gt; <description>&lt;p&gt;最近一直在玩 wireguard 先前把各個分公司和總部的VPN 改用 wireguard 建立&lt;/p&gt;
&lt;p&gt;想說再打個VPN tunnel 來當跳板連 ptt 好了&lt;/p&gt; &lt;p&gt;想說再打個VPN tunnel 來當跳板連 ptt 好了&lt;/p&gt;
&lt;p&gt;因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境&lt;/p&gt; &lt;p&gt;因為wireguard 建立很簡單,而且又可以指定想要繞出去的路由,不會影響原本的網路環境&lt;/p&gt;
&lt;p&gt;本來是在vultr 的VPS上面建立這個tunnel&lt;/p&gt; &lt;p&gt;本來是在vultr 的VPS上面建立這個tunnel&lt;/p&gt;
&lt;p&gt;但是那台VPS連去ptt 很頓,卡卡的&lt;/p&gt; &lt;p&gt;但是那台VPS連去ptt 很頓,卡卡的&lt;/p&gt;
&lt;p&gt;所以改用google cloud platform 的free tier 來做&lt;/p&gt; &lt;p&gt;所以改用google cloud platform 的free tier 來做&lt;/p&gt;
&lt;p&gt;反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態&lt;/p&gt;</description> &lt;p&gt;反正只是拿來當跳板,不會有什麼流量、運算產生,可以一直保持免費的狀態&lt;/p&gt;</description>
</item> </item>
@ -543,15 +430,10 @@
<guid>https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/</guid> <guid>https://h.cowbay.org/post/multiple-site-to-site-vpn-using-wireguard/</guid>
<description>&lt;p&gt;因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN&lt;/p&gt; <description>&lt;p&gt;因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN&lt;/p&gt;
&lt;p&gt;雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了&lt;/p&gt; &lt;p&gt;雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了&lt;/p&gt;
&lt;p&gt;完全沒辦法了解當時設計的邏輯造成後續debug 困難&lt;/p&gt; &lt;p&gt;完全沒辦法了解當時設計的邏輯造成後續debug 困難&lt;/p&gt;
&lt;p&gt;可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌&lt;/p&gt; &lt;p&gt;可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌&lt;/p&gt;
&lt;p&gt;之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點&lt;/p&gt; &lt;p&gt;之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點&lt;/p&gt;
&lt;p&gt;這次試試看躲在gateway後面看看能不能建立多點的VPN環境&lt;/p&gt;</description> &lt;p&gt;這次試試看躲在gateway後面看看能不能建立多點的VPN環境&lt;/p&gt;</description>
</item> </item>
@ -562,23 +444,14 @@
<guid>https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/</guid> <guid>https://h.cowbay.org/post/site-to-site-vpn-using-wireguard-in-two-edgerouters/</guid>
<description>&lt;p&gt;之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt&lt;/p&gt; <description>&lt;p&gt;之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt&lt;/p&gt;
&lt;p&gt;然後用strongswan 來打 IPSEC site to site VPN&lt;/p&gt; &lt;p&gt;然後用strongswan 來打 IPSEC site to site VPN&lt;/p&gt;
&lt;p&gt;config 看起來不是很難 (只是看起來)&lt;/p&gt; &lt;p&gt;config 看起來不是很難 (只是看起來)&lt;/p&gt;
&lt;p&gt;但是實際上已經找不到當初的文件&lt;/p&gt; &lt;p&gt;但是實際上已經找不到當初的文件&lt;/p&gt;
&lt;p&gt;所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)&lt;/p&gt; &lt;p&gt;所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)&lt;/p&gt;
&lt;p&gt;後來採購了兩台edgerouter X 做測試&lt;/p&gt; &lt;p&gt;後來採購了兩台edgerouter X 做測試&lt;/p&gt;
&lt;p&gt;也用openvpn 成功的建立了 site to site VPN&lt;/p&gt; &lt;p&gt;也用openvpn 成功的建立了 site to site VPN&lt;/p&gt;
&lt;p&gt;本來想說 openvpn 已經夠簡單了&lt;/p&gt; &lt;p&gt;本來想說 openvpn 已經夠簡單了&lt;/p&gt;
&lt;p&gt;今天看到文章說用wireguard 可以更簡單&lt;/p&gt; &lt;p&gt;今天看到文章說用wireguard 可以更簡單&lt;/p&gt;
&lt;p&gt;於是研究了一下,發現還真的很簡單!&lt;/p&gt;</description> &lt;p&gt;於是研究了一下,發現還真的很簡單!&lt;/p&gt;</description>
</item> </item>
@ -589,16 +462,10 @@
<guid>https://h.cowbay.org/post/another-way-to-keep-ansible-log/</guid> <guid>https://h.cowbay.org/post/another-way-to-keep-ansible-log/</guid>
<description>&lt;p&gt;之前為了能夠在執行完 ansible playbook 後能有個log 可以看&lt;/p&gt; <description>&lt;p&gt;之前為了能夠在執行完 ansible playbook 後能有個log 可以看&lt;/p&gt;
&lt;p&gt;所以在每次執行的時候,都要加入 tee 的指令&lt;/p&gt; &lt;p&gt;所以在每次執行的時候,都要加入 tee 的指令&lt;/p&gt;
&lt;p&gt;像是&lt;/p&gt; &lt;p&gt;像是&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log &lt;pre&gt;&lt;code&gt;ANSIBLE_CONFIG=/home/D/ansiblecontrol/ansible.cfg /usr/local/bin/ansible-playbook /home/D/ansiblecontrol/playbook.user_client.yml --vault-password-file=/home/D/ansiblecontrol/vault.passwd -i /home/D/ansiblecontrol/inventory/production -f1 --limit tyuserclients |tee /tmp/tyuserclients.log
&lt;/code&gt;&lt;/pre&gt; &lt;/code&gt;&lt;/pre&gt;&lt;p&gt;一直都是放在crontab 裡面執行,也就沒有去管他&lt;/p&gt;
&lt;p&gt;一直都是放在crontab 裡面執行,也就沒有去管他&lt;/p&gt;
&lt;p&gt;反正也沒有人關心結果怎樣 (攤手&lt;/p&gt;</description> &lt;p&gt;反正也沒有人關心結果怎樣 (攤手&lt;/p&gt;</description>
</item> </item>
@ -609,19 +476,12 @@
<guid>https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/</guid> <guid>https://h.cowbay.org/post/send-mail-to-notify-after-pxe-install/</guid>
<description>&lt;p&gt;最近有個任務需要大量安裝client&lt;/p&gt; <description>&lt;p&gt;最近有個任務需要大量安裝client&lt;/p&gt;
&lt;p&gt;想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot&lt;/p&gt; &lt;p&gt;想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot&lt;/p&gt;
&lt;p&gt;然後選擇OS版本就可以自動進行安裝&lt;/p&gt; &lt;p&gt;然後選擇OS版本就可以自動進行安裝&lt;/p&gt;
&lt;p&gt;安裝完成後會自動重新開機接著就用ansible來做user環境設定&lt;/p&gt; &lt;p&gt;安裝完成後會自動重新開機接著就用ansible來做user環境設定&lt;/p&gt;
&lt;p&gt;PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了&lt;/p&gt; &lt;p&gt;PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了&lt;/p&gt;
&lt;p&gt;可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機&lt;/p&gt; &lt;p&gt;可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機&lt;/p&gt;
&lt;p&gt;就送出一封郵件來通知我說已經完成安裝可以執行ansible 了&lt;/p&gt; &lt;p&gt;就送出一封郵件來通知我說已經完成安裝可以執行ansible 了&lt;/p&gt;
&lt;p&gt;看似很簡單的一件事情,卻搞了我兩天&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;看似很簡單的一件事情,卻搞了我兩天&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -632,11 +492,8 @@
<guid>https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/</guid> <guid>https://h.cowbay.org/post/ansible-run-task-depends-on-ipaddr/</guid>
<description>&lt;p&gt;因為工作上的需要要修改client端的 /etc/environment 檔案&lt;/p&gt; <description>&lt;p&gt;因為工作上的需要要修改client端的 /etc/environment 檔案&lt;/p&gt;
&lt;p&gt;在有權限使用proxy 服務的user的環境中加入proxy 的設定&lt;/p&gt; &lt;p&gt;在有權限使用proxy 服務的user的環境中加入proxy 的設定&lt;/p&gt;
&lt;p&gt;原本的清單中有host/user/ip 這幾個值可以拿來判斷&lt;/p&gt; &lt;p&gt;原本的清單中有host/user/ip 這幾個值可以拿來判斷&lt;/p&gt;
&lt;p&gt;proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment&lt;/p&gt;</description> &lt;p&gt;proxy server 那邊是採用ip 來控制,所以這邊也跟著用 ip 來判斷要不要修改 /etc/environment&lt;/p&gt;</description>
</item> </item>
@ -647,9 +504,7 @@
<guid>https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr-from-list-in-dictionary/</guid>
<description>&lt;p&gt;在ansible中關於如何引用自定義的變數一直讓我很頭疼&lt;/p&gt; <description>&lt;p&gt;在ansible中關於如何引用自定義的變數一直讓我很頭疼&lt;/p&gt;
&lt;p&gt;尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數&lt;/p&gt; &lt;p&gt;尤其是有牽涉到從外部導入yaml檔案時更是常常讓我不知道到底該怎麼抓出想要的變數&lt;/p&gt;
&lt;p&gt;這次還是用selectattr 來處理,希望下次能夠記得&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;這次還是用selectattr 來處理,希望下次能夠記得&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -660,13 +515,9 @@
<guid>https://h.cowbay.org/post/remote-management-system-meshcentral/</guid> <guid>https://h.cowbay.org/post/remote-management-system-meshcentral/</guid>
<description>&lt;p&gt;之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體&lt;/p&gt; <description>&lt;p&gt;之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體&lt;/p&gt;
&lt;p&gt;但是如果要過 internet 就會碰到各種開port的問題&lt;/p&gt; &lt;p&gt;但是如果要過 internet 就會碰到各種開port的問題&lt;/p&gt;
&lt;p&gt;在這種環境下,就有了當時 teamviewer 的橫空出世&lt;/p&gt; &lt;p&gt;在這種環境下,就有了當時 teamviewer 的橫空出世&lt;/p&gt;
&lt;p&gt;解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多&lt;/p&gt; &lt;p&gt;解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多&lt;/p&gt;
&lt;p&gt;只要下載teamviewer被控端開啟後報ID 給協助者就好了&lt;/p&gt;</description> &lt;p&gt;只要下載teamviewer被控端開啟後報ID 給協助者就好了&lt;/p&gt;</description>
</item> </item>
@ -677,15 +528,10 @@
<guid>https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/</guid> <guid>https://h.cowbay.org/post/install-asus-10g-nic-in-proxmox/</guid>
<description>&lt;p&gt;前幾天接的一個case&lt;/p&gt; <description>&lt;p&gt;前幾天接的一個case&lt;/p&gt;
&lt;p&gt;因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)&lt;/p&gt; &lt;p&gt;因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)&lt;/p&gt;
&lt;p&gt;改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)&lt;/p&gt; &lt;p&gt;改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)&lt;/p&gt;
&lt;p&gt;storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C&lt;/p&gt; &lt;p&gt;storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C&lt;/p&gt;
&lt;p&gt;既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡&lt;/p&gt; &lt;p&gt;既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡&lt;/p&gt;
&lt;p&gt;一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡&lt;/p&gt;</description> &lt;p&gt;一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡&lt;/p&gt;</description>
</item> </item>
@ -696,7 +542,6 @@
<guid>https://h.cowbay.org/post/change-timezone-in-docker/</guid> <guid>https://h.cowbay.org/post/change-timezone-in-docker/</guid>
<description>&lt;p&gt;最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致&lt;/p&gt; <description>&lt;p&gt;最近一直在玩一些docker不過老是會碰到歪果扔寫的東西時區都不一致&lt;/p&gt;
&lt;p&gt;有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;有的用 UTC有的用localtime就是沒碰到用 Asia/Taipei 的&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -707,11 +552,8 @@
<guid>https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/</guid> <guid>https://h.cowbay.org/post/transfer-file-content-using-xclip-in-terminal/</guid>
<description>&lt;p&gt;工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。&lt;/p&gt; <description>&lt;p&gt;工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。&lt;/p&gt;
&lt;p&gt;以前都是傻傻的用 scp 傳檔案&lt;/p&gt; &lt;p&gt;以前都是傻傻的用 scp 傳檔案&lt;/p&gt;
&lt;p&gt;之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行&lt;/p&gt; &lt;p&gt;之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行&lt;/p&gt;
&lt;p&gt;早上研究了一下,順便做個筆記。&lt;/p&gt;</description> &lt;p&gt;早上研究了一下,順便做個筆記。&lt;/p&gt;</description>
</item> </item>
@ -722,13 +564,9 @@
<guid>https://h.cowbay.org/post/inx-collect-detail-hardware-info/</guid> <guid>https://h.cowbay.org/post/inx-collect-detail-hardware-info/</guid>
<description>&lt;p&gt;最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&amp;hellip;.&lt;/p&gt; <description>&lt;p&gt;最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&amp;hellip;.&lt;/p&gt;
&lt;p&gt;然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著&lt;/p&gt; &lt;p&gt;然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著&lt;/p&gt;
&lt;p&gt;所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!&lt;/p&gt; &lt;p&gt;所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!&lt;/p&gt;
&lt;p&gt;也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了&lt;/p&gt; &lt;p&gt;也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了&lt;/p&gt;
&lt;p&gt;然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!&lt;/p&gt;</description> &lt;p&gt;然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!&lt;/p&gt;</description>
</item> </item>
@ -739,11 +577,8 @@
<guid>https://h.cowbay.org/post/log-all-bash-commands/</guid> <guid>https://h.cowbay.org/post/log-all-bash-commands/</guid>
<description>&lt;p&gt;今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案&lt;/p&gt; <description>&lt;p&gt;今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案&lt;/p&gt;
&lt;p&gt;居然不知為何自己產生了,在我記憶中沒有去執行過那個指令&lt;/p&gt; &lt;p&gt;居然不知為何自己產生了,在我記憶中沒有去執行過那個指令&lt;/p&gt;
&lt;p&gt;翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)&lt;/p&gt; &lt;p&gt;翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)&lt;/p&gt;
&lt;p&gt;所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份&lt;/p&gt;</description> &lt;p&gt;所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份&lt;/p&gt;</description>
</item> </item>
@ -754,9 +589,7 @@
<guid>https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/</guid> <guid>https://h.cowbay.org/post/fix-zpool-device-busy-using-dmsetup/</guid>
<description>&lt;p&gt;今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試&lt;/p&gt; <description>&lt;p&gt;今天把其中一台proxmox 加上10G 光纖網卡準備和另一台proxmox 組成10G 環境進行測試&lt;/p&gt;
&lt;p&gt;想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate&lt;/p&gt; &lt;p&gt;想說把本機的zpool 拆掉重新建立一個raid0 的空間來做clone/migrate&lt;/p&gt;
&lt;p&gt;可是一直出現device busy的錯誤訊息&lt;/p&gt;</description> &lt;p&gt;可是一直出現device busy的錯誤訊息&lt;/p&gt;</description>
</item> </item>
@ -767,7 +600,6 @@
<guid>https://h.cowbay.org/post/transfer-cent62-using-rsync/</guid> <guid>https://h.cowbay.org/post/transfer-cent62-using-rsync/</guid>
<description>&lt;p&gt;公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。&lt;/p&gt; <description>&lt;p&gt;公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。&lt;/p&gt;
&lt;p&gt;看起來不難搞,事實上&amp;hellip;..&lt;/p&gt;</description> &lt;p&gt;看起來不難搞,事實上&amp;hellip;..&lt;/p&gt;</description>
</item> </item>
@ -778,9 +610,7 @@
<guid>https://h.cowbay.org/post/command_to_test_main_ssl/</guid> <guid>https://h.cowbay.org/post/command_to_test_main_ssl/</guid>
<description>&lt;p&gt;今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信&lt;/p&gt; <description>&lt;p&gt;今天老闆出國發slack說手機不能寄信看了一下似乎是因為用GMAIL的APP來收信&lt;/p&gt;
&lt;p&gt;然後google 不知道跟人家改了什麼,結果不接受原本的認證了&amp;hellip; WTF &amp;hellip;.&lt;/p&gt; &lt;p&gt;然後google 不知道跟人家改了什麼,結果不接受原本的認證了&amp;hellip; WTF &amp;hellip;.&lt;/p&gt;
&lt;p&gt;然後,這問題應該很久了,結果現在才在講 &amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;然後,這問題應該很久了,結果現在才在講 &amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -791,11 +621,8 @@
<guid>https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/</guid> <guid>https://h.cowbay.org/post/install-timeshift-on-ubuntu1804/</guid>
<description>&lt;p&gt;最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook&lt;/p&gt; <description>&lt;p&gt;最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook&lt;/p&gt;
&lt;p&gt;因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體&lt;/p&gt; &lt;p&gt;因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體&lt;/p&gt;
&lt;p&gt;可以很簡單快速的備份、恢復系統狀態&lt;/p&gt; &lt;p&gt;可以很簡單快速的備份、恢復系統狀態&lt;/p&gt;
&lt;p&gt;可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&amp;hellip;.&lt;/p&gt;</description> &lt;p&gt;可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&amp;hellip;.&lt;/p&gt;</description>
</item> </item>
@ -806,7 +633,6 @@
<guid>https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/</guid> <guid>https://h.cowbay.org/post/install-ubuntu1804-on-dell-6ir-raid-controller/</guid>
<description>&lt;p&gt;買了一張 DELL 6/iR 低階的raid 卡&lt;/p&gt; <description>&lt;p&gt;買了一張 DELL 6/iR 低階的raid 卡&lt;/p&gt;
&lt;p&gt;來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -817,9 +643,7 @@
<guid>https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/</guid> <guid>https://h.cowbay.org/post/ubuntu-1804-install-root-on-raid/</guid>
<description>&lt;p&gt;最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上&lt;/p&gt; <description>&lt;p&gt;最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上&lt;/p&gt;
&lt;p&gt;因為新開的機器大部分都是在proxmox上所以很少碰實體機器了&lt;/p&gt; &lt;p&gt;因為新開的機器大部分都是在proxmox上所以很少碰實體機器了&lt;/p&gt;
&lt;p&gt;結果在安裝過程中做raid碰到一些問題來紀錄一下&lt;/p&gt;</description> &lt;p&gt;結果在安裝過程中做raid碰到一些問題來紀錄一下&lt;/p&gt;</description>
</item> </item>
@ -830,11 +654,8 @@
<guid>https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/</guid> <guid>https://h.cowbay.org/post/smartd-failed-to-start-in-freenas/</guid>
<description>&lt;p&gt;這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp;amp; Server Backup&lt;/p&gt; <description>&lt;p&gt;這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp;amp; Server Backup&lt;/p&gt;
&lt;p&gt;因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10&lt;/p&gt; &lt;p&gt;因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10&lt;/p&gt;
&lt;p&gt;然後把Freenas 安裝在隨身碟上&lt;/p&gt; &lt;p&gt;然後把Freenas 安裝在隨身碟上&lt;/p&gt;
&lt;p&gt;不過會一直出現Smartd failed to start 的錯誤訊息&lt;/p&gt;</description> &lt;p&gt;不過會一直出現Smartd failed to start 的錯誤訊息&lt;/p&gt;</description>
</item> </item>
@ -845,13 +666,9 @@
<guid>https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/</guid> <guid>https://h.cowbay.org/post/incredibly-slow-mdadm-rebuild/</guid>
<description>&lt;p&gt;最近在做一台老機器的P2V&lt;/p&gt; <description>&lt;p&gt;最近在做一台老機器的P2V&lt;/p&gt;
&lt;p&gt;偏偏user說不能關機所以我用dd + ssh 做線上移轉&lt;/p&gt; &lt;p&gt;偏偏user說不能關機所以我用dd + ssh 做線上移轉&lt;/p&gt;
&lt;p&gt;這部份有空再來寫&lt;/p&gt; &lt;p&gt;這部份有空再來寫&lt;/p&gt;
&lt;p&gt;只是因為原來的設定有用mdadm 做raid1&lt;/p&gt; &lt;p&gt;只是因為原來的設定有用mdadm 做raid1&lt;/p&gt;
&lt;p&gt;這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機&lt;/p&gt;</description> &lt;p&gt;這部份導致移轉過去proxmox 後會出現raid degrade 導致無法正常開機&lt;/p&gt;</description>
</item> </item>
@ -862,11 +679,8 @@
<guid>https://h.cowbay.org/post/create-portable-vim-environment/</guid> <guid>https://h.cowbay.org/post/create-portable-vim-environment/</guid>
<description>&lt;p&gt;因為工作的關係現在很多時間都花在VIM的操作上&lt;/p&gt; <description>&lt;p&gt;因為工作的關係現在很多時間都花在VIM的操作上&lt;/p&gt;
&lt;p&gt;所以之前花了滿多時間調整出一個適合自己的VIM環境&lt;/p&gt; &lt;p&gt;所以之前花了滿多時間調整出一個適合自己的VIM環境&lt;/p&gt;
&lt;p&gt;原本的作法是把這個設定好的環境丟到自己建立的gitea 上面&lt;/p&gt; &lt;p&gt;原本的作法是把這個設定好的環境丟到自己建立的gitea 上面&lt;/p&gt;
&lt;p&gt;然後每到一台新的機器就要去clone 下來&lt;/p&gt;</description> &lt;p&gt;然後每到一台新的機器就要去clone 下來&lt;/p&gt;</description>
</item> </item>
@ -877,19 +691,12 @@
<guid>https://h.cowbay.org/post/synology-ds415-repair-cost/</guid> <guid>https://h.cowbay.org/post/synology-ds415-repair-cost/</guid>
<description>&lt;p&gt;前幾天公司的一台 Synology DS 415+ 發生異常&lt;/p&gt; <description>&lt;p&gt;前幾天公司的一台 Synology DS 415+ 發生異常&lt;/p&gt;
&lt;p&gt;注意到的時候,四顆硬碟燈號都不斷的在閃爍&lt;/p&gt; &lt;p&gt;注意到的時候,四顆硬碟燈號都不斷的在閃爍&lt;/p&gt;
&lt;p&gt;但是已經無法登入系統&lt;/p&gt; &lt;p&gt;但是已經無法登入系統&lt;/p&gt;
&lt;p&gt;重開機之後更慘,四顆硬碟燈號全部橘燈恆亮&lt;/p&gt; &lt;p&gt;重開機之後更慘,四顆硬碟燈號全部橘燈恆亮&lt;/p&gt;
&lt;p&gt;底下的電源藍燈不斷的在閃爍&lt;/p&gt; &lt;p&gt;底下的電源藍燈不斷的在閃爍&lt;/p&gt;
&lt;p&gt;雖然我一再表示不希望送修了&lt;/p&gt; &lt;p&gt;雖然我一再表示不希望送修了&lt;/p&gt;
&lt;p&gt;一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&amp;hellip;&lt;/p&gt; &lt;p&gt;一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&amp;hellip;&lt;/p&gt;
&lt;p&gt;不過主管還是希望能夠先問群暉維修的費用多少&lt;/p&gt;</description> &lt;p&gt;不過主管還是希望能夠先問群暉維修的費用多少&lt;/p&gt;</description>
</item> </item>
@ -900,21 +707,13 @@
<guid>https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/</guid> <guid>https://h.cowbay.org/post/10g-lab-using-proxmox-and-mellanox/</guid>
<description>&lt;p&gt;想做一個 10G 的 LAB 環境出來已經很久了。&lt;/p&gt; <description>&lt;p&gt;想做一個 10G 的 LAB 環境出來已經很久了。&lt;/p&gt;
&lt;p&gt;只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜&lt;/p&gt; &lt;p&gt;只是礙於10G RJ45的卡太貴了然後光纖的種類又太複雜&lt;/p&gt;
&lt;p&gt;如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)&lt;/p&gt; &lt;p&gt;如果直接在淘寶購買,很怕會買錯(什麼LC/FC LC/LC 多模單模 單芯雙芯 SFP/SFP+ 又是什麼光模塊的一大堆規格)&lt;/p&gt;
&lt;p&gt;所以一直沒有付諸行動。&lt;/p&gt; &lt;p&gt;所以一直沒有付諸行動。&lt;/p&gt;
&lt;p&gt;硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)&lt;/p&gt; &lt;p&gt;硬體的工作很久沒碰了,剛好在蝦皮看到有個賣家在賣 mellanox 的X2網卡以在台灣的價格來說算很便宜的 (550)&lt;/p&gt;
&lt;p&gt;聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位&lt;/p&gt; &lt;p&gt;聊了一下,跟他請教了關於線材、光纖模塊的問題,回答也都很快很到位&lt;/p&gt;
&lt;p&gt;就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線&lt;/p&gt; &lt;p&gt;就直接下訂了兩張網卡、兩個光纖模塊、一條LC/LC 光纖線&lt;/p&gt;
&lt;p&gt;就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到&lt;/p&gt; &lt;p&gt;就是到貨有點久,等了兩個禮拜左右,一直到昨天東西才寄到&lt;/p&gt;
&lt;p&gt;今天就花了點時間測試一下&lt;/p&gt;</description> &lt;p&gt;今天就花了點時間測試一下&lt;/p&gt;</description>
</item> </item>
@ -925,9 +724,7 @@
<guid>https://h.cowbay.org/post/ansible-selectattr-filter/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr-filter/</guid>
<description>&lt;p&gt;在上一篇 &lt;a href=&#34;https://h.cowbay.org/post/ansible-selectattr/&#34;&gt;Ansible how to use &amp;lsquo;list&amp;rsquo; in yaml file &lt;/a&gt;&lt;/p&gt; <description>&lt;p&gt;在上一篇 &lt;a href=&#34;https://h.cowbay.org/post/ansible-selectattr/&#34;&gt;Ansible how to use &amp;lsquo;list&amp;rsquo; in yaml file &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單&lt;/p&gt; &lt;p&gt;有提到怎麼用 with_items / set_fact 來取得在yaml 檔案中的清單&lt;/p&gt;
&lt;p&gt;不過就是有點醜&lt;/p&gt;</description> &lt;p&gt;不過就是有點醜&lt;/p&gt;</description>
</item> </item>
@ -938,11 +735,8 @@
<guid>https://h.cowbay.org/post/ansible-selectattr/</guid> <guid>https://h.cowbay.org/post/ansible-selectattr/</guid>
<description>&lt;p&gt;這幾天在玩ansible 時,碰到一個問題&lt;/p&gt; <description>&lt;p&gt;這幾天在玩ansible 時,碰到一個問題&lt;/p&gt;
&lt;p&gt;假如我有個yaml檔作為資料來源檔名是 abc.yml&lt;/p&gt; &lt;p&gt;假如我有個yaml檔作為資料來源檔名是 abc.yml&lt;/p&gt;
&lt;p&gt;大概長這樣&lt;/p&gt; &lt;p&gt;大概長這樣&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; &amp;quot;teams&amp;quot;: [ &lt;pre&gt;&lt;code&gt; &amp;quot;teams&amp;quot;: [
{ {
&amp;quot;chinese_name&amp;quot;: &amp;quot;TEAM1&amp;quot;, &amp;quot;chinese_name&amp;quot;: &amp;quot;TEAM1&amp;quot;,
@ -990,11 +784,8 @@
<guid>https://h.cowbay.org/post/change-preferred-language-in-firefox/</guid> <guid>https://h.cowbay.org/post/change-preferred-language-in-firefox/</guid>
<description>&lt;p&gt;最近在測試metabase記得幾個月前就有測試過&lt;/p&gt; <description>&lt;p&gt;最近在測試metabase記得幾個月前就有測試過&lt;/p&gt;
&lt;p&gt;但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的&lt;/p&gt; &lt;p&gt;但是當時的界面和現在的樣子差很多,看樣子改版還滿勤勞的&lt;/p&gt;
&lt;p&gt;所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)&lt;/p&gt; &lt;p&gt;所以這次改用docker來建立根本五分鐘不到就建好了(挖鼻孔)&lt;/p&gt;
&lt;p&gt;不過呢,很討厭的是,一進去就發現語系採用的是簡體中文&lt;/p&gt;</description> &lt;p&gt;不過呢,很討厭的是,一進去就發現語系採用的是簡體中文&lt;/p&gt;</description>
</item> </item>
@ -1005,11 +796,8 @@
<guid>https://h.cowbay.org/post/copy_role_in_pgsql/</guid> <guid>https://h.cowbay.org/post/copy_role_in_pgsql/</guid>
<description>&lt;p&gt;因為工作上的需求有個資料庫需要開放給不同team的人去存取&lt;/p&gt; <description>&lt;p&gt;因為工作上的需求有個資料庫需要開放給不同team的人去存取&lt;/p&gt;
&lt;p&gt;雖然都是在同一台機器上的同一個資料庫&lt;/p&gt; &lt;p&gt;雖然都是在同一台機器上的同一個資料庫&lt;/p&gt;
&lt;p&gt;但是希望能夠不同team的人用不同的資料庫使用者&lt;/p&gt; &lt;p&gt;但是希望能夠不同team的人用不同的資料庫使用者&lt;/p&gt;
&lt;p&gt;這樣萬一出事,會比較好抓兇手??&lt;/p&gt;</description> &lt;p&gt;這樣萬一出事,會比較好抓兇手??&lt;/p&gt;</description>
</item> </item>
@ -1020,17 +808,11 @@
<guid>https://h.cowbay.org/post/weird-client-server-connection/</guid> <guid>https://h.cowbay.org/post/weird-client-server-connection/</guid>
<description>&lt;p&gt;這是發生在一個夜黑風高的寂寥深夜&amp;hellip;.. ( What The FXXX &amp;hellip; )&lt;/p&gt; <description>&lt;p&gt;這是發生在一個夜黑風高的寂寥深夜&amp;hellip;.. ( What The FXXX &amp;hellip; )&lt;/p&gt;
&lt;p&gt;來到這個環境之後,有一個很詭異的狀況一直困擾著我&lt;/p&gt; &lt;p&gt;來到這個環境之後,有一個很詭異的狀況一直困擾著我&lt;/p&gt;
&lt;p&gt;在每個分公司都會有一台伺服器作為KVM Host&lt;/p&gt; &lt;p&gt;在每個分公司都會有一台伺服器作為KVM Host&lt;/p&gt;
&lt;p&gt;上面跑兩台VM一台作為ansible controller (目前沒作用)&lt;/p&gt; &lt;p&gt;上面跑兩台VM一台作為ansible controller (目前沒作用)&lt;/p&gt;
&lt;p&gt;另一台作為這邊所謂的 &amp;ldquo;Build Server&amp;rdquo;&lt;/p&gt; &lt;p&gt;另一台作為這邊所謂的 &amp;ldquo;Build Server&amp;rdquo;&lt;/p&gt;
&lt;p&gt;用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)&lt;/p&gt; &lt;p&gt;用途包含了DHCP Server / Proxy Server (squid3) / APT Proxy (squid-deb-proxy)&lt;/p&gt;
&lt;p&gt;問題就發生在這台 Build Server 上&amp;hellip;&lt;/p&gt;</description> &lt;p&gt;問題就發生在這台 Build Server 上&amp;hellip;&lt;/p&gt;</description>
</item> </item>
@ -1054,22 +836,14 @@
<pubDate>Tue, 06 Nov 2018 14:57:14 +0800</pubDate> <pubDate>Tue, 06 Nov 2018 14:57:14 +0800</pubDate>
<guid>https://h.cowbay.org/post/bookstack-docker/</guid> <guid>https://h.cowbay.org/post/bookstack-docker/</guid>
<description>&lt;p&gt;Bookstack 是一套非常好用的線上&amp;rdquo;筆記&amp;rdquo;系統&lt;/p&gt; <description>&lt;p&gt;Bookstack 是一套非常好用的線上&amp;quot;筆記&amp;quot;系統&lt;/p&gt;
&lt;p&gt;他用圖書館/書本的概念,讓使用者可以建立自己的&amp;quot;圖書館&amp;rdquo;&lt;/p&gt;
&lt;p&gt;他用圖書館/書本的概念,讓使用者可以建立自己的&amp;rdquo;圖書館&amp;rdquo;&lt;/p&gt; &lt;p&gt;同時在圖書館內建立不同的&amp;quot;書籍&amp;rdquo;&lt;/p&gt;
&lt;p&gt;同時在圖書館內建立不同的&amp;rdquo;書籍&amp;rdquo;&lt;/p&gt;
&lt;p&gt;而且支援 Markdown 語法&lt;/p&gt; &lt;p&gt;而且支援 Markdown 語法&lt;/p&gt;
&lt;p&gt;其他的方式像是在nextcloud上編輯 md檔案(字體太小)&lt;/p&gt; &lt;p&gt;其他的方式像是在nextcloud上編輯 md檔案(字體太小)&lt;/p&gt;
&lt;p&gt;或者是boostnote(只能在本機)&lt;/p&gt; &lt;p&gt;或者是boostnote(只能在本機)&lt;/p&gt;
&lt;p&gt;都或多或少有點小缺點&lt;/p&gt; &lt;p&gt;都或多或少有點小缺點&lt;/p&gt;
&lt;p&gt;Bookstack則是沒有這些問題不過就是系統「大」了點&amp;hellip;&lt;/p&gt; &lt;p&gt;Bookstack則是沒有這些問題不過就是系統「大」了點&amp;hellip;&lt;/p&gt;
&lt;p&gt;不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)&lt;/p&gt;</description> &lt;p&gt;不過還好有人做成docker的方式來啟動大大的降低了建置的難度(其實也沒有很難啦只是要裝個PHP、弄個DB而已)&lt;/p&gt;</description>
</item> </item>
@ -1081,16 +855,11 @@
<guid>https://h.cowbay.org/post/enable-synology-public-ssh/</guid> <guid>https://h.cowbay.org/post/enable-synology-public-ssh/</guid>
<description>&lt;p&gt;公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file <description>&lt;p&gt;公司內有幾台NAS其中有一台用來放開發人員的postgresql dump file
之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來&lt;/p&gt; 之前都是主要的開發人員上傳到google drive分享出來 ,然後其他人去抓回來&lt;/p&gt;
&lt;p&gt;這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體 &lt;p&gt;這樣子有個問題是當server要存取這些檔案時就沒辦法了除非透過一些 3rd party的軟體
像是這篇&lt;/p&gt; 像是這篇&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&#34;&gt;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&#34;&gt;https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;或者是這篇&lt;/p&gt; &lt;p&gt;或者是這篇&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.maketecheasier.com/mount-google-drive-ubuntu/&#34;&gt;https://www.maketecheasier.com/mount-google-drive-ubuntu/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;https://www.maketecheasier.com/mount-google-drive-ubuntu/&#34;&gt;https://www.maketecheasier.com/mount-google-drive-ubuntu/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;但是手邊的伺服器原則上除非有必要不然都沒有開放internet &lt;p&gt;但是手邊的伺服器原則上除非有必要不然都沒有開放internet
所以導致明明檔案就在那邊,但是要取得就是很麻煩&lt;/p&gt;</description> 所以導致明明檔案就在那邊,但是要取得就是很麻煩&lt;/p&gt;</description>
</item> </item>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "Install Asus 10G NIC XG-C100C in Proxmox", "name" : "Install Asus 10G NIC XG-C100C in Proxmox",
"headline" : "Install Asus 10G NIC XG-C100C in Proxmox", "headline" : "Install Asus 10G NIC XG-C100C in Proxmox",
"description" : "\x3cp\x3e前幾天接的一個case\x3c\/p\x3e\n\n\x3cp\x3e因為費用的關係所以沒有考慮用傳統定義上的伺服器(DELL R640)\x3c\/p\x3e\n\n\x3cp\x3e改採用比較高階一點的洋垃圾規格大概是 Intel E5-2680V2 x2 \x2b 64G RAM \x2b 128G SSD x2 (OS) \x2b 960G SSD x4 (raid 10 , zfs)\x3c\/p\x3e\n\n\x3cp\x3estorage 選擇QNAP NAS TS-932X \x2b 960G SSD x 4 (raid 10 , NFS) \x2b QNAP 10G Switch QSW-1280C-8C\x3c\/p\x3e\n\n\x3cp\x3e既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡\x3c\/p\x3e\n\n\x3cp\x3e一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡\x3c\/p\x3e", "description" : "\x3cp\x3e前幾天接的一個case\x3c\/p\x3e\n\x3cp\x3e因為費用的關係所以沒有考慮用傳統定義上的伺服器(DELL R640)\x3c\/p\x3e\n\x3cp\x3e改採用比較高階一點的洋垃圾規格大概是 Intel E5-2680V2 x2 \x2b 64G RAM \x2b 128G SSD x2 (OS) \x2b 960G SSD x4 (raid 10 , zfs)\x3c\/p\x3e\n\x3cp\x3estorage 選擇QNAP NAS TS-932X \x2b 960G SSD x 4 (raid 10 , NFS) \x2b QNAP 10G Switch QSW-1280C-8C\x3c\/p\x3e\n\x3cp\x3e既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡\x3c\/p\x3e\n\x3cp\x3e一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,34 +305,19 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>前幾天接的一個case</p> <p>前幾天接的一個case</p>
<p>因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)</p> <p>因為費用的關係,所以沒有考慮用傳統定義上的伺服器(DELL R640)</p>
<p>改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)</p> <p>改採用比較高階一點的洋垃圾,規格大概是 Intel E5-2680V2 x2 + 64G RAM + 128G SSD x2 (OS) + 960G SSD x4 (raid 10 , zfs)</p>
<p>storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C</p> <p>storage 選擇QNAP NAS TS-932X + 960G SSD x 4 (raid 10 , NFS) + QNAP 10G Switch QSW-1280C-8C</p>
<p>既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡</p> <p>既然storage這邊選用了10G的機種伺服器上當然也要增加10G網卡</p>
<p>一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡</p> <p>一樣成本考量就不用INTEL 了,買了這張 ASUS 10G 網卡</p>
<p><a href="https://24h.pchome.com.tw/prod/DRAF01-A90088CKR">https://24h.pchome.com.tw/prod/DRAF01-A90088CKR</a></p> <p><a href="https://24h.pchome.com.tw/prod/DRAF01-A90088CKR">https://24h.pchome.com.tw/prod/DRAF01-A90088CKR</a></p>
<p>結果&hellip;. debian9 預設抓不到這張卡啊!</p> <p>結果&hellip;. debian9 預設抓不到這張卡啊!</p>
<p>本來想說要退貨了想想還是先google 好了,還真的有人碰到一樣的問題</p> <p>本來想說要退貨了想想還是先google 好了,還真的有人碰到一樣的問題</p>
<p>底下就大概說一下怎麼解決</p> <p>底下就大概說一下怎麼解決</p>
<p>###安裝相關套件###</p> <p>###安裝相關套件###</p>
<p>登入proxmox 主機後,執行以下指令安裝套件</p> <p>登入proxmox 主機後,執行以下指令安裝套件</p>
<pre><code>apt install linux-headers build-essential git make gcc <pre><code>apt install linux-headers build-essential git make gcc
</code></pre> </code></pre><p>然後馬上就卡關了 XD</p>
<p>然後馬上就卡關了 XD</p>
<pre><code>root@pve:~# apt install linux-headers <pre><code>root@pve:~# apt install linux-headers
Reading package lists... Done Reading package lists... Done
Building dependency tree Building dependency tree
@ -392,41 +373,21 @@ You should explicitly select one to install.
E: Package 'linux-headers' has no installation candidate E: Package 'linux-headers' has no installation candidate
root@pve:~# root@pve:~#
</code></pre> </code></pre><h3 id="改用以下套件名稱安裝">改用以下套件名稱安裝###</h3>
<h3 id="改用以下套件名稱安裝">改用以下套件名稱安裝</h3>
<pre><code>apt install pve-headers-4.15.18-15-pve build-essential git make gcc <pre><code>apt install pve-headers-4.15.18-15-pve build-essential git make gcc
</code></pre> </code></pre><p>第一個套件會隨著pve版本不同有所變化所以要看當下執行時系統提供的訊息來決定</p>
<p>第一個套件會隨著pve版本不同有所變化所以要看當下執行時系統提供的訊息來決定</p>
<p>我是用清單內最新的版本</p> <p>我是用清單內最新的版本</p>
<p>接著把驅動程式 clone 回來</p> <p>接著把驅動程式 clone 回來</p>
<pre><code>git clone https://github.com/Aquantia/AQtion.git <pre><code>git clone https://github.com/Aquantia/AQtion.git
</code></pre> </code></pre><p>參考 README</p>
<p>參考 README</p>
<p><a href="https://github.com/Aquantia/AQtion/blob/master/README.txt">https://github.com/Aquantia/AQtion/blob/master/README.txt</a></p> <p><a href="https://github.com/Aquantia/AQtion/blob/master/README.txt">https://github.com/Aquantia/AQtion/blob/master/README.txt</a></p>
<p>進入目錄後開始編譯</p> <p>進入目錄後開始編譯</p>
<pre><code>make <pre><code>make
</code></pre> </code></pre><p>編譯完,應該就能看到網卡了,不過我是還有重開機</p>
<p>編譯完,應該就能看到網卡了,不過我是還有重開機</p>
<p>順便貼一下10G網路的速度感覺還真的&hellip;..不怎麼樣 &hellip;.</p> <p>順便貼一下10G網路的速度感覺還真的&hellip;..不怎麼樣 &hellip;.</p>
<p><img src="https://i.imgur.com/yM8HsSi.png" alt=""></p>
<p><img src="https://i.imgur.com/yM8HsSi.png" alt="" /></p>
<p>不過在做 backup/restore 的時候感覺是比之前其他沒有10G環境要快</p> <p>不過在做 backup/restore 的時候感覺是比之前其他沒有10G環境要快</p>
<p>反正這樣子買下來的硬體設備也不算太貴(比一台新的R640還便宜)</p> <p>反正這樣子買下來的硬體設備也不算太貴(比一台新的R640還便宜)</p>
<p>就先這樣子跑吧,至於洋垃圾的穩定度,就觀察看看吧..</p> <p>就先這樣子跑吧,至於洋垃圾的穩定度,就觀察看看吧..</p>
</article> </article>
</div> </div>
@ -702,7 +663,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -714,7 +675,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在ubuntu 18.04 環境下 安裝 it 850UM 讀卡機 展延自然人憑證 \/ install it 850UM Card Reader in Ubuntu 18.04", "name" : "[筆記] 在ubuntu 18.04 環境下 安裝 it 850UM 讀卡機 展延自然人憑證 \/ install it 850UM Card Reader in Ubuntu 18.04",
"headline" : "[筆記] 在ubuntu 18.04 環境下 安裝 it 850UM 讀卡機 展延自然人憑證 \/ install it 850UM Card Reader in Ubuntu 18.04", "headline" : "[筆記] 在ubuntu 18.04 環境下 安裝 it 850UM 讀卡機 展延自然人憑證 \/ install it 850UM Card Reader in Ubuntu 18.04",
"description" : "\x3cp\x3e早上忘了要幹什麼去看到手上的自然人憑證到期日是今年的 \x3csup\x3e4\x3c\/sup\x3e\x26frasl;\x3csub\x3e17\x3c\/sub\x3e\x3c\/p\x3e\n\n\x3cp\x3e想說快到期了看看能不能線上申請展延\x3c\/p\x3e\n\n\x3cp\x3e結果辦公室沒有Linux 可以用的讀卡機\x3c\/p\x3e\n\n\x3cp\x3eOOXX 咧我們可是號稱全Linux 環境捏!\x3c\/p\x3e\n\n\x3cp\x3e結果居然沒有對應的硬體\x3c\/p\x3e\n\n\x3cp\x3e於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!\x3c\/p\x3e", "description" : "\x3cp\x3e早上忘了要幹什麼去看到手上的自然人憑證到期日是今年的 4\/17\x3c\/p\x3e\n\x3cp\x3e想說快到期了看看能不能線上申請展延\x3c\/p\x3e\n\x3cp\x3e結果辦公室沒有Linux 可以用的讀卡機\x3c\/p\x3e\n\x3cp\x3eOOXX 咧我們可是號稱全Linux 環境捏!\x3c\/p\x3e\n\x3cp\x3e結果居然沒有對應的硬體\x3c\/p\x3e\n\x3cp\x3e於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -308,63 +304,36 @@ if (!doNotTrack) {
<div class="entry-container"> <div class="entry-container">
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 <sup>4</sup>&frasl;<sub>17</sub></p> <p>早上忘了要幹什麼,去看到手上的自然人憑證到期日是今年的 4/17</p>
<p>想說快到期了,看看能不能線上申請展延</p> <p>想說快到期了,看看能不能線上申請展延</p>
<p>結果辦公室沒有Linux 可以用的讀卡機</p> <p>結果辦公室沒有Linux 可以用的讀卡機</p>
<p>OOXX 咧我們可是號稱全Linux 環境捏!</p> <p>OOXX 咧我們可是號稱全Linux 環境捏!</p>
<p>結果居然沒有對應的硬體!?</p> <p>結果居然沒有對應的硬體!?</p>
<p>於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!</p> <p>於是馬上敗了一台據說有支援 Linux 的 IT 850UM 讀卡機!</p>
<p>這是購買的網頁截圖廠商號稱有支援Linux</p> <p>這是購買的網頁截圖廠商號稱有支援Linux</p>
<p><img src="https://i.imgur.com/ddAYSVD.png" alt=""></p>
<p><img src="https://i.imgur.com/ddAYSVD.png" alt="" /></p>
<p>下午到手之後直接接上去發現ubuntu 18.04 還的確真的能抓到</p> <p>下午到手之後直接接上去發現ubuntu 18.04 還的確真的能抓到</p>
<p>但是,這型號為什麼不太一樣啊???怎麼是 IT 500U ??</p> <p>但是,這型號為什麼不太一樣啊???怎麼是 IT 500U ??</p>
<p><img src="https://i.imgur.com/eZidz0h.png" alt=""></p>
<p><img src="https://i.imgur.com/eZidz0h.png" alt="" /></p>
<p>先不管,直接開自然人憑證的網頁看能不能抓到..</p> <p>先不管,直接開自然人憑證的網頁看能不能抓到..</p>
<p><a href="https://moica.nat.gov.tw/renewcert.html">https://moica.nat.gov.tw/renewcert.html</a></p> <p><a href="https://moica.nat.gov.tw/renewcert.html">https://moica.nat.gov.tw/renewcert.html</a></p>
<p>當然,事情絕對沒有那麼簡單!</p> <p>當然,事情絕對沒有那麼簡單!</p>
<p>開啟網頁之後,發現完全抓不到讀卡機!</p> <p>開啟網頁之後,發現完全抓不到讀卡機!</p>
<p>啊不是號稱支援 Linux ??</p> <p>啊不是號稱支援 Linux ??</p>
<p>於是開始翻google 看要怎麼處理</p> <p>於是開始翻google 看要怎麼處理</p>
<p>看到了這篇</p> <p>看到了這篇</p>
<p><a href="http://gholk.github.io/linux-iccard-ccid-compile.html">http://gholk.github.io/linux-iccard-ccid-compile.html</a></p> <p><a href="http://gholk.github.io/linux-iccard-ccid-compile.html">http://gholk.github.io/linux-iccard-ccid-compile.html</a></p>
<p>不過這篇主要是在說其他的讀卡機,倒不是 it 850UM</p> <p>不過這篇主要是在說其他的讀卡機,倒不是 it 850UM</p>
<p>但是一法通、萬法通!</p> <p>但是一法通、萬法通!</p>
<p>就去文章裡面提到的連結看看</p> <p>就去文章裡面提到的連結看看</p>
<p><a href="https://ccid.apdu.fr/">https://ccid.apdu.fr/</a></p> <p><a href="https://ccid.apdu.fr/">https://ccid.apdu.fr/</a></p>
<p>同樣的,要從 git 下載比較新版的code 回來自己編譯</p> <p>同樣的,要從 git 下載比較新版的code 回來自己編譯</p>
<pre><code>git clone --recursive https://salsa.debian.org/rousseau/CCID.git <pre><code>git clone --recursive https://salsa.debian.org/rousseau/CCID.git
cd CCID cd CCID
./bootstrap ./bootstrap
./configure ./configure
make make
</code></pre> </code></pre><p>然後,就報錯了!</p>
<p>然後,就報錯了!</p>
<pre><code>/home/changch/git/CCID/missing: 列 81: flex命令找不到 <pre><code>/home/changch/git/CCID/missing: 列 81: flex命令找不到
WARNING: 'flex' is missing on your system. WARNING: 'flex' is missing on your system.
You should only need it if you modified a '.l' file. You should only need it if you modified a '.l' file.
@ -378,51 +347,28 @@ make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/changch/git/CCID' make[1]: Leaving directory '/home/changch/git/CCID'
Makefile:369: recipe for target 'all' failed Makefile:369: recipe for target 'all' failed
make: *** [all] Error 2 make: *** [all] Error 2
</code></pre> </code></pre><p>少了個套件叫 flex補安裝上去</p>
<p>少了個套件叫 flex補安裝上去</p>
<pre><code>sudo apt install flex <pre><code>sudo apt install flex
</code></pre> </code></pre><p>然後再跑一次</p>
<p>然後再跑一次</p>
<pre><code>./bootstrap <pre><code>./bootstrap
./configure ./configure
make make
sudo make install sudo make install
</code></pre> </code></pre><p>跑完之後,興沖沖的就去剛剛那個自然人憑證的網頁刷新!</p>
<p>跑完之後,興沖沖的就去剛剛那個自然人憑證的網頁刷新!</p>
<p>然後還是沒抓到讀卡機 XDDDD</p> <p>然後還是沒抓到讀卡機 XDDDD</p>
<p>認份點,重新開機吧</p> <p>認份點,重新開機吧</p>
<p>重開機之後,再開啟網頁,就可以選擇讀卡機了!</p> <p>重開機之後,再開啟網頁,就可以選擇讀卡機了!</p>
<p>接下來是關於自然人憑證展延的碎碎念</p> <p>接下來是關於自然人憑證展延的碎碎念</p>
<p>在選好讀卡機、輸入個人資料(怪了,不是應該從卡片裡面讀出來嗎?)和PIN碼之後</p> <p>在選好讀卡機、輸入個人資料(怪了,不是應該從卡片裡面讀出來嗎?)和PIN碼之後</p>
<p>按下確認,然後網頁就卡住了&hellip;</p> <p>按下確認,然後網頁就卡住了&hellip;</p>
<p>發現是因為會有彈跳視窗被firefox 給攔下來,放行之後,再按一次確認</p> <p>發現是因為會有彈跳視窗被firefox 給攔下來,放行之後,再按一次確認</p>
<p>就會看到跳出來的視窗、出現「寫入憑證中」,沒多久就關閉</p> <p>就會看到跳出來的視窗、出現「寫入憑證中」,沒多久就關閉</p>
<p>又出現一個視窗,出現「讀取憑證中」,也是沒多久就關閉</p> <p>又出現一個視窗,出現「讀取憑證中」,也是沒多久就關閉</p>
<p>然後咧?然後就沒有然後了!!</p> <p>然後咧?然後就沒有然後了!!</p>
<p>視窗還在原地不動,沒有成功、沒有失敗的訊息</p> <p>視窗還在原地不動,沒有成功、沒有失敗的訊息</p>
<p>就是個發呆的網頁!什麼提示都沒有! WTF </p> <p>就是個發呆的網頁!什麼提示都沒有! WTF </p>
<p>想說有出現寫入憑證應該OK了吧關掉視窗再來一次才發現日期已經展延成功了</p> <p>想說有出現寫入憑證應該OK了吧關掉視窗再來一次才發現日期已經展延成功了</p>
<p><img src="https://i.imgur.com/Qe0Uksh.png" alt=""></p>
<p><img src="https://i.imgur.com/Qe0Uksh.png" alt="" /></p>
<p>真的是很糟糕啊!加個訊息提示很困難嗎??</p> <p>真的是很糟糕啊!加個訊息提示很困難嗎??</p>
</article> </article>
</div> </div>
@ -696,7 +642,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -708,7 +654,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在ubuntu 18.04 下安裝nvidia 顯示卡驅動程式以及 pgstrom \/ Install Nvidia Driver Cuda Pgstrom in Ubuntu 1804", "name" : "[筆記] 在ubuntu 18.04 下安裝nvidia 顯示卡驅動程式以及 pgstrom \/ Install Nvidia Driver Cuda Pgstrom in Ubuntu 1804",
"headline" : "[筆記] 在ubuntu 18.04 下安裝nvidia 顯示卡驅動程式以及 pgstrom \/ Install Nvidia Driver Cuda Pgstrom in Ubuntu 1804", "headline" : "[筆記] 在ubuntu 18.04 下安裝nvidia 顯示卡驅動程式以及 pgstrom \/ Install Nvidia Driver Cuda Pgstrom in Ubuntu 1804",
"description" : "\x3cp\x3e因為老闆說要試試看用GPU 來跑postgresql 威力\x3c\/p\x3e\n\n\x3cp\x3e手邊剛好有一張 geforce gt 720\x3c\/p\x3e\n\n\x3cp\x3e一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援\x3c\/p\x3e\n\n\x3cp\x3e就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了\x26hellip;\x3c\/p\x3e", "description" : "\x3cp\x3e因為老闆說要試試看用GPU 來跑postgresql 威力\x3c\/p\x3e\n\x3cp\x3e手邊剛好有一張 geforce gt 720\x3c\/p\x3e\n\x3cp\x3e一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援\x3c\/p\x3e\n\x3cp\x3e就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了\x26hellip;\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,42 +305,24 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>因為老闆說要試試看用GPU 來跑postgresql 威力</p> <p>因為老闆說要試試看用GPU 來跑postgresql 威力</p>
<p>手邊剛好有一張 geforce gt 720</p> <p>手邊剛好有一張 geforce gt 720</p>
<p>一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援</p> <p>一開始沒想太多看到有這張卡的驅動程式然後CUDA也有支援</p>
<p>就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&hellip;</p> <p>就直接從桌機拔下來接去LAB Server ,然後就開始一連串的難關了&hellip;</p>
<p>整個過程大致上分為四個步驟</p> <p>整個過程大致上分為四個步驟</p>
<h3 id="安裝-nvidia-driver">安裝 nvidia driver</h3> <h3 id="安裝-nvidia-driver">安裝 nvidia driver</h3>
<h3 id="安裝-cuda">安裝 CUDA</h3> <h3 id="安裝-cuda">安裝 CUDA</h3>
<h3 id="安裝-postgresql">安裝 postgresql</h3> <h3 id="安裝-postgresql">安裝 postgresql</h3>
<h3 id="安裝-pgstrom">安裝 pgstrom</h3> <h3 id="安裝-pgstrom">安裝 pgstrom</h3>
<hr>
<hr />
<h4 id="安裝-nvidia-driver-1">安裝 nvidia driver</h4> <h4 id="安裝-nvidia-driver-1">安裝 nvidia driver</h4>
<p>試過幾種方法最後還是覺得用apt來安裝比較妥當 <p>試過幾種方法最後還是覺得用apt來安裝比較妥當
先新增repository、update、裝driver</p> 先新增repository、update、裝driver</p>
<pre><code>sudo add-apt-repository ppa:graphics-drivers/ppa <pre><code>sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update sudo apt update
sudo apt install ubuntu-drivers-common sudo apt install ubuntu-drivers-common
</code></pre> </code></pre><p>然後用這個指令</p>
<p>然後用這個指令</p>
<pre><code>ubuntu-drivers devices <pre><code>ubuntu-drivers devices
</code></pre> </code></pre><p>看一下現在的驅動程式狀態</p>
<p>看一下現在的驅動程式狀態</p>
<pre><code>administrator@hqdc032:~/pg-strom$ ubuntu-drivers devices <pre><code>administrator@hqdc032:~/pg-strom$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 == == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001288sv0000174Bsd0000326Bbc03sc00i00 modalias : pci:v000010DEd00001288sv0000174Bsd0000326Bbc03sc00i00
@ -357,22 +335,13 @@ driver : nvidia-driver-430 - third-party free recommended
driver : nvidia-driver-390 - third-party free driver : nvidia-driver-390 - third-party free
driver : nvidia-driver-415 - third-party free driver : nvidia-driver-415 - third-party free
driver : xserver-xorg-video-nouveau - distro free builtin driver : xserver-xorg-video-nouveau - distro free builtin
</code></pre> </code></pre><p>我這張卡,可以裝到 430 的版本,
<p>我這張卡,可以裝到 430 的版本,
接下來就繼續安裝驅動程式、裝完之後重開機</p> 接下來就繼續安裝驅動程式、裝完之後重開機</p>
<pre><code>sudo apt install nvidia-driver-430 <pre><code>sudo apt install nvidia-driver-430
sudo reboot sudo reboot
</code></pre> </code></pre><p>這時候,應該可以看到一些基本資訊</p>
<p>這時候,應該可以看到一些基本資訊</p>
<pre><code>lsmod|grep nvidia <pre><code>lsmod|grep nvidia
</code></pre> </code></pre><p>大概長這樣</p>
<p>大概長這樣</p>
<pre><code>nvidia_uvm 798720 0 <pre><code>nvidia_uvm 798720 0
nvidia_drm 45056 3 nvidia_drm 45056 3
nvidia_modeset 1093632 7 nvidia_drm nvidia_modeset 1093632 7 nvidia_drm
@ -380,22 +349,13 @@ nvidia 18194432 258 nvidia_uvm,nvidia_modeset
drm_kms_helper 172032 1 nvidia_drm drm_kms_helper 172032 1 nvidia_drm
drm 401408 6 drm_kms_helper,nvidia_drm drm 401408 6 drm_kms_helper,nvidia_drm
ipmi_msghandler 53248 2 ipmi_devintf,nvidia ipmi_msghandler 53248 2 ipmi_devintf,nvidia
</code></pre> </code></pre><p>到這邊 nvidia 驅動程式安裝完成,接下來安裝 cuda</p>
<p>到這邊 nvidia 驅動程式安裝完成,接下來安裝 cuda</p>
<h4 id="安裝-cuda-1">安裝 CUDA</h4> <h4 id="安裝-cuda-1">安裝 CUDA</h4>
<p>同樣採用官網下載deb 回來安裝的方法</p> <p>同樣採用官網下載deb 回來安裝的方法</p>
<p>到這邊 <a href="https://developer.nvidia.com/cuda-downloads">https://developer.nvidia.com/cuda-downloads</a></p> <p>到這邊 <a href="https://developer.nvidia.com/cuda-downloads">https://developer.nvidia.com/cuda-downloads</a></p>
<p>依照自己的系統選擇</p> <p>依照自己的系統選擇</p>
<p>我選擇 Linux &ndash; x86_64 &ndash; Ubuntu &ndash; 18.04 &ndash; deb(local)</p> <p>我選擇 Linux &ndash; x86_64 &ndash; Ubuntu &ndash; 18.04 &ndash; deb(local)</p>
<p>畫面上就會有安裝步驟,照著做就沒問題了</p> <p>畫面上就會有安裝步驟,照著做就沒問題了</p>
<pre><code>wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin <pre><code>wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600 sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
@ -403,16 +363,10 @@ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub
sudo apt-get update sudo apt-get update
sudo apt-get -y install cuda sudo apt-get -y install cuda
</code></pre> </code></pre><p>一樣,安裝完成後重新開機,然後來編譯一個 deviceQuery 的小程式來看看資訊</p>
<p>一樣,安裝完成後重新開機,然後來編譯一個 deviceQuery 的小程式來看看資訊</p>
<pre><code>cd /usr/local/cuda-10.1/samples/1_Utilities/deviceQuery <pre><code>cd /usr/local/cuda-10.1/samples/1_Utilities/deviceQuery
sudo make sudo make
</code></pre> </code></pre><p>會產生一個叫 deviceQuery 的執行檔,執行後,會有相關資訊</p>
<p>會產生一個叫 deviceQuery 的執行檔,執行後,會有相關資訊</p>
<pre><code>administrator@hqdc032:/usr/local/cuda-10.1/samples/1_Utilities/deviceQuery$ ./deviceQuery <pre><code>administrator@hqdc032:/usr/local/cuda-10.1/samples/1_Utilities/deviceQuery$ ./deviceQuery
./deviceQuery Starting... ./deviceQuery Starting...
@ -458,91 +412,50 @@ Device 0: &quot;GeForce GT 720&quot;
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1 deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.1, CUDA Runtime Version = 10.1, NumDevs = 1
Result = PASS Result = PASS
</code></pre> </code></pre><p>到這邊, CUDA 也安裝完成,再來是簡單的 postgresql 11</p>
<p>到這邊, CUDA 也安裝完成,再來是簡單的 postgresql 11</p>
<h4 id="安裝-postgresql-11">安裝 postgresql 11</h4> <h4 id="安裝-postgresql-11">安裝 postgresql 11</h4>
<p>步驟差不多就是新增repository然後選擇要安裝的套件不過套件的選擇和平常安裝postgresql 不太一樣</p> <p>步驟差不多就是新增repository然後選擇要安裝的套件不過套件的選擇和平常安裝postgresql 不太一樣</p>
<pre><code>sudo apt install wget ca-certificates <pre><code>sudo apt install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo &quot;deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main&quot; &gt;&gt; /etc/apt/sources.list.d/pgdg.list' sudo sh -c 'echo &quot;deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main&quot; &gt;&gt; /etc/apt/sources.list.d/pgdg.list'
sudo apt update sudo apt update
sudo apt install postgresql-client-11 postgresql-11 postgresql-server-dev-11 postgresql-common libicu-dev sudo apt install postgresql-client-11 postgresql-11 postgresql-server-dev-11 postgresql-common libicu-dev
</code></pre> </code></pre><p>跑完之後,就直接啟動 postgresql service 就可以了</p>
<p>跑完之後,就直接啟動 postgresql service 就可以了</p>
<p>再來是最麻煩的 pgstorm</p> <p>再來是最麻煩的 pgstorm</p>
<h4 id="pgstorm">pgstorm</h4> <h4 id="pgstorm">pgstorm</h4>
<p>話說,這軟體到底叫啥名字? pgstrom , pg-strom ? 看起來就像是拼錯字啊! =.=</p> <p>話說,這軟體到底叫啥名字? pgstrom , pg-strom ? 看起來就像是拼錯字啊! =.=</p>
<p><a href="https://github.com/heterodb/pg-strom">https://github.com/heterodb/pg-strom</a></p> <p><a href="https://github.com/heterodb/pg-strom">https://github.com/heterodb/pg-strom</a></p>
<p>先 git clone 回來然後make、make install</p> <p>先 git clone 回來然後make、make install</p>
<p>講是很簡單但是一開始碰到很多問題有去github 跟開發團隊回報,幸好有回覆我..</p> <p>講是很簡單但是一開始碰到很多問題有去github 跟開發團隊回報,幸好有回覆我..</p>
<p>總之目前在ubuntu 18.04 + postgresql-11 的環境下編譯是沒有問題了</p> <p>總之目前在ubuntu 18.04 + postgresql-11 的環境下編譯是沒有問題了</p>
<h2 id="update">UPDATE</h2> <h2 id="update">UPDATE</h2>
<p>今天拿到一張 GTX 1050 ti ,想說終於可以來測試看看 pg_strom 了</p> <p>今天拿到一張 GTX 1050 ti ,想說終於可以來測試看看 pg_strom 了</p>
<p>不過發現在ubuntu 底下,照著這篇操作還是會有問題</p> <p>不過發現在ubuntu 底下,照著這篇操作還是會有問題</p>
<p>在做完git clone 要 make 之前,要先執行底下兩行指令</p> <p>在做完git clone 要 make 之前,要先執行底下兩行指令</p>
<p>其中的 11 是 postgresql 版本,要依照自己安裝的版本做調整</p> <p>其中的 11 是 postgresql 版本,要依照自己安裝的版本做調整</p>
<pre><code>sudo ln -snf /usr/lib/postgresql/11/lib/libpgcommon.a /usr/lib/x86_64-linux-gnu/libpgcommon.a <pre><code>sudo ln -snf /usr/lib/postgresql/11/lib/libpgcommon.a /usr/lib/x86_64-linux-gnu/libpgcommon.a
sudo ln -snf /usr/lib/postgresql/11/lib/libpgport.a /usr/lib/x86_64-linux-gnu/libpgport.a sudo ln -snf /usr/lib/postgresql/11/lib/libpgport.a /usr/lib/x86_64-linux-gnu/libpgport.a
</code></pre> </code></pre><p>接著再去 make 就沒問題了</p>
<p>接著再去 make 就沒問題了</p>
<pre><code>git clone https://github.com/heterodb/pg-strom.git <pre><code>git clone https://github.com/heterodb/pg-strom.git
cd pg-strom cd pg-strom
make &amp;&amp; sudo make install make &amp;&amp; sudo make install
</code></pre> </code></pre><p>再來設定一下 postgresql</p>
<p>再來設定一下 postgresql</p>
<h4 id="postgresql-相關設定">postgresql 相關設定</h4> <h4 id="postgresql-相關設定">postgresql 相關設定</h4>
<p>需要修改一下postgresql.conf來指定載入 pgstrom 的 library</p> <p>需要修改一下postgresql.conf來指定載入 pgstrom 的 library</p>
<p>官方是這麼說的</p> <p>官方是這麼說的</p>
<pre><code>PG-Strom module must be loaded on startup of the postmaster process by the shared_preload_libraries. Unable to load it on demand. Therefore, you must add the configuration below. <pre><code>PG-Strom module must be loaded on startup of the postmaster process by the shared_preload_libraries. Unable to load it on demand. Therefore, you must add the configuration below.
</code></pre> </code></pre><p>修改 /etc/postgresql/11/main/postgresql.conf
<p>修改 /etc/postgresql/11/main/postgresql.conf
加入一行</p> 加入一行</p>
<pre><code>shared_preload_libraries = '$libdir/pg_strom' <pre><code>shared_preload_libraries = '$libdir/pg_strom'
</code></pre> </code></pre><p>然後還有其他三個要修改不過這個不改不會影響pgstrom 的啟動</p>
<p>然後還有其他三個要修改不過這個不改不會影響pgstrom 的啟動</p>
<p>看狀況要不要修改吧</p> <p>看狀況要不要修改吧</p>
<pre><code>max_worker_processes = 100 <pre><code>max_worker_processes = 100
shared_buffers = 10GB shared_buffers = 10GB
work_mem = 1GB work_mem = 1GB
</code></pre> </code></pre><p>修改完後,重新啟動 postgresql service 有沒有很感動我終於可以享受用GPU跑SQL Query 的快感啦!!!</p>
<p>修改完後,重新啟動 postgresql service 有沒有很感動我終於可以享受用GPU跑SQL Query 的快感啦!!!</p>
<p>等等為什麼postgresql service 沒起來!?</p> <p>等等為什麼postgresql service 沒起來!?</p>
<p>看一下 /var/log/syslog</p> <p>看一下 /var/log/syslog</p>
<pre><code>Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: Error: /usr/lib/postgresql/11/bin/pg_ctl /usr/lib/postgresql/11/bin/pg_ctl start -D /var/lib/postgresql/11/main -l /var/log/postgresql/postgresql-11-main.log -s -o -c config_file=&quot;/etc/postgresql/11/main/postgresql.conf&quot; exited with status 1: <pre><code>Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: Error: /usr/lib/postgresql/11/bin/pg_ctl /usr/lib/postgresql/11/bin/pg_ctl start -D /var/lib/postgresql/11/main -l /var/log/postgresql/postgresql-11-main.log -s -o -c config_file=&quot;/etc/postgresql/11/main/postgresql.conf&quot; exited with status 1:
Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: 2019-08-20 14:23:43.538 CST [11806] LOG: PG-Strom version 2.2 built for PostgreSQL 11 Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: 2019-08-20 14:23:43.538 CST [11806] LOG: PG-Strom version 2.2 built for PostgreSQL 11
Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: 2019-08-20 14:23:43.565 CST [11806] LOG: PG-Strom: GPU0 GeForce GT 720 - CC 3.5 is not supported Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: 2019-08-20 14:23:43.565 CST [11806] LOG: PG-Strom: GPU0 GeForce GT 720 - CC 3.5 is not supported
@ -553,18 +466,11 @@ Aug 20 14:23:43 hqdc032 postgresql@11-main[11801]: Examine the log output.
Aug 20 14:23:43 hqdc032 systemd[1]: postgresql@11-main.service: Can't open PID file /run/postgresql/11-main.pid (yet?) after start: No such file or directory Aug 20 14:23:43 hqdc032 systemd[1]: postgresql@11-main.service: Can't open PID file /run/postgresql/11-main.pid (yet?) after start: No such file or directory
Aug 20 14:23:43 hqdc032 systemd[1]: postgresql@11-main.service: Failed with result 'protocol'. Aug 20 14:23:43 hqdc032 systemd[1]: postgresql@11-main.service: Failed with result 'protocol'.
Aug 20 14:23:43 hqdc032 systemd[1]: Failed to start PostgreSQL Cluster 11-main. Aug 20 14:23:43 hqdc032 systemd[1]: Failed to start PostgreSQL Cluster 11-main.
</code></pre> </code></pre><p>啊幹pg-strom 不支援這張GT 720啦</p>
<p>啊幹pg-strom 不支援這張GT 720啦</p>
<p><a href="https://github.com/heterodb/pg-strom/wiki/001:-GPU-Availability-Matrix">https://github.com/heterodb/pg-strom/wiki/001:-GPU-Availability-Matrix</a></p> <p><a href="https://github.com/heterodb/pg-strom/wiki/001:-GPU-Availability-Matrix">https://github.com/heterodb/pg-strom/wiki/001:-GPU-Availability-Matrix</a></p>
<p>簡單說,就是至少從 GTX 1080 起跳,其他都不用想了</p> <p>簡單說,就是至少從 GTX 1080 起跳,其他都不用想了</p>
<p>幹,花了兩天的時間在弄這東西,結果明明一開始就應該要先檢查的相容列表卻沒有檢查&hellip;</p> <p>幹,花了兩天的時間在弄這東西,結果明明一開始就應該要先檢查的相容列表卻沒有檢查&hellip;</p>
<p>好了,現在就看准不准我買一張 GTX 1080 來測試了&hellip;.</p> <p>好了,現在就看准不准我買一張 GTX 1080 來測試了&hellip;.</p>
<p>只是這價格嘛&hellip;嗯咳,不是我該煩惱的問題了..</p> <p>只是這價格嘛&hellip;嗯咳,不是我該煩惱的問題了..</p>
</article> </article>
</div> </div>
@ -840,7 +746,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -852,7 +758,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "ubuntu 20.04 install nvidia driver \/ CUDA \/ postgresql \/ pg_strom", "name" : "ubuntu 20.04 install nvidia driver \/ CUDA \/ postgresql \/ pg_strom",
"headline" : "ubuntu 20.04 install nvidia driver \/ CUDA \/ postgresql \/ pg_strom", "headline" : "ubuntu 20.04 install nvidia driver \/ CUDA \/ postgresql \/ pg_strom",
"description" : "\x3cp\x3e最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 \x2b postgresql \x2b pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。\x3c\/p\x3e\n\n\x3cp\x3eBreaks here\x3c\/p\x3e", "description" : "\x3cp\x3e最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 \x2b postgresql \x2b pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。\x3c\/p\x3e\n\x3cp\x3eBreaks here\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,28 +305,18 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。</p> <p>最近又開始在亂搞postgresql 一直想要玩玩看GPU運算的威力大概一年多前有測試了 ubuntu 18.04 + postgresql + pg_strom 可是當時因為pg_strom 不支援當時手邊的顯示卡,只好作罷。</p>
<p>Breaks here</p> <p>Breaks here</p>
<hr>
<hr /> <h2 id="title-ubuntu-2004-install-nvidia-driver--cuda--postgresql--pg_strom">title: &ldquo;ubuntu 20.04 install nvidia driver / CUDA / postgresql / pg_strom&rdquo;</h2>
<h2 id="title-ubuntu-20-04-install-nvidia-driver-cuda-postgresql-pg-strom">title: &ldquo;ubuntu 20.04 install nvidia driver / CUDA / postgresql / pg_strom&rdquo;</h2>
<p>這次搞到一張GTX 1030 顯示卡,作業系統也升級到了 ubuntu 20.04 ,就再來弄一次看看</p> <p>這次搞到一張GTX 1030 顯示卡,作業系統也升級到了 ubuntu 20.04 ,就再來弄一次看看</p>
<h3 id="安裝-nvidia-driver">安裝 nvidia Driver</h3> <h3 id="安裝-nvidia-driver">安裝 nvidia Driver</h3>
<p>我還是選擇用 apt 新增ppa 的方式來安裝</p> <p>我還是選擇用 apt 新增ppa 的方式來安裝</p>
<pre><code>sudo add-apt-repository ppa:graphics-drivers/ppa <pre><code>sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update sudo apt update
sudo apt install ubuntu-drivers-common sudo apt install ubuntu-drivers-common
sudo apt install nvidia-driver-450 sudo apt install nvidia-driver-450
sudo reboot sudo reboot
</code></pre> </code></pre><p>重開機後檢查一下是否有成功安裝</p>
<p>重開機後檢查一下是否有成功安裝</p>
<pre><code>chchang@hqdc039:~/git/pg-strom$ lsmod|grep nvidia <pre><code>chchang@hqdc039:~/git/pg-strom$ lsmod|grep nvidia
nvidia_uvm 1007616 2 nvidia_uvm 1007616 2
nvidia_drm 49152 9 nvidia_drm 49152 9
@ -339,70 +325,40 @@ nvidia 19722240 622 nvidia_uvm,nvidia_modeset
drm_kms_helper 184320 2 nvidia_drm,i915 drm_kms_helper 184320 2 nvidia_drm,i915
drm 491520 13 drm_kms_helper,nvidia_drm,i915 drm 491520 13 drm_kms_helper,nvidia_drm,i915
chchang@hqdc039:~/git/pg-strom$ chchang@hqdc039:~/git/pg-strom$
</code></pre> </code></pre><p>OK ,看起來應該是沒有問題,接著來安裝 CUDA</p>
<p>OK ,看起來應該是沒有問題,接著來安裝 CUDA</p>
<h3 id="安裝-cuda">安裝 CUDA</h3> <h3 id="安裝-cuda">安裝 CUDA</h3>
<h4 id="下載-cuda-安裝檔案">下載 CUDA 安裝檔案</h4> <h4 id="下載-cuda-安裝檔案">下載 CUDA 安裝檔案</h4>
<pre><code>axel -n 10 http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run <pre><code>axel -n 10 http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run
</code></pre> </code></pre><h4 id="執行安裝檔案進行安裝">執行安裝檔案進行安裝</h4>
<h4 id="執行安裝檔案進行安裝">執行安裝檔案進行安裝</h4>
<p>注意在後面加上了 &ndash;override ,這是因為 ubuntu 20.04 預設的 gcc 是 9 ,但是 CUDA 目前還是只支援到 7 所以先用override 來解決這個問題,不然會出現 gcc version 的錯誤</p> <p>注意在後面加上了 &ndash;override ,這是因為 ubuntu 20.04 預設的 gcc 是 9 ,但是 CUDA 目前還是只支援到 7 所以先用override 來解決這個問題,不然會出現 gcc version 的錯誤</p>
<pre><code>sudo bash cuda_10.1.243_418.87.00_linux.run --override <pre><code>sudo bash cuda_10.1.243_418.87.00_linux.run --override
</code></pre> </code></pre><p>安裝過程 nvidia 已經做成選單,就選擇要安裝的東西,記得<!-- raw HTML omitted -->不要<!-- raw HTML omitted -->選 Driver因為剛剛已經安裝過了</p>
<p>安裝過程 nvidia 已經做成選單,就選擇要安裝的東西,記得<b>不要</b>選 Driver因為剛剛已經安裝過了</p>
<p>安裝完成後,需要修改一下 bashrc <p>安裝完成後,需要修改一下 bashrc
<a href="https://cyfeng.science/2020/05/02/ubuntu-install-nvidia-driver-cuda-cudnn-suits/">https://cyfeng.science/2020/05/02/ubuntu-install-nvidia-driver-cuda-cudnn-suits/</a></p> <a href="https://cyfeng.science/2020/05/02/ubuntu-install-nvidia-driver-cuda-cudnn-suits/">https://cyfeng.science/2020/05/02/ubuntu-install-nvidia-driver-cuda-cudnn-suits/</a></p>
<pre><code>echo '# CUDA Soft Link' &gt;&gt; ~/.bashrc <pre><code>echo '# CUDA Soft Link' &gt;&gt; ~/.bashrc
echo 'export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}' &gt;&gt; ~/.bashrc echo 'export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}' &gt;&gt; ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' &gt;&gt; ~/.bashrc echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' &gt;&gt; ~/.bashrc
source ~/.bashrc source ~/.bashrc
</code></pre> </code></pre><p>然後確認一下是不是正確安裝了</p>
<p>然後確認一下是不是正確安裝了</p>
<pre><code>chchang@hqdc039:~/git/pg-strom$ nvcc --version <pre><code>chchang@hqdc039:~/git/pg-strom$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation Copyright (c) 2005-2019 NVIDIA Corporation
Built on Sun_Jul_28_19:07:16_PDT_2019 Built on Sun_Jul_28_19:07:16_PDT_2019
Cuda compilation tools, release 10.1, V10.1.243 Cuda compilation tools, release 10.1, V10.1.243
chchang@hqdc039:~/git/pg-strom$ chchang@hqdc039:~/git/pg-strom$
</code></pre> </code></pre><h3 id="安裝-postgresql">安裝 postgresql</h3>
<h3 id="安裝-postgresql">安裝 postgresql</h3>
<p>ubuntu 20.04 預設就是搭載 postgresql 12 ,所以安裝很方便</p> <p>ubuntu 20.04 預設就是搭載 postgresql 12 ,所以安裝很方便</p>
<pre><code>sudo apt install postgresql-12 postgresql-client-12 postgresql-client-common postgresql-client postgresql-common postgresql-contrib postgresql-server-dev-12 <pre><code>sudo apt install postgresql-12 postgresql-client-12 postgresql-client-common postgresql-client postgresql-common postgresql-contrib postgresql-server-dev-12
</code></pre> </code></pre><h3 id="安裝-pg_strom">安裝 pg_strom</h3>
<h3 id="安裝-pg-strom">安裝 pg_strom</h3>
<p>因為pg_strom 一樣也是不支援 gcc9 , g++9 ,所以先安裝會用到的套件</p> <p>因為pg_strom 一樣也是不支援 gcc9 , g++9 ,所以先安裝會用到的套件</p>
<pre><code>sudo apt install libicu-dev gcc-7 g++-7 libpmem-dev <pre><code>sudo apt install libicu-dev gcc-7 g++-7 libpmem-dev
</code></pre> </code></pre><p>然後改掉系統上的 gcc / g++</p>
<p>然後改掉系統上的 gcc / g++</p>
<pre><code>sudo unlink /usr/bin/gcc <pre><code>sudo unlink /usr/bin/gcc
sudo unlink /usr/bin/g++ sudo unlink /usr/bin/g++
sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc sudo ln -s /usr/bin/gcc-7 /usr/bin/gcc
sudo ln -s /usr/bin/g++-7 /usr/bin/g++ sudo ln -s /usr/bin/g++-7 /usr/bin/g++
</code></pre> </code></pre><p>然後clone pg_strom 回來做編譯, pg_config 的位置要看安裝的版本來決定
<p>然後clone pg_strom 回來做編譯, pg_config 的位置要看安裝的版本來決定
同時也要修改兩個檔案的link</p> 同時也要修改兩個檔案的link</p>
<pre><code>sudo ln -snf /usr/lib/postgresql/12/lib/libpgcommon.a /usr/lib/x86_64-linux-gnu/libpgcommon.a <pre><code>sudo ln -snf /usr/lib/postgresql/12/lib/libpgcommon.a /usr/lib/x86_64-linux-gnu/libpgcommon.a
sudo ln -snf /usr/lib/postgresql/12/lib/libpgport.a /usr/lib/x86_64-linux-gnu/libpgport.a sudo ln -snf /usr/lib/postgresql/12/lib/libpgport.a /usr/lib/x86_64-linux-gnu/libpgport.a
@ -410,16 +366,10 @@ git clone https://github.com/heterodb/pg-strom.git
cd pg-strom cd pg-strom
make PG_CONFIG=/usr/lib/postgresql/12/bin/pg_config make PG_CONFIG=/usr/lib/postgresql/12/bin/pg_config
sudo make install sudo make install
</code></pre> </code></pre><p>這邊成功編譯之後,要來修改一下 postgresql在 /etc/postgresql/12/main/postgresql.conf 中,加入底下這行</p>
<p>這邊成功編譯之後,要來修改一下 postgresql在 /etc/postgresql/12/main/postgresql.conf 中,加入底下這行</p>
<pre><code>shared_preload_libraries = '$libdir/pg_strom' <pre><code>shared_preload_libraries = '$libdir/pg_strom'
</code></pre> </code></pre><p>然後重啟 postgresql service 觀察一下syslog 有沒有錯誤
<p>然後重啟 postgresql service 觀察一下syslog 有沒有錯誤
如果服務有起來,那基本上就安裝成功了</p> 如果服務有起來,那基本上就安裝成功了</p>
<p>之後再來找看看有什麼測試pg_strom 的方式</p> <p>之後再來找看看有什麼測試pg_strom 的方式</p>
</article> </article>
</div> </div>
@ -703,7 +653,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -715,7 +665,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "Install Timeshift on Ubuntu1804", "name" : "Install Timeshift on Ubuntu1804",
"headline" : "Install Timeshift on Ubuntu1804", "headline" : "Install Timeshift on Ubuntu1804",
"description" : "\x3cp\x3e最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook\x3c\/p\x3e\n\n\x3cp\x3e因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體\x3c\/p\x3e\n\n\x3cp\x3e可以很簡單快速的備份、恢復系統狀態\x3c\/p\x3e\n\n\x3cp\x3e可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤\x26hellip;.\x3c\/p\x3e", "description" : "\x3cp\x3e最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook\x3c\/p\x3e\n\x3cp\x3e因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體\x3c\/p\x3e\n\x3cp\x3e可以很簡單快速的備份、恢復系統狀態\x3c\/p\x3e\n\x3cp\x3e可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤\x26hellip;.\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,43 +305,25 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook</p> <p>最近要開始測試client安裝 ubuntu 18.04 的 ansible playbook</p>
<p>因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體</p> <p>因為要不斷的修正所以想到一直有在自己電腦上執行的timeshift這個軟體</p>
<p>可以很簡單快速的備份、恢復系統狀態</p> <p>可以很簡單快速的備份、恢復系統狀態</p>
<p>可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&hellip;.</p> <p>可是不知道為什麼在ubuntu 18.04 上安裝就是會發生錯誤&hellip;.</p>
<p>因為client 的環境都躲在proxy後面一開始我想說直接下</p> <p>因為client 的環境都躲在proxy後面一開始我想說直接下</p>
<pre><code>export http_proxy=http://proxy_server:port <pre><code>export http_proxy=http://proxy_server:port
export https_proxy=http://proxy_server:port export https_proxy=http://proxy_server:port
</code></pre> </code></pre><p>然後再去依照官方的指令新增repository就好</p>
<p>然後再去依照官方的指令新增repository就好</p>
<pre><code>sudo add-apt-repository ppa:teejee2008/ppa <pre><code>sudo add-apt-repository ppa:teejee2008/ppa
</code></pre> </code></pre><p>結果當然不是我想的那麼簡單&hellip;</p>
<p>結果當然不是我想的那麼簡單&hellip;</p>
<p>直接就跳錯誤出來了</p> <p>直接就跳錯誤出來了</p>
<pre><code>2019-03-11 13:57:28 [mini@pc074 ~]$ sudo add-apt-repository ppa:teejee2008/ppa <pre><code>2019-03-11 13:57:28 [mini@pc074 ~]$ sudo add-apt-repository ppa:teejee2008/ppa
Cannot add PPA: 'ppa:~teejee2008/ubuntu/ppa'. Cannot add PPA: 'ppa:~teejee2008/ubuntu/ppa'.
ERROR: '~teejee2008' user or team does not exist. ERROR: '~teejee2008' user or team does not exist.
</code></pre> </code></pre><p>翻了一下google有找到解法但沒找到原因就先這樣吧&hellip;(不求甚解)</p>
<p>翻了一下google有找到解法但沒找到原因就先這樣吧&hellip;(不求甚解)</p>
<pre><code>export http_proxy=http://proxy_server:port <pre><code>export http_proxy=http://proxy_server:port
export https_proxy=http://proxy_server:port export https_proxy=http://proxy_server:port
sudo -E add-apt-repository -y ppa:teejee2008/ppa sudo -E add-apt-repository -y ppa:teejee2008/ppa
sudo apt isntall timeshift sudo apt isntall timeshift
</code></pre> </code></pre><p>裝好之後,看一下怎麼執行,其實很簡單,也不用特別去指定什麼路徑</p>
<p>裝好之後,看一下怎麼執行,其實很簡單,也不用特別去指定什麼路徑</p>
<pre><code>2019-03-11 14:00:59 [minion@hqpc074 ~]$ sudo timeshift --create --comments &quot;after ansible&quot; <pre><code>2019-03-11 14:00:59 [minion@hqpc074 ~]$ sudo timeshift --create --comments &quot;after ansible&quot;
First run mode (config file not found) First run mode (config file not found)
Selected default snapshot type: RSYNC Selected default snapshot type: RSYNC
@ -360,10 +338,7 @@ RSYNC Snapshot saved successfully (79s)
Tagged snapshot '2019-03-11_14-01-01': ondemand Tagged snapshot '2019-03-11_14-01-01': ondemand
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
2019-03-11 14:02:20 [mini@pc074 ~]$ 2019-03-11 14:02:20 [mini@pc074 ~]$
</code></pre> </code></pre><p>這樣就備份完了,來測試一下備份是否正常,先隨便裝個本來沒裝的軟體</p>
<p>這樣就備份完了,來測試一下備份是否正常,先隨便裝個本來沒裝的軟體</p>
<pre><code>2019-03-11 14:02:20 [minion@hqpc074 ~]$ sudo apt install joe <pre><code>2019-03-11 14:02:20 [minion@hqpc074 ~]$ sudo apt install joe
Reading package lists... Done Reading package lists... Done
Building dependency tree Building dependency tree
@ -386,10 +361,7 @@ update-alternatives: using /usr/bin/joe to provide /usr/bin/editor (editor) in a
Processing triggers for man-db (2.8.3-2) ... Processing triggers for man-db (2.8.3-2) ...
Processing triggers for gnome-menus (3.13.3-11ubuntu1) ... Processing triggers for gnome-menus (3.13.3-11ubuntu1) ...
2019-03-11 14:09:39 [minion@hqpc074 ~]$ 2019-03-11 14:09:39 [minion@hqpc074 ~]$
</code></pre> </code></pre><p>確定 joe 已經安裝</p>
<p>確定 joe 已經安裝</p>
<pre><code>2019-03-11 14:09:51 [minion@hqpc074 ~]$ joe --help <pre><code>2019-03-11 14:09:51 [minion@hqpc074 ~]$ joe --help
Joe's Own Editor v4.6 Joe's Own Editor v4.6
@ -523,10 +495,7 @@ Local options:
-cpara sss Paragraph indent chars -cpara sss Paragraph indent chars
-cnotpara sss Non-paragraph chars -cnotpara sss Non-paragraph chars
2019-03-11 14:09:54 [minion@hqpc074 ~]$ 2019-03-11 14:09:54 [minion@hqpc074 ~]$
</code></pre> </code></pre><p>然後還原到剛剛做的備份,用 &ndash;list 看一下</p>
<p>然後還原到剛剛做的備份,用 &ndash;list 看一下</p>
<pre><code>2019-03-11 14:11:08 [minion@hqpc074 ~]$ sudo timeshift --list <pre><code>2019-03-11 14:11:08 [minion@hqpc074 ~]$ sudo timeshift --list
Device : /dev/sda1 Device : /dev/sda1
UUID : d0efcb3d-e04a-41b8-a046-55557499f4d3 UUID : d0efcb3d-e04a-41b8-a046-55557499f4d3
@ -540,10 +509,7 @@ Num Name Tags Description
0 &gt; 2019-03-11_14-01-01 O after ansible 0 &gt; 2019-03-11_14-01-01 O after ansible
2019-03-11 14:11:17 [minion@hqpc074 ~]$ 2019-03-11 14:11:17 [minion@hqpc074 ~]$
</code></pre> </code></pre><p>然後還原,中間會問你要不要重新安裝 grub ,就看個人需求,我是都會讓它重新安裝一次啦</p>
<p>然後還原,中間會問你要不要重新安裝 grub ,就看個人需求,我是都會讓它重新安裝一次啦</p>
<pre><code>2019-03-11 14:11:53 [minion@hqpc074 ~]$ sudo timeshift --restore --snapshot '2019-03-11_14-01-01' --target /dev/sda1 <pre><code>2019-03-11 14:11:53 [minion@hqpc074 ~]$ sudo timeshift --restore --snapshot '2019-03-11_14-01-01' --target /dev/sda1
@ -870,12 +836,8 @@ Synching file systems...
Rebooting system... Rebooting system...
Rebooting. Rebooting.
</code></pre> </code></pre><p><strong>要特別注意restore完後會自動reboot</strong></p>
<p><strong>要特別注意restore完後會自動reboot</strong></p>
<p>重新開機完成後,就入系統,執行看看 joe</p> <p>重新開機完成後,就入系統,執行看看 joe</p>
<pre><code>2019-03-11 14:14:53 [minion@hqpc074 ~]$ joe <pre><code>2019-03-11 14:14:53 [minion@hqpc074 ~]$ joe
Command 'joe' not found, but can be installed with: Command 'joe' not found, but can be installed with:
@ -884,10 +846,7 @@ sudo apt install joe
sudo apt install joe-jupp sudo apt install joe-jupp
2019-03-11 14:14:54 [minion@hqpc074 ~]$ 2019-03-11 14:14:54 [minion@hqpc074 ~]$
</code></pre> </code></pre><p>可以看到剛剛安裝的joe 又變成還沒安裝的狀態了,符合預期中的結果!</p>
<p>可以看到剛剛安裝的joe 又變成還沒安裝的狀態了,符合預期中的結果!</p>
<p>可以繼續測試playbook了</p> <p>可以繼續測試playbook了</p>
</article> </article>
</div> </div>
@ -1165,7 +1124,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -1177,7 +1136,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "用DELL 6 i\/R 建立RAID並在上面安裝ubuntu 18.04 ", "name" : "用DELL 6 i\/R 建立RAID並在上面安裝ubuntu 18.04 ",
"headline" : "用DELL 6 i\/R 建立RAID並在上面安裝ubuntu 18.04 ", "headline" : "用DELL 6 i\/R 建立RAID並在上面安裝ubuntu 18.04 ",
"description" : "\x3cp\x3e買了一張 DELL 6\/iR 低階的raid 卡\x3c\/p\x3e\n\n\x3cp\x3e來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機\x26hellip;\x3c\/p\x3e", "description" : "\x3cp\x3e買了一張 DELL 6\/iR 低階的raid 卡\x3c\/p\x3e\n\x3cp\x3e來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機\x26hellip;\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,23 +305,14 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>買了一張 DELL 6/iR 低階的raid 卡</p> <p>買了一張 DELL 6/iR 低階的raid 卡</p>
<p>來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&hellip;</p> <p>來測試把系統裝在硬體做的RAID上結果沒想到居然不能開機&hellip;</p>
<p>都2019年了 DELL 6/iR 這張卡出了快十年了,不懂為什麼在安裝過程都正常</p> <p>都2019年了 DELL 6/iR 這張卡出了快十年了,不懂為什麼在安裝過程都正常</p>
<p>但是裝完之後,都會發生 &quot; no boot device &ldquo;的錯誤</p>
<p>但是裝完之後,都會發生 &ldquo; no boot device &ldquo;的錯誤</p>
<p>測試過 ubuntu 16.04 / 18.04 , Debian 9 都是一樣的問題</p> <p>測試過 ubuntu 16.04 / 18.04 , Debian 9 都是一樣的問題</p>
<p>翻了很久google發現有人提到要修改一個grub的設定</p> <p>翻了很久google發現有人提到要修改一個grub的設定</p>
<p>先裝完系統,然後改用 ubuntu 18.04 Live DVD 開機</p> <p>先裝完系統,然後改用 ubuntu 18.04 Live DVD 開機</p>
<p>然後開啟 terminal</p> <p>然後開啟 terminal</p>
<p>依序執行</p> <p>依序執行</p>
<pre><code>sudo mount /dev/sdf1 /mnt (RAID磁碟代號不一定是 /dev/sdf 先用fdisk -l 確認) <pre><code>sudo mount /dev/sdf1 /mnt (RAID磁碟代號不一定是 /dev/sdf 先用fdisk -l 確認)
sudo mount --bind /dev /mnt/dev sudo mount --bind /dev /mnt/dev
@ -333,24 +320,15 @@ sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys sudo mount --bind /sys /mnt/sys
sudo chroot /mnt sudo chroot /mnt
</code></pre> </code></pre><p>chroot 完成之後,再進行下面的修改</p>
<p>chroot 完成之後,再進行下面的修改</p>
<pre><code>vi /etc/default/grub <pre><code>vi /etc/default/grub
找到 找到
GRUB_CMDLINE_LINUX=&quot;&quot; GRUB_CMDLINE_LINUX=&quot;&quot;
修改成 修改成
GRUB_CMDLINE_LINUX=&quot;rootdelay=90&quot; GRUB_CMDLINE_LINUX=&quot;rootdelay=90&quot;
</code></pre> </code></pre><p>存檔後離開,再更新 grub</p>
<p>存檔後離開,再更新 grub</p>
<pre><code>update-grub <pre><code>update-grub
</code></pre> </code></pre><p>然後重新開機,開機時間會比較久一點,但是這樣就可以正常開機了。</p>
<p>然後重新開機,開機時間會比較久一點,但是這樣就可以正常開機了。</p>
<p>還是不懂,這到底是 ubuntu的問題還是raid Controller的問題還是 grub 的問題?</p> <p>還是不懂,這到底是 ubuntu的問題還是raid Controller的問題還是 grub 的問題?</p>
</article> </article>
</div> </div>
@ -626,7 +604,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -638,7 +616,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] inxi 蒐集詳盡的硬體資訊 \/ inxi Collect Detail Hardware Info", "name" : "[筆記] inxi 蒐集詳盡的硬體資訊 \/ inxi Collect Detail Hardware Info",
"headline" : "[筆記] inxi 蒐集詳盡的硬體資訊 \/ inxi Collect Detail Hardware Info", "headline" : "[筆記] inxi 蒐集詳盡的硬體資訊 \/ inxi Collect Detail Hardware Info",
"description" : "\x3cp\x3e最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了\x26hellip;.\x3c\/p\x3e\n\n\x3cp\x3e然後又因為一直沒有添購新的硬碟只能用這些快過保\/已過保的撐著\x3c\/p\x3e\n\n\x3cp\x3e所以最近不斷的在更換機器內的硬碟而且還沒有熱插拔\x3c\/p\x3e\n\n\x3cp\x3e也導致原本負責處理盤點資產的同事困擾因為跟手邊的紀錄已經對不起來了\x3c\/p\x3e\n\n\x3cp\x3e然後就變成要對資產的時候需要一台一台登入然後去下不同的指令取得想要的硬體資訊超級麻煩的\x3c\/p\x3e", "description" : "\x3cp\x3e最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了\x26hellip;.\x3c\/p\x3e\n\x3cp\x3e然後又因為一直沒有添購新的硬碟只能用這些快過保\/已過保的撐著\x3c\/p\x3e\n\x3cp\x3e所以最近不斷的在更換機器內的硬碟而且還沒有熱插拔\x3c\/p\x3e\n\x3cp\x3e也導致原本負責處理盤點資產的同事困擾因為跟手邊的紀錄已經對不起來了\x3c\/p\x3e\n\x3cp\x3e然後就變成要對資產的時候需要一台一台登入然後去下不同的指令取得想要的硬體資訊超級麻煩的\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,108 +305,83 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&hellip;.</p> <p>最近因為一直碰到硬碟故障的問題算起來那一批同時購買的5X顆 seagate 2T硬碟已經有一半以上故障返修了&hellip;.</p>
<p>然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著</p> <p>然後又因為一直沒有添購新的硬碟,只能用這些快過保/已過保的撐著</p>
<p>所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!</p> <p>所以最近不斷的在更換機器內的硬碟,而且還沒有熱插拔!</p>
<p>也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了</p> <p>也導致原本負責處理盤點資產的同事困擾,因為跟手邊的紀錄已經對不起來了</p>
<p>然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!</p> <p>然後就變成要對資產的時候,需要一台一台登入,然後去下不同的指令,取得想要的硬體資訊,超級麻煩的!</p>
<p>幾次之後終於決定透過ansible來做這件事</p> <p>幾次之後終於決定透過ansible來做這件事</p>
<p>一開始的想法很簡單,就用 lshw/dmidecode這些指令去做</p> <p>一開始的想法很簡單,就用 lshw/dmidecode這些指令去做</p>
<p>可是因為手邊的機器有ubuntu 18.04/16.04/14.04 , Debian 9 , Proxmox (based on debian ) , CentOS , FreeNAS</p> <p>可是因為手邊的機器有ubuntu 18.04/16.04/14.04 , Debian 9 , Proxmox (based on debian ) , CentOS , FreeNAS</p>
<p>而有些系統預設沒有 lshw / dmidecode (對FreeNAS 就是說你)</p> <p>而有些系統預設沒有 lshw / dmidecode (對FreeNAS 就是說你)</p>
<p>所以變成要依照系統不同去下不同的指令雖然都是ansible在跑但是看到playbook的內容就很煩啊</p> <p>所以變成要依照系統不同去下不同的指令雖然都是ansible在跑但是看到playbook的內容就很煩啊</p>
<p>然後就不小心讓我翻到了 inxi 這個指令,根本就是救星啊!</p> <p>然後就不小心讓我翻到了 inxi 這個指令,根本就是救星啊!</p>
<p>直接來看輸出的範例</p> <p>直接來看輸出的範例</p>
<p><img src="http://i.imgur.com/OSx9cnz.png" alt="sample of inxi output"></p>
<p><img src="http://i.imgur.com/OSx9cnz.png" alt="sample of inxi output" /></p>
<p>有沒有,是不是很優!</p> <p>有沒有,是不是很優!</p>
<p>而且簡單易懂,還能抓到同事想看的資料,像是廠牌、型號、序號、記憶體類型(DDR2/3/4)</p> <p>而且簡單易懂,還能抓到同事想看的資料,像是廠牌、型號、序號、記憶體類型(DDR2/3/4)</p>
<p>所以馬上捨棄 lshw/dmidecode ,改用 inxi 來跑</p> <p>所以馬上捨棄 lshw/dmidecode ,改用 inxi 來跑</p>
<p>ansible role 的內容也很簡單</p> <p>ansible role 的內容也很簡單</p>
<p>就偵測完之後,把結果送出給設定好的收件人</p> <p>就偵測完之後,把結果送出給設定好的收件人</p>
<p>只是因為系統不同,大致上要分成 ubuntu/debian/centos 以及 freebsd 兩種</p> <p>只是因為系統不同,大致上要分成 ubuntu/debian/centos 以及 freebsd 兩種</p>
<p>所以同樣的task 要跑兩次一個要帶sudo 一個不用帶</p> <p>所以同樣的task 要跑兩次一個要帶sudo 一個不用帶</p>
<p>然後BSD系列的機器在inventory 裡面要帶入 ansible_ssh_user</p> <p>然後BSD系列的機器在inventory 裡面要帶入 ansible_ssh_user</p>
<p>就這樣,沒有什麼太困難的</p> <p>就這樣,沒有什麼太困難的</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-YAML" data-lang="YAML"><span style="color:#75715e">######### use inxi instead ##################</span>
<pre><code class="language-YAML">######### use inxi instead ################## - <span style="color:#66d9ef">name</span>: copy inxi binary to remote Ubnutu/Debian
- name: copy inxi binary to remote Ubnutu/Debian <span style="color:#66d9ef">become</span>: yes
become: yes <span style="color:#66d9ef">become_method</span>: sudo
become_method: sudo <span style="color:#66d9ef">copy</span>:
copy: <span style="color:#66d9ef">src</span>: inxi
src: inxi <span style="color:#66d9ef">dest</span>: /usr/local/bin/inxi
dest: /usr/local/bin/inxi <span style="color:#66d9ef">mode</span>: a+rx,u+rwx
mode: a+rx,u+rwx <span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">&#34;Ubuntu&#34;</span> or ansible_distribution == <span style="color:#e6db74">&#34;Debian&#34;</span> or ansible_distribution == <span style="color:#e6db74">&#34;CentOS&#34;</span>
when: ansible_distribution == &quot;Ubuntu&quot; or ansible_distribution == &quot;Debian&quot; or ansible_distribution == &quot;CentOS&quot;
- <span style="color:#66d9ef">name</span>: copy inxi binary to remote FreeBSD
- name: copy inxi binary to remote FreeBSD <span style="color:#66d9ef">copy</span>:
copy: <span style="color:#66d9ef">src</span>: inxi
src: inxi <span style="color:#66d9ef">dest</span>: /usr/local/bin/inxi
dest: /usr/local/bin/inxi <span style="color:#66d9ef">mode</span>: a+rx,u+rwx
mode: a+rx,u+rwx <span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">&#34;FreeBSD&#34;</span>
when: ansible_distribution == &quot;FreeBSD&quot;
- <span style="color:#66d9ef">name</span>: run inxi to collect Ubuntu/Debian hardware info
- name: run inxi to collect Ubuntu/Debian hardware info <span style="color:#66d9ef">become</span>: yes
become: yes <span style="color:#66d9ef">become_method</span>: sudo
become_method: sudo <span style="color:#66d9ef">shell</span>: <span style="color:#e6db74">&#34;/usr/local/bin/inxi -c -Dxx -C -m -Z&#34;</span>
shell: &quot;/usr/local/bin/inxi -c -Dxx -C -m -Z&quot; <span style="color:#66d9ef">register</span>: du_hw_info
register: du_hw_info <span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">&#34;Ubuntu&#34;</span> or ansible_distribution == <span style="color:#e6db74">&#34;Debian&#34;</span> or ansible_distribution == <span style="color:#e6db74">&#34;CentOS&#34;</span>
when: ansible_distribution == &quot;Ubuntu&quot; or ansible_distribution == &quot;Debian&quot; or ansible_distribution == &quot;CentOS&quot;
- <span style="color:#66d9ef">name</span>: run inxi to collect FreeBSD hardware info
- name: run inxi to collect FreeBSD hardware info <span style="color:#66d9ef">shell</span>: <span style="color:#e6db74">&#34;/usr/local/bin/inxi -c -Dxx -C -m -Z&#34;</span>
shell: &quot;/usr/local/bin/inxi -c -Dxx -C -m -Z&quot; <span style="color:#66d9ef">register</span>: bsd_hw_info
register: bsd_hw_info <span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">&#34;FreeBSD&#34;</span>
when: ansible_distribution == &quot;FreeBSD&quot;
- <span style="color:#66d9ef">name</span>: set Ubuntu/Debian inventory file
- name: set Ubuntu/Debian inventory file <span style="color:#66d9ef">template</span>:
template: <span style="color:#66d9ef">src</span>: etc/inventory.txt.j2
src: etc/inventory.txt.j2 <span style="color:#66d9ef">dest</span>: <span style="color:#e6db74">&#34;/tmp/{{ ansible_hostname }}_inventory.txt&#34;</span>
dest: &quot;/tmp/{{ ansible_hostname }}_inventory.txt&quot; <span style="color:#66d9ef">mode</span>: a+r,u+rw
mode: a+r,u+rw <span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">&#34;Ubuntu&#34;</span> or ansible_distribution == <span style="color:#e6db74">&#34;Debian&#34;</span> or ansible_distribution == <span style="color:#e6db74">&#34;CentOS&#34;</span>
when: ansible_distribution == &quot;Ubuntu&quot; or ansible_distribution == &quot;Debian&quot; or ansible_distribution == &quot;CentOS&quot;
- <span style="color:#66d9ef">name</span>: set FreeBSD inventory file
- name: set FreeBSD inventory file <span style="color:#66d9ef">template</span>:
template: <span style="color:#66d9ef">src</span>: etc/freenas_inventory.txt.j2
src: etc/freenas_inventory.txt.j2 <span style="color:#66d9ef">dest</span>: <span style="color:#e6db74">&#34;/tmp/{{ ansible_hostname }}_inventory.txt&#34;</span>
dest: &quot;/tmp/{{ ansible_hostname }}_inventory.txt&quot; <span style="color:#66d9ef">mode</span>: a+r,u+rw
mode: a+r,u+rw <span style="color:#66d9ef">when</span>: ansible_distribution == <span style="color:#e6db74">&#34;FreeBSD&#34;</span>
when: ansible_distribution == &quot;FreeBSD&quot;
- <span style="color:#66d9ef">name</span>: send inventory file via mail
- name: send inventory file via mail <span style="color:#66d9ef">tags</span>: mail
tags: mail <span style="color:#66d9ef">mail</span>:
mail: <span style="color:#66d9ef">host</span>: <span style="color:#ae81ff">192.168.11.173</span>
host: 192.168.11.173 <span style="color:#66d9ef">port</span>: <span style="color:#ae81ff">25</span>
port: 25 <span style="color:#66d9ef">secure</span>: starttls
secure: starttls <span style="color:#66d9ef">subject</span>: <span style="color:#e6db74">&#34;{{ ansible_hostname }} inventory file&#34;</span>
subject: &quot;{{ ansible_hostname }} inventory file&quot; <span style="color:#66d9ef">from</span>: ansible
from: ansible <span style="color:#66d9ef">to</span>: <span style="color:#e6db74">&#34;{{ recipient }}&#34;</span>
to: &quot;{{ recipient }}&quot; <span style="color:#75715e">#body: &#34;{{ mail_body.stdout_lines }}&#34;</span>
#body: &quot;{{ mail_body.stdout_lines }}&quot; <span style="color:#66d9ef">attach</span>: <span style="color:#e6db74">&#34;/tmp/{{ ansible_hostname }}_inventory.txt&#34;</span>
attach: &quot;/tmp/{{ ansible_hostname }}_inventory.txt&quot;
</code></pre></div><p>inventory 內容</p>
</code></pre>
<p>inventory 內容</p>
<pre><code>hqs01.abc.com ansible_ssh_host=192.168.11.1 <pre><code>hqs01.abc.com ansible_ssh_host=192.168.11.1
hqs210.abc.com hqs210.abc.com
hqs230.abc.com hqs230.abc.com
@ -426,12 +397,8 @@ hqs173.abc.com
hqs099.abc.com ansible_ssh_host=192.168.11.99 ansible_ssh_port=22 ansible_ssh_user=root hqs099.abc.com ansible_ssh_host=192.168.11.99 ansible_ssh_port=22 ansible_ssh_user=root
hqs202.abc.com ansible_ssh_host=192.168.11.202 ansible_ssh_port=22 ansible_ssh_user=root hqs202.abc.com ansible_ssh_host=192.168.11.202 ansible_ssh_port=22 ansible_ssh_user=root
bbs089.abc.com ansible_ssh_host=192.168.0.89 ansible_ssh_user=root bbs089.abc.com ansible_ssh_host=192.168.0.89 ansible_ssh_user=root
</code></pre> </code></pre><p>ansible 又發揮了一次,另外,感覺這個指令可以用來寫資產管理系統耶&hellip;威力強大</p>
<p>ansible 又發揮了一次,另外,感覺這個指令可以用來寫資產管理系統耶&hellip;威力強大</p>
<p>而且又不用管作業系統是什麼,反正有執行檔,直接派過去 remote 端就好了!</p> <p>而且又不用管作業系統是什麼,反正有執行檔,直接派過去 remote 端就好了!</p>
<p>真是讓我相見恨晚啊!</p> <p>真是讓我相見恨晚啊!</p>
</article> </article>
</div> </div>
@ -711,7 +678,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -723,7 +690,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 紀錄所有下過的指令、時間 \/ Log All commands with timestamp", "name" : "[筆記] 紀錄所有下過的指令、時間 \/ Log All commands with timestamp",
"headline" : "[筆記] 紀錄所有下過的指令、時間 \/ Log All commands with timestamp", "headline" : "[筆記] 紀錄所有下過的指令、時間 \/ Log All commands with timestamp",
"description" : "\x3cp\x3e今天發生一件有點詭異的事情本來應該要經過某個指令才會產生的檔案\x3c\/p\x3e\n\n\x3cp\x3e居然不知為何自己產生了在我記憶中沒有去執行過那個指令\x3c\/p\x3e\n\n\x3cp\x3e翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)\x3c\/p\x3e\n\n\x3cp\x3e所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份\x3c\/p\x3e", "description" : "\x3cp\x3e今天發生一件有點詭異的事情本來應該要經過某個指令才會產生的檔案\x3c\/p\x3e\n\x3cp\x3e居然不知為何自己產生了在我記憶中沒有去執行過那個指令\x3c\/p\x3e\n\x3cp\x3e翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)\x3c\/p\x3e\n\x3cp\x3e所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,28 +305,17 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案</p> <p>今天發生一件有點詭異的事情,本來應該要經過某個指令才會產生的檔案</p>
<p>居然不知為何自己產生了,在我記憶中沒有去執行過那個指令</p> <p>居然不知為何自己產生了,在我記憶中沒有去執行過那個指令</p>
<p>翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)</p> <p>翻了一下 bash_history ,裡面也只有下過哪些指令,沒有紀錄時間,完全沒有參考價值(攤手)</p>
<p>所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份</p> <p>所以翻了一下網路至少把這兩台主要跑ansible的機器的log功能補上紀錄所有指令以及時間的部份</p>
<p>參考這個網頁 <p>參考這個網頁
<img src="https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server" alt="https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server" /></p> <img src="https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server" alt="https://askubuntu.com/questions/93566/how-to-log-all-bash-commands-by-all-users-on-a-server"></p>
<p>我沒有打算要紀錄「所有」使用者的指令,只要看有權力執行重要指令的帳號就好</p> <p>我沒有打算要紀錄「所有」使用者的指令,只要看有權力執行重要指令的帳號就好</p>
<p>所以先用minion(管理用的帳戶)登入後</p> <p>所以先用minion(管理用的帳戶)登入後</p>
<p>先編輯 ~/.bashrc <p>先編輯 ~/.bashrc
加入</p> 加入</p>
<pre><code>export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug &quot;$(whoami) [$$]: $(history 1 | sed &quot;s/^[ ]*[0-9]\+[ ]*//&quot; ) [$RETRN_VAL]&quot;' <pre><code>export PROMPT_COMMAND='RETRN_VAL=$?;logger -p local6.debug &quot;$(whoami) [$$]: $(history 1 | sed &quot;s/^[ ]*[0-9]\+[ ]*//&quot; ) [$RETRN_VAL]&quot;'
</code></pre> </code></pre><p>因為這邊用到syslog 的 local6所以要跟著修改 syslog的設定</p>
<p>因為這邊用到syslog 的 local6所以要跟著修改 syslog的設定</p>
<pre><code>sudo vim /etc/rsyslog.d/bash.conf <pre><code>sudo vim /etc/rsyslog.d/bash.conf
加入這行 加入這行
@ -346,10 +331,7 @@ sudo vim /etc/logrotate.d/rsyslog
然後重起 rsyslog 然後重起 rsyslog
sudo service rsyslog restart sudo service rsyslog restart
</code></pre> </code></pre><p>用 minion 登出登入後,就可以看到所有指令都被完整的紀錄下來了</p>
<p>用 minion 登出登入後,就可以看到所有指令都被完整的紀錄下來了</p>
<pre><code>sudo cat /var/log/commands.log <pre><code>sudo cat /var/log/commands.log
2019-04-23 15:18:48 [minion@hqs010 ~]$ sudo cat /var/log/commands.log 2019-04-23 15:18:48 [minion@hqs010 ~]$ sudo cat /var/log/commands.log
@ -367,9 +349,7 @@ Apr 23 15:07:28 hqs010 minion: minion [30832]: ls .inxi/ [0]
Apr 23 15:07:35 hqs010 minion: minion [30832]: clear [0] Apr 23 15:07:35 hqs010 minion: minion [30832]: clear [0]
Apr 23 15:18:48 hqs010 minion: minion [30832]: ip addr [0] Apr 23 15:18:48 hqs010 minion: minion [30832]: ip addr [0]
2019-04-23 15:18:55 [minion@hqs010 ~]$ 2019-04-23 15:18:55 [minion@hqs010 ~]$
</code></pre> </code></pre><p>裡面應該會看到滿滿的 cd / ls / cat 吧 XD</p>
<p>裡面應該會看到滿滿的 cd / ls / cat 吧 XD</p>
</article> </article>
</div> </div>
@ -644,7 +624,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -656,7 +636,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 透過 wireguard 建立多點 site to site VPN \/ Multiple Site to Site VPN Using Wireguard", "name" : "[筆記] 透過 wireguard 建立多點 site to site VPN \/ Multiple Site to Site VPN Using Wireguard",
"headline" : "[筆記] 透過 wireguard 建立多點 site to site VPN \/ Multiple Site to Site VPN Using Wireguard", "headline" : "[筆記] 透過 wireguard 建立多點 site to site VPN \/ Multiple Site to Site VPN Using Wireguard",
"description" : "\x3cp\x3e因為實在受夠了現在用的 openwrt \x2b strongswan 建立 IPSec VPN\x3c\/p\x3e\n\n\x3cp\x3e雖然說其實沒有什麼不好但是畢竟不是我建立的而當初的文件也都不見了\x3c\/p\x3e\n\n\x3cp\x3e完全沒辦法了解當時設計的邏輯造成後續debug 困難\x3c\/p\x3e\n\n\x3cp\x3e可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌\x3c\/p\x3e\n\n\x3cp\x3e之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點\x3c\/p\x3e\n\n\x3cp\x3e這次試試看躲在gateway後面看看能不能建立多點的VPN環境\x3c\/p\x3e", "description" : "\x3cp\x3e因為實在受夠了現在用的 openwrt \x2b strongswan 建立 IPSec VPN\x3c\/p\x3e\n\x3cp\x3e雖然說其實沒有什麼不好但是畢竟不是我建立的而當初的文件也都不見了\x3c\/p\x3e\n\x3cp\x3e完全沒辦法了解當時設計的邏輯造成後續debug 困難\x3c\/p\x3e\n\x3cp\x3e可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌\x3c\/p\x3e\n\x3cp\x3e之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點\x3c\/p\x3e\n\x3cp\x3e這次試試看躲在gateway後面看看能不能建立多點的VPN環境\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,47 +305,28 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN</p> <p>因為實在受夠了現在用的 openwrt + strongswan 建立 IPSec VPN</p>
<p>雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了</p> <p>雖然說其實沒有什麼不好,但是畢竟不是我建立的,而當初的文件也都不見了</p>
<p>完全沒辦法了解當時設計的邏輯造成後續debug 困難</p> <p>完全沒辦法了解當時設計的邏輯造成後續debug 困難</p>
<p>可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌</p> <p>可以想像一下一台VPN router ping 不到remote、ping不到internet、甚至ping不到自己 是要怎麼debug !?(翻桌</p>
<p>之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點</p> <p>之前買了兩台edgerouter X 拿來玩了一下 wireguard感覺還不錯不過只有測試到點對點</p>
<p>這次試試看躲在gateway後面看看能不能建立多點的VPN環境</p> <p>這次試試看躲在gateway後面看看能不能建立多點的VPN環境</p>
<h4 id="every-node">every node</h4> <h4 id="every-node">every node</h4>
<h5 id="enable-ip_forward">enable ip_forward</h5>
<h5 id="enable-ip-forward">enable ip_forward</h5>
<p>edit /etc/sysctl.conf <p>edit /etc/sysctl.conf
add below line in the end of the file</p> add below line in the end of the file</p>
<pre><code>net.ipv4.ip_forward=1 <pre><code>net.ipv4.ip_forward=1
</code></pre> </code></pre><h5 id="install-wireguard">install wireguard</h5>
<h5 id="install-wireguard">install wireguard</h5>
<pre><code>sudo apt-get install libmnl-dev linux-headers-$(uname -r) build-essential make git libelf-dev <pre><code>sudo apt-get install libmnl-dev linux-headers-$(uname -r) build-essential make git libelf-dev
git clone https://git.zx2c4.com/WireGuard git clone https://git.zx2c4.com/WireGuard
cd WireGuard/src/ cd WireGuard/src/
make make
sudo make install sudo make install
</code></pre> </code></pre><p>or
<p>or
<strong>via apt</strong></p> <strong>via apt</strong></p>
<pre><code>sudo add-apt-repository ppa:wireguard/wireguard <pre><code>sudo add-apt-repository ppa:wireguard/wireguard
sudo apt install wireguard sudo apt install wireguard
</code></pre> </code></pre><h5 id="create-wireguard-service-file">create wireguard service file</h5>
<h5 id="create-wireguard-service-file">create wireguard service file</h5>
<p>add /etc/systemd/system/multi-user.target.wants/wg-quick@wg0.service</p> <p>add /etc/systemd/system/multi-user.target.wants/wg-quick@wg0.service</p>
<pre><code>[Unit] <pre><code>[Unit]
Description=WireGuard via wg-quick(8) for %I Description=WireGuard via wg-quick(8) for %I
After=network-online.target nss-lookup.target After=network-online.target nss-lookup.target
@ -370,20 +347,12 @@ Environment=WG_ENDPOINT_RESOLUTION_RETRIES=infinity
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
</code></pre> </code></pre><h4 id="node-a">Node A</h4>
<h5 id="create-wireguard-privatepublic-key">create wireguard private/public key</h5>
<h4 id="node-a">Node A</h4>
<h5 id="create-wireguard-private-public-key">create wireguard private/public key</h5>
<pre><code>wg genkey &gt; /etc/wireguard/private <pre><code>wg genkey &gt; /etc/wireguard/private
cat /etc/wireguard/private | wg pubkey &gt; /etc/wireguard/public cat /etc/wireguard/private | wg pubkey &gt; /etc/wireguard/public
</code></pre> </code></pre><h5 id="etcwireguardwg0conf">/etc/wireguard/wg0.conf</h5>
<h5 id="etc-wireguard-wg0-conf">/etc/wireguard/wg0.conf</h5>
<p>watch the interface name , must meets the interface name in system , ens18 is the default value of my test VM</p> <p>watch the interface name , must meets the interface name in system , ens18 is the default value of my test VM</p>
<pre><code>[Interface] <pre><code>[Interface]
Address = 10.0.0.40/24 Address = 10.0.0.40/24
ListenPort = 12000 ListenPort = 12000
@ -402,20 +371,12 @@ PublicKey = public key of node C
AllowedIPs = 10.0.0.80/32,192.168.80.0/24 AllowedIPs = 10.0.0.80/32,192.168.80.0/24
Endpoint = 3.3.3.3:12000 Endpoint = 3.3.3.3:12000
PersistentKeepalive = 15 PersistentKeepalive = 15
</code></pre> </code></pre><h4 id="node-b-peer-1">Node B (peer 1)</h4>
<h5 id="create-wireguard-privatepublic-key-1">create wireguard private/public key</h5>
<h4 id="node-b-peer-1">Node B (peer 1)</h4>
<h5 id="create-wireguard-private-public-key-1">create wireguard private/public key</h5>
<pre><code>wg genkey &gt; /etc/wireguard/private <pre><code>wg genkey &gt; /etc/wireguard/private
cat /etc/wireguard/private | wg pubkey &gt; /etc/wireguard/public cat /etc/wireguard/private | wg pubkey &gt; /etc/wireguard/public
</code></pre> </code></pre><h5 id="etcwireguardwg0conf-1">/etc/wireguard/wg0.conf</h5>
<h5 id="etc-wireguard-wg0-conf-1">/etc/wireguard/wg0.conf</h5>
<p>watch the interface name , must meets the interface name in system , ens18 is the default value of my test VM</p> <p>watch the interface name , must meets the interface name in system , ens18 is the default value of my test VM</p>
<pre><code>[Interface] <pre><code>[Interface]
ListenPort = 12000 ListenPort = 12000
PrivateKey = private key of node B PrivateKey = private key of node B
@ -435,20 +396,12 @@ AllowedIPs = 10.0.0.80/32,192.168.80.0/24
Endpoint = 3.3.3.3:12000 Endpoint = 3.3.3.3:12000
PersistentKeepalive = 15 PersistentKeepalive = 15
</code></pre> </code></pre><h4 id="node-c-peer-2">Node C (peer 2)</h4>
<h5 id="create-wireguard-privatepublic-key-2">create wireguard private/public key</h5>
<h4 id="node-c-peer-2">Node C (peer 2)</h4>
<h5 id="create-wireguard-private-public-key-2">create wireguard private/public key</h5>
<pre><code>wg genkey &gt; /etc/wireguard/private <pre><code>wg genkey &gt; /etc/wireguard/private
cat /etc/wireguard/private | wg pubkey &gt; /etc/wireguard/public cat /etc/wireguard/private | wg pubkey &gt; /etc/wireguard/public
</code></pre> </code></pre><h4 id="etcwireguardwg0conf-2">/etc/wireguard/wg0.conf</h4>
<h4 id="etc-wireguard-wg0-conf-2">/etc/wireguard/wg0.conf</h4>
<p>watch the interface name , must meets the interface name in system , ens18 is the default value of my test VM</p> <p>watch the interface name , must meets the interface name in system , ens18 is the default value of my test VM</p>
<pre><code>[Interface] <pre><code>[Interface]
ListenPort = 12000 ListenPort = 12000
PrivateKey = private key of node C PrivateKey = private key of node C
@ -468,16 +421,10 @@ PublicKey = public key of node B
AllowedIPs = 10.0.0.28/32,192.168.28.0/24 AllowedIPs = 10.0.0.28/32,192.168.28.0/24
Endpoint = 2.2.2.2:12000 Endpoint = 2.2.2.2:12000
PersistentKeepalive = 15 PersistentKeepalive = 15
</code></pre> </code></pre><h5 id="test">Test</h5>
<h5 id="test">Test</h5>
<p>Reboot all nodes , check if interface wg0 up by default or not</p> <p>Reboot all nodes , check if interface wg0 up by default or not</p>
<p>use command wg show to check status</p> <p>use command wg show to check status</p>
<p>for example , this is result of wg show in node C</p> <p>for example , this is result of wg show in node C</p>
<pre><code>root@sdvpn:~# wg show <pre><code>root@sdvpn:~# wg show
interface: wg0 interface: wg0
public key: public key of Node C public key: public key of Node C
@ -497,10 +444,7 @@ peer: public key of node B
latest handshake: 2 minutes, 8 seconds ago latest handshake: 2 minutes, 8 seconds ago
transfer: 3.93 KiB received, 7.89 KiB sent transfer: 3.93 KiB received, 7.89 KiB sent
persistent keepalive: every 15 seconds persistent keepalive: every 15 seconds
</code></pre> </code></pre><p>and the ping test</p>
<p>and the ping test</p>
<pre><code>root@sdvpn:~# ping -c 1 192.168.40.40 <pre><code>root@sdvpn:~# ping -c 1 192.168.40.40
PING 192.168.40.40 (192.168.40.40) 56(84) bytes of data. PING 192.168.40.40 (192.168.40.40) 56(84) bytes of data.
64 bytes from 192.168.40.40: icmp_seq=1 ttl=63 time=21.2 ms 64 bytes from 192.168.40.40: icmp_seq=1 ttl=63 time=21.2 ms
@ -516,10 +460,7 @@ PING 192.168.28.40 (192.168.28.40) 56(84) bytes of data.
1 packets transmitted, 1 received, 0% packet loss, time 0ms 1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 24.208/24.208/24.208/0.000 ms rtt min/avg/max/mdev = 24.208/24.208/24.208/0.000 ms
root@sdvpn:~# root@sdvpn:~#
</code></pre> </code></pre><p>and the traceroute</p>
<p>and the traceroute</p>
<pre><code>root@sdvpn:~# traceroute 192.168.40.40 <pre><code>root@sdvpn:~# traceroute 192.168.40.40
traceroute to 192.168.40.40 (192.168.40.40), 30 hops max, 60 byte packets traceroute to 192.168.40.40 (192.168.40.40), 30 hops max, 60 byte packets
1 10.0.0.40 (10.0.0.40) 21.349 ms 22.337 ms 22.576 ms 1 10.0.0.40 (10.0.0.40) 21.349 ms 22.337 ms 22.576 ms
@ -529,44 +470,27 @@ traceroute to 192.168.28.40 (192.168.28.40), 30 hops max, 60 byte packets
1 10.0.0.28 (10.0.0.28) 25.481 ms 30.117 ms 32.086 ms 1 10.0.0.28 (10.0.0.28) 25.481 ms 30.117 ms 32.086 ms
2 dcpc040.abc.com (192.168.28.40) 33.811 ms 35.360 ms 36.769 ms 2 dcpc040.abc.com (192.168.28.40) 33.811 ms 35.360 ms 36.769 ms
root@sdvpn:~# root@sdvpn:~#
</code></pre> </code></pre><h4 id="additonal-steps">additonal steps</h4>
<h4 id="additonal-steps">additonal steps</h4>
<h5 id="enable-firewall-nat-in-each-nodes-router">enable firewall NAT in each nodes router</h5> <h5 id="enable-firewall-nat-in-each-nodes-router">enable firewall NAT in each nodes router</h5>
<p>not necessary , but if the wireguard node is behind a NAT router , then must enable NAT for wireguard</p> <p>not necessary , but if the wireguard node is behind a NAT router , then must enable NAT for wireguard</p>
<p>1.1.1.1 is the WAN IP of the router , and 192.168.80.4 is the wireguard LAN ip, I map port 224 to ssh and 12000 for wireguard</p> <p>1.1.1.1 is the WAN IP of the router , and 192.168.80.4 is the wireguard LAN ip, I map port 224 to ssh and 12000 for wireguard</p>
<pre><code>iptables -t nat -A PREROUTING -i eth1 -d 1.1.1.1 -p tcp --dport 224 -j DNAT --to-destination 192.168.80.4:22 <pre><code>iptables -t nat -A PREROUTING -i eth1 -d 1.1.1.1 -p tcp --dport 224 -j DNAT --to-destination 192.168.80.4:22
iptables -t nat -A PREROUTING -i eth1 -d 1.1.1.1 -p udp --dport 12000 -j DNAT --to-destination 192.168.80.4:12000 iptables -t nat -A PREROUTING -i eth1 -d 1.1.1.1 -p udp --dport 12000 -j DNAT --to-destination 192.168.80.4:12000
</code></pre> </code></pre><h4 id="summary">summary</h4>
<h4 id="summary">summary</h4>
<p>if want to add more nodes into VPN , just follow the logic and steps.</p> <p>if want to add more nodes into VPN , just follow the logic and steps.</p>
<pre><code>create private/public key <pre><code>create private/public key
create wg0.conf create wg0.conf
add new nodes in every other nodes wg0.conf as peer add new nodes in every other nodes wg0.conf as peer
</code></pre> </code></pre><ol>
<ol>
<li>for route , must add remote network in AllowedIPs</li> <li>for route , must add remote network in AllowedIPs</li>
<li>check ip_forward is enable</li> <li>check ip_forward is enable</li>
<li>I think the postup haws no effect here , because the firewall service was disable by default , and if I use iptables -F to flush all firewall rules , the network still remain in connected.</li> <li>I think the postup haws no effect here , because the firewall service was disable by default , and if I use iptables -F to flush all firewall rules , the network still remain in connected.</li>
<li>need to create an ansible playbook for this</li> <li>need to create an ansible playbook for this</li>
</ol> </ol>
<h4 id="update">Update</h4> <h4 id="update">Update</h4>
<h5 id="strongswan-ipsec-vs-wireguard">strongswan IPSEC VS wireguard</h5> <h5 id="strongswan-ipsec-vs-wireguard">strongswan IPSEC VS wireguard</h5>
<p><strong>wireguard almost twice faster than strongswan</strong></p> <p><strong>wireguard almost twice faster than strongswan</strong></p>
<p>iperf test with wireguard VPN 30 seconds benchmark</p> <p>iperf test with wireguard VPN 30 seconds benchmark</p>
<pre><code>root@sdvpn:~# iperf -c 192.168.40.7 -t 30 <pre><code>root@sdvpn:~# iperf -c 192.168.40.7 -t 30
------------------------------------------------------------ ------------------------------------------------------------
Client connecting to 192.168.40.7, TCP port 5001 Client connecting to 192.168.40.7, TCP port 5001
@ -576,10 +500,7 @@ TCP window size: 85.0 KByte (default)
[ ID] Interval Transfer Bandwidth [ ID] Interval Transfer Bandwidth
[ 3] 0.0-30.1 sec 65.1 MBytes 18.1 Mbits/sec [ 3] 0.0-30.1 sec 65.1 MBytes 18.1 Mbits/sec
root@sdvpn:~# root@sdvpn:~#
</code></pre> </code></pre><p>iperf test with strongswan VPN</p>
<p>iperf test with strongswan VPN</p>
<pre><code>root@sdvpn:~# iperf -c 192.168.40.7 -t 30 <pre><code>root@sdvpn:~# iperf -c 192.168.40.7 -t 30
------------------------------------------------------------ ------------------------------------------------------------
Client connecting to 192.168.40.7, TCP port 5001 Client connecting to 192.168.40.7, TCP port 5001
@ -868,7 +789,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -880,7 +801,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -314,29 +310,22 @@ if (!doNotTrack) {
就可以抓出備份空間成長速度、推估需要多大的磁碟空間 就可以抓出備份空間成長速度、推估需要多大的磁碟空間
找了一些工具,結果發現 durep 這個 ubuntu 內建的工具 找了一些工具,結果發現 durep 這個 ubuntu 內建的工具
基本上可以滿足我的需求</p> 基本上可以滿足我的需求</p>
<p>我的需求其實很簡單</p> <p>我的需求其實很簡單</p>
<ol> <ol>
<li>可以指定目錄&rdquo;深度&rdquo;</li> <li>可以指定目錄&quot;深度&rdquo;</li>
<li>可以用圖表的方式顯示目前用量</li> <li>可以用圖表的方式顯示目前用量</li>
<li>每天寄出報表</li> <li>每天寄出報表</li>
</ol> </ol>
<p>來看一下 durep 執行的狀況 <p>來看一下 durep 執行的狀況
<strong>如果只指定一層,那就是顯示該目錄底下的使用狀況</strong></p> <strong>如果只指定一層,那就是顯示該目錄底下的使用狀況</strong></p>
<pre><code>2018-10-29 15:50:21 [minion@tps006 ~]$ sudo durep -td 1 -sd /file <pre><code>2018-10-29 15:50:21 [minion@tps006 ~]$ sudo durep -td 1 -sd /file
[ /file 259.0G (0 files, 3 dirs) ] [ /file 259.0G (0 files, 3 dirs) ]
259.0G [############################# ] 100.00% Oct 25 2017 team/ 259.0G [############################# ] 100.00% Oct 25 2017 team/
1.7M [ ] 0.00% Oct 23 14:04 html/ 1.7M [ ] 0.00% Oct 23 14:04 html/
741.1K [ ] 0.00% Jul 11 2016 team_commons/ 741.1K [ ] 0.00% Jul 11 2016 team_commons/
2018-10-29 15:50:26 [minion@tps006 ~]$ sudo durep -td 1 -sd /file 2018-10-29 15:50:26 [minion@tps006 ~]$ sudo durep -td 1 -sd /file
</code></pre> </code></pre><p>如果指定兩層
<p>如果指定兩層
就顯示包含下一層目錄的磁碟使用量 <em>好像廢話</em></p> 就顯示包含下一層目錄的磁碟使用量 <em>好像廢話</em></p>
<pre><code>2018-10-29 16:14:23 [mini@s006 ~]$ sudo durep -td 2 -sd /file <pre><code>2018-10-29 16:14:23 [mini@s006 ~]$ sudo durep -td 2 -sd /file
[ /file 259.0G (0 files, 3 dirs) ] [ /file 259.0G (0 files, 3 dirs) ]
259.0G [############################# ] 100.00% Oct 25 2017 team/ 259.0G [############################# ] 100.00% Oct 25 2017 team/
@ -360,13 +349,10 @@ if (!doNotTrack) {
709.6K [############################ ] 95.75% Oct 23 14:05 tp/ 709.6K [############################ ] 95.75% Oct 23 14:05 tp/
31.5K [# ] 4.25% Oct 23 14:05 temporary/ 31.5K [# ] 4.25% Oct 23 14:05 temporary/
2018-10-29 16:14:36 [mini@s006 ~]$ 2018-10-29 16:14:36 [mini@s006 ~]$
</code></pre> </code></pre><p>搭配mail 使用,有點可惜的是在郵件內顯示,格式稍微有點跑掉
<p>搭配mail 使用,有點可惜的是在郵件內顯示,格式稍微有點跑掉
不過至少需要看到的目錄總使用量(左上角),還有各個子目錄的用量都可以清楚的看到 不過至少需要看到的目錄總使用量(左上角),還有各個子目錄的用量都可以清楚的看到
如果能夠有縮排就更好了!</p> 如果能夠有縮排就更好了!</p>
<p><img src="https://i.imgur.com/ySNJJWx.png" alt="https://i.imgur.com/ySNJJWx.png"></p>
<p><img src="https://i.imgur.com/ySNJJWx.png" alt="https://i.imgur.com/ySNJJWx.png" /></p>
</article> </article>
</div> </div>
@ -643,7 +629,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -655,7 +641,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在ubuntu 18.04安裝psql 11 以及 pg_auto_failover \/ install psql 11 and pg_auto_failover in ubuntu 18.04", "name" : "[筆記] 在ubuntu 18.04安裝psql 11 以及 pg_auto_failover \/ install psql 11 and pg_auto_failover in ubuntu 18.04",
"headline" : "[筆記] 在ubuntu 18.04安裝psql 11 以及 pg_auto_failover \/ install psql 11 and pg_auto_failover in ubuntu 18.04", "headline" : "[筆記] 在ubuntu 18.04安裝psql 11 以及 pg_auto_failover \/ install psql 11 and pg_auto_failover in ubuntu 18.04",
"description" : "\x3cp\x3e最近都在弄postgresql\x3c\/p\x3e\n\n\x3cp\x3e備份、還原測試得差不多了就等著看到時候要用什麼方式\x3c\/p\x3e\n\n\x3cp\x3e前幾天看到 pg_auto_failover 這個postgresql 的extension\x3c\/p\x3e\n\n\x3cp\x3e\x3ca href=\x22https:\/\/github.com\/citusdata\/pg_auto_failover\x22\x3ehttps:\/\/github.com\/citusdata\/pg_auto_failover\x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e感覺挺不錯的看起來設定很簡單雖然之前已經測試了 keepalived 做 HA\x3c\/p\x3e\n\n\x3cp\x3e不過反正當作練功嘛多測試一套也不錯\x3c\/p\x3e", "description" : "\x3cp\x3e最近都在弄postgresql\x3c\/p\x3e\n\x3cp\x3e備份、還原測試得差不多了就等著看到時候要用什麼方式\x3c\/p\x3e\n\x3cp\x3e前幾天看到 pg_auto_failover 這個postgresql 的extension\x3c\/p\x3e\n\x3cp\x3e\x3ca href=\x22https:\/\/github.com\/citusdata\/pg_auto_failover\x22\x3ehttps:\/\/github.com\/citusdata\/pg_auto_failover\x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e感覺挺不錯的看起來設定很簡單雖然之前已經測試了 keepalived 做 HA\x3c\/p\x3e\n\x3cp\x3e不過反正當作練功嘛多測試一套也不錯\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,97 +305,52 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近都在弄postgresql</p> <p>最近都在弄postgresql</p>
<p>備份、還原測試得差不多了,就等著看到時候要用什麼方式</p> <p>備份、還原測試得差不多了,就等著看到時候要用什麼方式</p>
<p>前幾天看到 pg_auto_failover 這個postgresql 的extension</p> <p>前幾天看到 pg_auto_failover 這個postgresql 的extension</p>
<p><a href="https://github.com/citusdata/pg_auto_failover">https://github.com/citusdata/pg_auto_failover</a></p> <p><a href="https://github.com/citusdata/pg_auto_failover">https://github.com/citusdata/pg_auto_failover</a></p>
<p>感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA</p> <p>感覺挺不錯的,看起來設定很簡單,雖然之前已經測試了 keepalived 做 HA</p>
<p>不過,反正當作練功嘛,多測試一套也不錯!</p> <p>不過,反正當作練功嘛,多測試一套也不錯!</p>
<p>基本的邏輯是 一台 monitor , 一台 master/primary node ,一台 slave/secondary node 組成一個cluster</p> <p>基本的邏輯是 一台 monitor , 一台 master/primary node ,一台 slave/secondary node 組成一個cluster</p>
<p>官方提供的架構圖如下</p> <p>官方提供的架構圖如下</p>
<p><img src="https://i.imgur.com/SyPFXZ1.png" alt="pg_auto_failover architecture"></p>
<p><img src="https://i.imgur.com/SyPFXZ1.png" alt="pg_auto_failover architecture" /></p>
<p>當master/primary node 上面的 postgresql 服務死掉了slave/secondary node 會自動接手</p> <p>當master/primary node 上面的 postgresql 服務死掉了slave/secondary node 會自動接手</p>
<p>等到master/primary node 回來之後,會自動降級為 slave/secondary node</p> <p>等到master/primary node 回來之後,會自動降級為 slave/secondary node</p>
<p>而原本的 slave/secondary node 就會變成 master/primary</p> <p>而原本的 slave/secondary node 就會變成 master/primary</p>
<hr>
<hr />
<h4 id="安裝相關套件">安裝相關套件</h4> <h4 id="安裝相關套件">安裝相關套件</h4>
<p><strong>以下步驟在三個node 都要操作</strong></p> <p><strong>以下步驟在三個node 都要操作</strong></p>
<p>安裝相依套件</p> <p>安裝相依套件</p>
<pre><code>sudo apt install make libssl1.0.0 libssl-dev libkrb5-3 libkrb5-dev libpq5 libpq-dev pgdg-keyring ssl-cert postgresql-plperl-11 postgresql-pltcl-11 postgresql-plpython-11 postgresql-plpython3-11 postgresql-11 postgresql-common postgresql-server-dev-11 postgresql-client-11 postgresql-client-common postgresql-doc-11 tcl8.6 libjson-perl tcl-tclreadline <pre><code>sudo apt install make libssl1.0.0 libssl-dev libkrb5-3 libkrb5-dev libpq5 libpq-dev pgdg-keyring ssl-cert postgresql-plperl-11 postgresql-pltcl-11 postgresql-plpython-11 postgresql-plpython3-11 postgresql-11 postgresql-common postgresql-server-dev-11 postgresql-client-11 postgresql-client-common postgresql-doc-11 tcl8.6 libjson-perl tcl-tclreadline
</code></pre> </code></pre><p>安裝完成後切換到postgres身份把原本系統內的postgresql 檔存放目錄還有資料庫檔案目錄都清掉</p>
<p>安裝完成後切換到postgres身份把原本系統內的postgresql 檔存放目錄還有資料庫檔案目錄都清掉</p>
<pre><code>sudo su - postgres <pre><code>sudo su - postgres
mv /etc/postgresql/11 /etc/postgresql/11.bak mv /etc/postgresql/11 /etc/postgresql/11.bak
mv /var/lib/postgresql/11 /var/lib/postgresql/11.bak mv /var/lib/postgresql/11 /var/lib/postgresql/11.bak
exit exit
</code></pre> </code></pre><p>開始安裝 pg_auto_failover</p>
<p>開始安裝 pg_auto_failover</p>
<pre><code>curl https://install.citusdata.com/community/deb.sh | sudo bash <pre><code>curl https://install.citusdata.com/community/deb.sh | sudo bash
sudo apt install postgresql-11-auto-failover -y sudo apt install postgresql-11-auto-failover -y
</code></pre> </code></pre><p>postgresql 的相關執行檔路徑預設不會載入到PATH變數中所以要自己手動增加</p>
<p>postgresql 的相關執行檔路徑預設不會載入到PATH變數中所以要自己手動增加</p>
<p>直接加入 /etc/environment ,或者是去修改使用者的 .profile 載入正確的 $PATH 都可以</p> <p>直接加入 /etc/environment ,或者是去修改使用者的 .profile 載入正確的 $PATH 都可以</p>
<pre><code>#replace PATH variable in /etc/environment <pre><code>#replace PATH variable in /etc/environment
PATH=&quot;/usr/lib/postgresql/11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games&quot; PATH=&quot;/usr/lib/postgresql/11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games&quot;
</code></pre> </code></pre><p>因為要用 pg_auto_failover 來控制postgresql ,所以要把系統內建的服務先停掉,並且設定開啟不啟動</p>
<p>因為要用 pg_auto_failover 來控制postgresql ,所以要把系統內建的服務先停掉,並且設定開啟不啟動</p>
<pre><code>sudo systemctl disable postgresql <pre><code>sudo systemctl disable postgresql
sudo systemctl stop postgresql sudo systemctl stop postgresql
</code></pre> </code></pre><p>為了讓三台機器可以直接用hostname溝通所以要修改 /etc/hosts</p>
<p>為了讓三台機器可以直接用hostname溝通所以要修改 /etc/hosts</p>
<pre><code>#add to /etc/hosts <pre><code>#add to /etc/hosts
192.168.11.151 monitor monitor.abc.com 192.168.11.151 monitor monitor.abc.com
192.168.11.152 pg-primary pg-primary.abc.com 192.168.11.152 pg-primary pg-primary.abc.com
192.168.11.153 pg-slave pg-slave.abc.com 192.168.11.153 pg-slave pg-slave.abc.com
</code></pre> </code></pre><p>以上完成在三台node上安裝postgresql/pg_auto_failover 的工作</p>
<hr>
<p>以上完成在三台node上安裝postgresql/pg_auto_failover 的工作</p>
<hr />
<h4 id="設定-monitor-node">設定 monitor node</h4> <h4 id="設定-monitor-node">設定 monitor node</h4>
<p><strong>在monitor node操作</strong></p> <p><strong>在monitor node操作</strong></p>
<p><strong>建立monitor node</strong></p> <p><strong>建立monitor node</strong></p>
<pre><code>sudo runuser -l postgres -c &quot;/usr/bin/pg_autoctl create monitor --pgdata /var/lib/postgresql/11/main --pgport 5432 --nodename monitor&quot; <pre><code>sudo runuser -l postgres -c &quot;/usr/bin/pg_autoctl create monitor --pgdata /var/lib/postgresql/11/main --pgport 5432 --nodename monitor&quot;
</code></pre> </code></pre><p>這個步驟會在pg_hba.conf 中,新增一筆紀錄</p>
<p>這個步驟會在pg_hba.conf 中,新增一筆紀錄</p>
<pre><code>host &quot;pg_auto_failover&quot; &quot;autoctl_node&quot; 192.168.11.0/24 trust # Auto-generated by pg_auto_failover <pre><code>host &quot;pg_auto_failover&quot; &quot;autoctl_node&quot; 192.168.11.0/24 trust # Auto-generated by pg_auto_failover
</code></pre> </code></pre><p>檢查一下狀態,看看有沒有安裝成功</p>
<p>檢查一下狀態,看看有沒有安裝成功</p>
<pre><code>2019-09-19 06:56:09 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;psql -c '\'du&quot; <pre><code>2019-09-19 06:56:09 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;psql -c '\'du&quot;
List of roles List of roles
Role name | Attributes | Member of Role name | Attributes | Member of
@ -420,41 +371,25 @@ sudo systemctl stop postgresql
template1 | postgres | SQL_ASCII | C | C | =c/postgres + template1 | postgres | SQL_ASCII | C | C | =c/postgres +
| | | | | postgres=CTc/postgres | | | | | postgres=CTc/postgres
(4 rows) (4 rows)
</code></pre> </code></pre><p>OK看起來沒有問題</p>
<p>OK看起來沒有問題</p>
<p><strong>啟動pg_auto_failover monitor</strong></p> <p><strong>啟動pg_auto_failover monitor</strong></p>
<pre><code>2019-09-19 06:56:19 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 06:56:19 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run --pgdata /var/lib/postgresql/11/main&quot;
06:57:38 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot; 06:57:38 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot;
06:57:38 INFO PostgreSQL is running in &quot;/var/lib/postgresql/11/main&quot; on port 5432 06:57:38 INFO PostgreSQL is running in &quot;/var/lib/postgresql/11/main&quot; on port 5432
06:57:38 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor 06:57:38 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor
06:57:38 INFO pg_auto_failover monitor is ready at postgres://autoctl_node@monitor:5432/pg_auto_failover 06:57:38 INFO pg_auto_failover monitor is ready at postgres://autoctl_node@monitor:5432/pg_auto_failover
06:57:38 INFO Contacting the monitor to LISTEN to its events 06:57:38 INFO Contacting the monitor to LISTEN to its events
</code></pre> </code></pre><p>這個指令會停留在console畫面上要不就是在最後加上 <code>&amp;</code> 放去背景執行</p>
<p>這個指令會停留在console畫面上要不就是在最後加上 <code>&amp;</code> 放去背景執行</p>
<p>要不就是用systemd/supervisor 來控制,這個後面再來改</p> <p>要不就是用systemd/supervisor 來控制,這個後面再來改</p>
<p>就先放著讓他跑還可以順便觀察cluster變動時的狀態</p> <p>就先放著讓他跑還可以順便觀察cluster變動時的狀態</p>
<p>再開一個terminal 跑底下的指令產生monitor node 的URI 在建立maser/slave node 的時候會用到</p> <p>再開一個terminal 跑底下的指令產生monitor node 的URI 在建立maser/slave node 的時候會用到</p>
<pre><code>2019-09-19 06:58:39 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show uri --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 06:58:39 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show uri --pgdata /var/lib/postgresql/11/main&quot;
postgres://autoctl_node@monitor:5432/pg_auto_failover postgres://autoctl_node@monitor:5432/pg_auto_failover
2019-09-19 06:59:01 [administrator@monitor ~]$ 2019-09-19 06:59:01 [administrator@monitor ~]$
</code></pre> </code></pre><p>以上完成monitor node 的準備工作</p>
<hr>
<p>以上完成monitor node 的準備工作</p> <h4 id="設定masterprimary-node">設定master/primary node</h4>
<hr />
<h4 id="設定master-primary-node">設定master/primary node</h4>
<p><strong>建立pg_auto_failover master/primary node</strong></p> <p><strong>建立pg_auto_failover master/primary node</strong></p>
<pre><code>2019-09-19 15:04:16 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl create postgres --pgdata /var/lib/postgresql/11/main --pgport 5432 --nodename pg-primary --monitor postgres://autoctl_node@monitor:5432/pg_auto_failover&quot; <pre><code>2019-09-19 15:04:16 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl create postgres --pgdata /var/lib/postgresql/11/main --pgport 5432 --nodename pg-primary --monitor postgres://autoctl_node@monitor:5432/pg_auto_failover&quot;
15:04:19 INFO Found pg_ctl for PostgreSQL 11.5 at /usr/lib/postgresql/11/bin/pg_ctl 15:04:19 INFO Found pg_ctl for PostgreSQL 11.5 at /usr/lib/postgresql/11/bin/pg_ctl
15:04:19 INFO Registered node pg-primary:5432 with id 1 in formation &quot;default&quot;, group 0. 15:04:19 INFO Registered node pg-primary:5432 with id 1 in formation &quot;default&quot;, group 0.
@ -470,10 +405,7 @@ postgres://autoctl_node@monitor:5432/pg_auto_failover
15:04:21 INFO Transition complete: current state is now &quot;single&quot; 15:04:21 INFO Transition complete: current state is now &quot;single&quot;
15:04:21 INFO Keeper has been succesfully initialized. 15:04:21 INFO Keeper has been succesfully initialized.
2019-09-19 15:04:21 [administrator@pg-primary ~]$ 2019-09-19 15:04:21 [administrator@pg-primary ~]$
</code></pre> </code></pre><p><strong>啟動 pg_auto_failover master/primary node</strong></p>
<p><strong>啟動 pg_auto_failover master/primary node</strong></p>
<pre><code>2019-09-19 15:14:34 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 15:14:34 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run --pgdata /var/lib/postgresql/11/main&quot;
15:15:11 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot; 15:15:11 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot;
15:15:11 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor 15:15:11 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor
@ -481,26 +413,17 @@ postgres://autoctl_node@monitor:5432/pg_auto_failover
15:15:11 INFO Calling node_active for node default/1/0 with current state: single, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1. 15:15:11 INFO Calling node_active for node default/1/0 with current state: single, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1.
15:15:16 INFO Calling node_active for node default/1/0 with current state: single, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1. 15:15:16 INFO Calling node_active for node default/1/0 with current state: single, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1.
15:15:21 INFO Calling node_active for node default/1/0 with current state: single, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1. 15:15:21 INFO Calling node_active for node default/1/0 with current state: single, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1.
</code></pre> </code></pre><p>一樣,執行完之後,會停留在畫面上,所以開另一個視窗來執行以下檢查的指令</p>
<p>一樣,執行完之後,會停留在畫面上,所以開另一個視窗來執行以下檢查的指令</p>
<pre><code>2019-09-19 15:17:08 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show state --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 15:17:08 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show state --pgdata /var/lib/postgresql/11/main&quot;
Name | Port | Group | Node | Current State | Assigned State Name | Port | Group | Node | Current State | Assigned State
-----------+--------+-------+-------+-------------------+------------------ -----------+--------+-------+-------+-------------------+------------------
pg-primary | 5432 | 0 | 1 | single | single pg-primary | 5432 | 0 | 1 | single | single
2019-09-19 15:17:16 [administrator@pg-primary ~]$ 2019-09-19 15:17:16 [administrator@pg-primary ~]$
</code></pre> </code></pre><p>以上master/primary node 設定結束</p>
<hr>
<p>以上master/primary node 設定結束</p>
<hr />
<p>####設定 slave/secondary node</p> <p>####設定 slave/secondary node</p>
<p><strong>建立 pg_auto_failover slave/secondary node</strong></p> <p><strong>建立 pg_auto_failover slave/secondary node</strong></p>
<pre><code>2019-09-19 07:04:08 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl create postgres --pgdata /var/lib/postgresql/11/main --pgport 5432 --nodename pg-slave --monitor postgres://autoctl_node@monitor:5432/pg_auto_failover&quot; <pre><code>2019-09-19 07:04:08 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl create postgres --pgdata /var/lib/postgresql/11/main --pgport 5432 --nodename pg-slave --monitor postgres://autoctl_node@monitor:5432/pg_auto_failover&quot;
07:19:57 INFO Found pg_ctl for PostgreSQL 11.5 at /usr/lib/postgresql/11/bin/pg_ctl 07:19:57 INFO Found pg_ctl for PostgreSQL 11.5 at /usr/lib/postgresql/11/bin/pg_ctl
07:19:57 INFO Registered node pg-slave:5432 with id 2 in formation &quot;default&quot;, group 0. 07:19:57 INFO Registered node pg-slave:5432 with id 2 in formation &quot;default&quot;, group 0.
@ -530,12 +453,8 @@ pg_basebackup: base backup completed
07:20:04 INFO Transition complete: current state is now &quot;catchingup&quot; 07:20:04 INFO Transition complete: current state is now &quot;catchingup&quot;
07:20:04 INFO Keeper has been succesfully initialized. 07:20:04 INFO Keeper has been succesfully initialized.
2019-09-19 07:20:04 [administrator@pg-slave ~]$ 2019-09-19 07:20:04 [administrator@pg-slave ~]$
</code></pre> </code></pre><p>可以看到在建立slave/secondary node 的時候,就會開始第一次的同步</p>
<p>可以看到在建立slave/secondary node 的時候,就會開始第一次的同步</p>
<p>**啟動 pg_auto_failover slave/secondary node</p> <p>**啟動 pg_auto_failover slave/secondary node</p>
<pre><code>2019-09-19 07:20:04 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 07:20:04 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run --pgdata /var/lib/postgresql/11/main&quot;
07:21:33 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot; 07:21:33 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot;
07:21:33 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor 07:21:33 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor
@ -545,10 +464,7 @@ pg_basebackup: base backup completed
07:21:33 INFO Transition complete: current state is now &quot;secondary&quot; 07:21:33 INFO Transition complete: current state is now &quot;secondary&quot;
07:21:34 INFO Calling node_active for node default/2/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 07:21:34 INFO Calling node_active for node default/2/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
07:21:39 INFO Calling node_active for node default/2/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 07:21:39 INFO Calling node_active for node default/2/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
</code></pre> </code></pre><p>開新視窗確認狀態</p>
<p>開新視窗確認狀態</p>
<pre><code>2019-09-19 07:22:03 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show state --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 07:22:03 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show state --pgdata /var/lib/postgresql/11/main&quot;
Name | Port | Group | Node | Current State | Assigned State Name | Port | Group | Node | Current State | Assigned State
-----------+--------+-------+-------+-------------------+------------------ -----------+--------+-------+-------+-------------------+------------------
@ -556,41 +472,23 @@ pg-primary | 5432 | 0 | 1 | primary | primary
pg-slave | 5432 | 0 | 2 | secondary | secondary pg-slave | 5432 | 0 | 2 | secondary | secondary
2019-09-19 07:22:45 [administrator@pg-slave ~]$ 2019-09-19 07:22:45 [administrator@pg-slave ~]$
</code></pre> </code></pre><p>正常的話,應該就是會出現兩個 node ,一個 pg-primary 一個pg-slave</p>
<p>正常的話,應該就是會出現兩個 node ,一個 pg-primary 一個pg-slave</p>
<p><strong>generate URI for applications</strong></p> <p><strong>generate URI for applications</strong></p>
<p>這個步驟是用來產生給client/applications 連線用的連線字串(connection string)</p> <p>這個步驟是用來產生給client/applications 連線用的連線字串(connection string)</p>
<pre><code>2019-09-19 07:29:56 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show uri --formation default --pgdata /var/lib/postgresql/11/main&quot; <pre><code>2019-09-19 07:29:56 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show uri --formation default --pgdata /var/lib/postgresql/11/main&quot;
postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write
2019-09-19 07:30:06 [administrator@pg-slave ~]$ 2019-09-19 07:30:06 [administrator@pg-slave ~]$
</code></pre> </code></pre><p>以後就都通過這個URI來存取這個cluster</p>
<p>以後就都通過這個URI來存取這個cluster</p>
<p>切記,<strong>不可以用系統內建的postgresql service一定要用 pg_auto_failover 來啟動DB</strong></p> <p>切記,<strong>不可以用系統內建的postgresql service一定要用 pg_auto_failover 來啟動DB</strong></p>
<p>以上 slave/secondary node 設定完成</p> <p>以上 slave/secondary node 設定完成</p>
<hr>
<hr />
<p>設定上並不複雜比起keepalived 要簡單太多了..</p> <p>設定上並不複雜比起keepalived 要簡單太多了..</p>
<p>那就要評估看看在異常狀況發生,切換資料庫時的表現了</p> <p>那就要評估看看在異常狀況發生,切換資料庫時的表現了</p>
<p>接下來就繼續測試auto failover 的功能!</p> <p>接下來就繼續測試auto failover 的功能!</p>
<hr>
<hr />
<h4 id="測試-auto-failover">測試 auto failover</h4> <h4 id="測試-auto-failover">測試 auto failover</h4>
<p>首先,在 pg-prmiary node 上透過上面產生的URI來進入psql</p> <p>首先,在 pg-prmiary node 上透過上面產生的URI來進入psql</p>
<p>然後建立一個測試db、建立一個測試table插入幾筆資料</p> <p>然後建立一個測試db、建立一個測試table插入幾筆資料</p>
<pre><code>2019-09-20 10:58:21 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot; <pre><code>2019-09-20 10:58:21 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot;
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -618,10 +516,7 @@ postgres=# select * from testtbl;
postgres=# \q postgres=# \q
2019-09-20 10:59:30 [administrator@pg-primary ~]$ 2019-09-20 10:59:30 [administrator@pg-primary ~]$
</code></pre> </code></pre><p>然後切換到 pg-slave 一樣透過URI進入psql 撈看看資料</p>
<p>然後切換到 pg-slave 一樣透過URI進入psql 撈看看資料</p>
<pre><code>2019-09-20 03:02:12 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot; <pre><code>2019-09-20 03:02:12 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot;
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -636,14 +531,9 @@ postgres=# select * from testtbl;
(4 rows) (4 rows)
postgres=# postgres=#
</code></pre> </code></pre><p>確認透過URI的確是可以正常的存取資料</p>
<p>確認透過URI的確是可以正常的存取資料</p>
<p>在兩台單機上(master/slave)上也都可以看到同樣的資料代表資料有正確的被同步到兩台node上</p> <p>在兩台單機上(master/slave)上也都可以看到同樣的資料代表資料有正確的被同步到兩台node上</p>
<p><strong>pg-slave</strong></p> <p><strong>pg-slave</strong></p>
<pre><code>2019-09-20 03:03:06 [administrator@pg-slave ~]$ sudo runuser -l postgres -c psql <pre><code>2019-09-20 03:03:06 [administrator@pg-slave ~]$ sudo runuser -l postgres -c psql
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -671,10 +561,7 @@ postgres=# select * from testtbl;
(4 rows) (4 rows)
postgres=# postgres=#
</code></pre> </code></pre><p><strong>pg-master</strong></p>
<p><strong>pg-master</strong></p>
<pre><code>2019-09-20 10:59:30 [administrator@pg-primary ~]$ sudo runuser -l postgres -c psql <pre><code>2019-09-20 10:59:30 [administrator@pg-primary ~]$ sudo runuser -l postgres -c psql
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -702,12 +589,8 @@ postgres=# select * from testtbl;
(4 rows) (4 rows)
postgres=# postgres=#
</code></pre> </code></pre><p>接著來把本來是master的機器關掉看看會有什麼變化</p>
<p>接著來把本來是master的機器關掉看看會有什麼變化</p>
<p>首先在pg-slave 這台機器上就會看到cluster 有狀況primary 不見了</p> <p>首先在pg-slave 這台機器上就會看到cluster 有狀況primary 不見了</p>
<pre><code>03:06:02 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. <pre><code>03:06:02 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
03:06:08 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 03:06:08 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
03:06:13 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 03:06:13 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
@ -721,10 +604,7 @@ postgres=#
03:06:33 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1. 03:06:33 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1.
03:06:38 ERROR PostgreSQL cannot reach the primary server: the system view pg_stat_wal_receiver has no rows. 03:06:38 ERROR PostgreSQL cannot reach the primary server: the system view pg_stat_wal_receiver has no rows.
03:06:38 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1. 03:06:38 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is -1.
</code></pre> </code></pre><p>這時候在pg-slave 還能不能透過URI 連線進去psql操作</p>
<p>這時候在pg-slave 還能不能透過URI 連線進去psql操作</p>
<pre><code>2019-09-20 03:08:06 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot; <pre><code>2019-09-20 03:08:06 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot;
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -758,10 +638,7 @@ postgres=# insert into testtbl_1108 values (55);
INSERT 0 1 INSERT 0 1
postgres=# \q postgres=# \q
2019-09-20 03:09:34 [administrator@pg-slave ~]$ 2019-09-20 03:09:34 [administrator@pg-slave ~]$
</code></pre> </code></pre><p>很好,看起來沒有問題,這時候把 pg-primary 打開,執行啟動 pg_auto_failover node 的指令,看看會發生什麼事</p>
<p>很好,看起來沒有問題,這時候把 pg-primary 打開,執行啟動 pg_auto_failover node 的指令,看看會發生什麼事</p>
<pre><code>2019-09-20 11:12:13 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run&quot; <pre><code>2019-09-20 11:12:13 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;pg_autoctl run&quot;
11:12:29 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot; 11:12:29 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot;
11:12:29 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor 11:12:29 INFO The version of extenstion &quot;pgautofailover&quot; is &quot;1.0&quot; on the monitor
@ -814,12 +691,8 @@ pg_basebackup: base backup completed
11:12:53 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 11:12:53 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
11:12:58 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 11:12:58 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
11:13:03 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 11:13:03 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
</code></pre> </code></pre><p>可以看到 pg_auto_failover 偵測到了cluster node 有意異動開始同步資料然後切換角色從primary變成了 secondary</p>
<p>可以看到 pg_auto_failover 偵測到了cluster node 有意異動開始同步資料然後切換角色從primary變成了 secondary</p>
<p>同一時間在pg-slave 的訊息也有變動</p> <p>同一時間在pg-slave 的訊息也有變動</p>
<pre><code>03:12:34 INFO Calling node_active for node default/4/0 with current state: wait_primary, PostgreSQL is running, sync_state is &quot;async&quot;, WAL delta is 0. <pre><code>03:12:34 INFO Calling node_active for node default/4/0 with current state: wait_primary, PostgreSQL is running, sync_state is &quot;async&quot;, WAL delta is 0.
03:12:39 INFO Calling node_active for node default/4/0 with current state: wait_primary, PostgreSQL is running, sync_state is &quot;async&quot;, WAL delta is 0. 03:12:39 INFO Calling node_active for node default/4/0 with current state: wait_primary, PostgreSQL is running, sync_state is &quot;async&quot;, WAL delta is 0.
03:12:45 INFO Calling node_active for node default/4/0 with current state: wait_primary, PostgreSQL is running, sync_state is &quot;async&quot;, WAL delta is 0. 03:12:45 INFO Calling node_active for node default/4/0 with current state: wait_primary, PostgreSQL is running, sync_state is &quot;async&quot;, WAL delta is 0.
@ -829,12 +702,8 @@ pg_basebackup: base backup completed
03:12:50 INFO Transition complete: current state is now &quot;primary&quot; 03:12:50 INFO Transition complete: current state is now &quot;primary&quot;
03:12:50 INFO Calling node_active for node default/4/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0. 03:12:50 INFO Calling node_active for node default/4/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0.
03:12:55 INFO Calling node_active for node default/4/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0. 03:12:55 INFO Calling node_active for node default/4/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0.
</code></pre> </code></pre><p>pg-slave 的狀態從原本的secondary 變成了 primary</p>
<p>pg-slave 的狀態從原本的secondary 變成了 primary</p>
<p>來檢查看看</p> <p>來檢查看看</p>
<pre><code>2019-09-20 03:19:04 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show state&quot; <pre><code>2019-09-20 03:19:04 [administrator@pg-slave ~]$ sudo runuser -l postgres -c &quot;pg_autoctl show state&quot;
Name | Port | Group | Node | Current State | Assigned State Name | Port | Group | Node | Current State | Assigned State
-----------+--------+-------+-------+-------------------+------------------ -----------+--------+-------+-------+-------------------+------------------
@ -842,14 +711,9 @@ pg-primary | 5432 | 0 | 1 | secondary | secondary
pg-slave | 5432 | 0 | 4 | primary | primary pg-slave | 5432 | 0 | 4 | primary | primary
2019-09-20 03:19:07 [administrator@pg-slave ~]$ 2019-09-20 03:19:07 [administrator@pg-slave ~]$
</code></pre> </code></pre><p>跟上面第一次執行的結果不同了,兩台角色互換了,這也是預期中的結果</p>
<p>跟上面第一次執行的結果不同了,兩台角色互換了,這也是預期中的結果</p>
<p>那在pg-master 離線期間的異動資料呢?在 pg-master上查得到嗎</p> <p>那在pg-master 離線期間的異動資料呢?在 pg-master上查得到嗎</p>
<p>先透過 URI存取DB 檢查看看</p> <p>先透過 URI存取DB 檢查看看</p>
<pre><code>2019-09-20 11:12:16 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot; <pre><code>2019-09-20 11:12:16 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;psql postgres://pg-slave:5432,pg-primary:5432/postgres?target_session_attrs=read-write&quot;
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -879,12 +743,8 @@ postgres=# select * from testtbl_1108;
(5 rows) (5 rows)
postgres=# postgres=#
</code></pre> </code></pre><p>GOOD看來資料也同步過來了</p>
<p>GOOD看來資料也同步過來了</p>
<p>再來看看單機的狀態</p> <p>再來看看單機的狀態</p>
<pre><code>2019-09-20 11:22:07 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;psql&quot; <pre><code>2019-09-20 11:22:07 [administrator@pg-primary ~]$ sudo runuser -l postgres -c &quot;psql&quot;
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -914,41 +774,22 @@ postgres=# select * from testtbl_1108;
(5 rows) (5 rows)
postgres=# postgres=#
</code></pre> </code></pre><p>很好,確認資料有正確的抄寫過來!</p>
<hr>
<p>很好,確認資料有正確的抄寫過來!</p>
<hr />
<p>以上測試可以發現 pg_auto_failover 這個postgresql的extension 還真的很好用!</p> <p>以上測試可以發現 pg_auto_failover 這個postgresql的extension 還真的很好用!</p>
<p>設定簡單、快速、方便設定完成後也不用傷腦筋反正有異常會自動幫你搞定master-slave之間的主從關係</p> <p>設定簡單、快速、方便設定完成後也不用傷腦筋反正有異常會自動幫你搞定master-slave之間的主從關係</p>
<p>資料也都會自動同步好,真的是非常推薦啊!</p> <p>資料也都會自動同步好,真的是非常推薦啊!</p>
<p>UPDATE</p> <p>UPDATE</p>
<h4 id="將-pg_auto_failover-用-systemd-管理">將 pg_auto_failover 用 systemd 管理</h4>
<h4 id="將-pg-auto-failover-用-systemd-管理">將 pg_auto_failover 用 systemd 管理</h4>
<p>每次都要手動執行 pg_autoctl run 太麻煩了應該用systemd 或者是 supervisor 來管理</p> <p>每次都要手動執行 pg_autoctl run 太麻煩了應該用systemd 或者是 supervisor 來管理</p>
<p>而pg_auto_failover 有指令可以做成 systemd 的service 檔案</p> <p>而pg_auto_failover 有指令可以做成 systemd 的service 檔案</p>
<p>既然人家都做好了,當然就直接用 systemd 來做</p> <p>既然人家都做好了,當然就直接用 systemd 來做</p>
<p>執行以下指令,產生 systemd configuration</p> <p>執行以下指令,產生 systemd configuration</p>
<pre><code>sudo runuser -l postgres -c &quot;pg_autoctl -q show systemd&quot; | sudo tee /etc/systemd/system/pgautofailover.service <pre><code>sudo runuser -l postgres -c &quot;pg_autoctl -q show systemd&quot; | sudo tee /etc/systemd/system/pgautofailover.service
</code></pre> </code></pre><p>在/etc/systemd/system底下會多出一個 pgautofailover.service檔案</p>
<p>在/etc/systemd/system底下會多出一個 pgautofailover.service檔案</p>
<p>內容就是 pg_auto_failover 所提供的 systemd config</p> <p>內容就是 pg_auto_failover 所提供的 systemd config</p>
<p>接下來就可以直接用 sudo service pgautofailover start 來啟動</p> <p>接下來就可以直接用 sudo service pgautofailover start 來啟動</p>
<p>沒有什麼問題,不過呢,這樣的作法,會在 /var/log/syslog 塞滿了 pg_auto_failover 的紀錄</p> <p>沒有什麼問題,不過呢,這樣的作法,會在 /var/log/syslog 塞滿了 pg_auto_failover 的紀錄</p>
<pre><code>Sep 20 14:59:34 pg-primary systemd[1]: Started pg_auto_failover. <pre><code>Sep 20 14:59:34 pg-primary systemd[1]: Started pg_auto_failover.
Sep 20 14:59:34 pg-primary pg_autoctl[7817]: 14:59:34 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot; Sep 20 14:59:34 pg-primary pg_autoctl[7817]: 14:59:34 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot;
Sep 20 14:59:34 pg-primary pg_autoctl[7817]: 14:59:34 INFO Found a stale pidfile at &quot;/tmp/pg_autoctl/var/lib/postgresql/11/main/pg_autoctl.pid&quot; Sep 20 14:59:34 pg-primary pg_autoctl[7817]: 14:59:34 INFO Found a stale pidfile at &quot;/tmp/pg_autoctl/var/lib/postgresql/11/main/pg_autoctl.pid&quot;
@ -1019,37 +860,20 @@ Sep 20 15:04:37 pg-primary pg_autoctl[7817]: 15:04:37 INFO Calling node_active
Sep 20 15:04:42 pg-primary pg_autoctl[7817]: 15:04:42 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. Sep 20 15:04:42 pg-primary pg_autoctl[7817]: 15:04:42 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
Sep 20 15:04:47 pg-primary pg_autoctl[7817]: 15:04:47 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. Sep 20 15:04:47 pg-primary pg_autoctl[7817]: 15:04:47 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
Sep 20 15:04:52 pg-primary pg_autoctl[7817]: 15:04:52 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. Sep 20 15:04:52 pg-primary pg_autoctl[7817]: 15:04:52 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
</code></pre> </code></pre><p>這樣下去不用多久syslog 一定爆,而且嚴重干擾到其他的系統訊息</p>
<p>這樣下去不用多久syslog 一定爆,而且嚴重干擾到其他的系統訊息</p>
<p>所以要修改一下 config 把log 寫到另外的檔案去</p> <p>所以要修改一下 config 把log 寫到另外的檔案去</p>
<p>在/etc/systemd/system/pgautofailover.service 加入底下兩行</p> <p>在/etc/systemd/system/pgautofailover.service 加入底下兩行</p>
<pre><code>StandardOutput=file:/var/log/pgautofailover.log <pre><code>StandardOutput=file:/var/log/pgautofailover.log
StandardError=file:/var/log/pgautofailover-error.log StandardError=file:/var/log/pgautofailover-error.log
</code></pre> </code></pre><p>然後 sudo systemctl daemon-reload 接著重起 sudo service pgautofailover restart</p>
<p>然後 sudo systemctl daemon-reload 接著重起 sudo service pgautofailover restart</p>
<p>就會把訊息都寫到 /var/log/pgautofailover.log , /var/log/pgautofailover-error.log</p> <p>就會把訊息都寫到 /var/log/pgautofailover.log , /var/log/pgautofailover-error.log</p>
<p>再用 logrotate 來管理就可以了</p> <p>再用 logrotate 來管理就可以了</p>
<p>這個動作需要在三台node都執行</p> <p>這個動作需要在三台node都執行</p>
<p>不過我在想應該是可以不要產生那麼多log ,只要紀錄 critical 就好了?來試試看加入 LogLevelMax=3 的效果</p> <p>不過我在想應該是可以不要產生那麼多log ,只要紀錄 critical 就好了?來試試看加入 LogLevelMax=3 的效果</p>
<p>在 /etc/systemd/system/pgautofailover.service 檔案中的service 區段 加入</p> <p>在 /etc/systemd/system/pgautofailover.service 檔案中的service 區段 加入</p>
<pre><code>LogLevelMax=3 <pre><code>LogLevelMax=3
</code></pre> </code></pre><p>loglevel 的等級定義看這邊</p>
<p>loglevel 的等級定義看這邊</p>
<p><a href="https://www.ctrl.blog/entry/systemd-log-levels.html">https://www.ctrl.blog/entry/systemd-log-levels.html</a></p> <p><a href="https://www.ctrl.blog/entry/systemd-log-levels.html">https://www.ctrl.blog/entry/systemd-log-levels.html</a></p>
<ul> <ul>
<li>emergency (0)</li> <li>emergency (0)</li>
<li>alert (1)</li> <li>alert (1)</li>
@ -1060,15 +884,10 @@ StandardError=file:/var/log/pgautofailover-error.log
<li>info (6)</li> <li>info (6)</li>
<li>debug (7)</li> <li>debug (7)</li>
</ul> </ul>
<p>完成後,一樣執行</p> <p>完成後,一樣執行</p>
<pre><code>sudo systemctl daemon-reload <pre><code>sudo systemctl daemon-reload
sudo service pgautofailover restart sudo service pgautofailover restart
</code></pre> </code></pre><p>看一下檔案內容,怎麼就沒有訊息了!</p>
<p>看一下檔案內容,怎麼就沒有訊息了!</p>
<pre><code>2019-09-20 15:23:15 [administrator@pg-primary ~]$ sudo tail -30 /var/log/pgautofailover.log <pre><code>2019-09-20 15:23:15 [administrator@pg-primary ~]$ sudo tail -30 /var/log/pgautofailover.log
15:14:22 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 15:14:22 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
15:14:27 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0. 15:14:27 INFO Calling node_active for node default/1/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 0.
@ -1101,10 +920,7 @@ sudo service pgautofailover restart
15:16:39 WARN Smart shutdown: received signal Terminated 15:16:39 WARN Smart shutdown: received signal Terminated
15:16:39 INFO pg_autoctl service stopping 15:16:39 INFO pg_autoctl service stopping
2019-09-20 15:23:29 [administrator@pg-primary ~]$ 2019-09-20 15:23:29 [administrator@pg-primary ~]$
</code></pre> </code></pre><p>可是我的服務活著啊!</p>
<p>可是我的服務活著啊!</p>
<pre><code>2019-09-20 15:23:29 [administrator@pg-primary ~]$ sudo service pgautofailover status <pre><code>2019-09-20 15:23:29 [administrator@pg-primary ~]$ sudo service pgautofailover status
● pgautofailover.service - pg_auto_failover ● pgautofailover.service - pg_auto_failover
Loaded: loaded (/etc/systemd/system/pgautofailover.service; disabled; vendor preset: enabled) Loaded: loaded (/etc/systemd/system/pgautofailover.service; disabled; vendor preset: enabled)
@ -1116,10 +932,7 @@ sudo service pgautofailover restart
Sep 20 15:16:39 pg-primary systemd[1]: Started pg_auto_failover. Sep 20 15:16:39 pg-primary systemd[1]: Started pg_auto_failover.
2019-09-20 15:23:56 [administrator@pg-primary ~]$ 2019-09-20 15:23:56 [administrator@pg-primary ~]$
</code></pre> </code></pre><p>拿另一台來做實驗,先不要加入 loglevelmax=3 看看log到底長怎樣</p>
<p>拿另一台來做實驗,先不要加入 loglevelmax=3 看看log到底長怎樣</p>
<pre><code>2019-09-20 07:25:34 [administrator@pg-slave ~]$ sudo service pgautofailover stop <pre><code>2019-09-20 07:25:34 [administrator@pg-slave ~]$ sudo service pgautofailover stop
2019-09-20 07:25:58 [administrator@pg-slave ~]$ sudo tail -10 /var/log/syslog 2019-09-20 07:25:58 [administrator@pg-slave ~]$ sudo tail -10 /var/log/syslog
Sep 20 07:25:32 pg-slave pg_autoctl[5840]: 07:25:32 INFO Calling node_active for node default/4/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0. Sep 20 07:25:32 pg-slave pg_autoctl[5840]: 07:25:32 INFO Calling node_active for node default/4/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0.
@ -1132,24 +945,14 @@ Sep 20 07:25:58 pg-slave systemd[1]: Stopping pg_auto_failover...
Sep 20 07:25:58 pg-slave pg_autoctl[5840]: 07:25:58 WARN Smart shutdown: received signal Terminated Sep 20 07:25:58 pg-slave pg_autoctl[5840]: 07:25:58 WARN Smart shutdown: received signal Terminated
Sep 20 07:25:58 pg-slave pg_autoctl[5840]: 07:25:58 INFO pg_autoctl service stopping Sep 20 07:25:58 pg-slave pg_autoctl[5840]: 07:25:58 INFO pg_autoctl service stopping
Sep 20 07:25:58 pg-slave systemd[1]: Stopped pg_auto_failover. Sep 20 07:25:58 pg-slave systemd[1]: Stopped pg_auto_failover.
</code></pre> </code></pre><p>好吧,看不出有什麼差別! 直接把primary 關機測試! 結果還是看不出來 0rz</p>
<p>好吧,看不出有什麼差別! 直接把primary 關機測試! 結果還是看不出來 0rz</p>
<p>放棄加入loglevel 的想法就用logrotate 來管理吧!</p> <p>放棄加入loglevel 的想法就用logrotate 來管理吧!</p>
<p>UPDATE</p> <p>UPDATE</p>
<p>用systemd 來管理的作法失敗了,重起之後, pgautofailover 不會自動啟動&hellip;</p> <p>用systemd 來管理的作法失敗了,重起之後, pgautofailover 不會自動啟動&hellip;</p>
<p>找了很久找不出原因,改用 supervisor來做好了</p> <p>找了很久找不出原因,改用 supervisor來做好了</p>
<hr>
<hr />
<h4 id="設定-supervisor">設定 supervisor</h4> <h4 id="設定-supervisor">設定 supervisor</h4>
<p><strong>安裝supervisor</strong></p> <p><strong>安裝supervisor</strong></p>
<pre><code>sudo apt install supervisor <pre><code>sudo apt install supervisor
sudo vim /etc/supervisor/conf.d/pgautofailover.conf sudo vim /etc/supervisor/conf.d/pgautofailover.conf
加入以下內容 加入以下內容
@ -1160,18 +963,12 @@ autostart=true
autorestart=true autorestart=true
redirect_stderr = true redirect_stderr = true
environment=PGDATA=/var/lib/postgresql/11/main,HOME=/var/lib/postgresql environment=PGDATA=/var/lib/postgresql/11/main,HOME=/var/lib/postgresql
</code></pre> </code></pre><p>重新啟動 supervisor &amp; 檢查狀態</p>
<p>重新啟動 supervisor &amp; 檢查狀態</p>
<pre><code>2019-09-20 17:26:22 [administrator@pg-primary postgresql]$ sudo service supervisor restart <pre><code>2019-09-20 17:26:22 [administrator@pg-primary postgresql]$ sudo service supervisor restart
2019-09-20 17:26:57 [administrator@pg-primary postgresql]$ sudo supervisorctl status 2019-09-20 17:26:57 [administrator@pg-primary postgresql]$ sudo supervisorctl status
pgautofailover RUNNING pid 14554, uptime 0:00:05 pgautofailover RUNNING pid 14554, uptime 0:00:05
2019-09-20 17:27:03 [administrator@pg-primary postgresql]$ 2019-09-20 17:27:03 [administrator@pg-primary postgresql]$
</code></pre> </code></pre><p>檢查 supervisor log</p>
<p>檢查 supervisor log</p>
<pre><code>2019-09-20 17:27:03 [administrator@pg-primary postgresql]$ sudo tail -30 /var/log/supervisor/pgautofailover-stdout---supervisor-5V8qET.log <pre><code>2019-09-20 17:27:03 [administrator@pg-primary postgresql]$ sudo tail -30 /var/log/supervisor/pgautofailover-stdout---supervisor-5V8qET.log
17:26:58 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot; 17:26:58 INFO Managing PostgreSQL installation at &quot;/var/lib/postgresql/11/main&quot;
17:26:58 INFO Found a stale pidfile at &quot;/tmp/pg_autoctl/var/lib/postgresql/11/main/pg_autoctl.pid&quot; 17:26:58 INFO Found a stale pidfile at &quot;/tmp/pg_autoctl/var/lib/postgresql/11/main/pg_autoctl.pid&quot;
@ -1184,14 +981,9 @@ pgautofailover RUNNING pid 14554, uptime 0:00:05
17:27:13 INFO Calling node_active for node default/1/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0. 17:27:13 INFO Calling node_active for node default/1/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0.
17:27:18 INFO Calling node_active for node default/1/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0. 17:27:18 INFO Calling node_active for node default/1/0 with current state: primary, PostgreSQL is running, sync_state is &quot;sync&quot;, WAL delta is 0.
2019-09-20 17:27:21 [administrator@pg-primary postgresql]$ 2019-09-20 17:27:21 [administrator@pg-primary postgresql]$
</code></pre> </code></pre><p>簡單多了 &hellip; 在剩下的monitor/slave 也一樣操作安裝、設定supervisor 就可以了</p>
<p>簡單多了 &hellip; 在剩下的monitor/slave 也一樣操作安裝、設定supervisor 就可以了</p>
<p>喔,順便把剛剛新增的 systemd config 給砍了..</p> <p>喔,順便把剛剛新增的 systemd config 給砍了..</p>
<p>不過不砍也沒差,反正開機也不會自己啟動 = =+</p> <p>不過不砍也沒差,反正開機也不會自己啟動 = =+</p>
<pre><code>2019-09-20 17:24:17 [administrator@pg-slave ~]$ sudo rm -rf /etc/systemd/system/pgautofailover.service <pre><code>2019-09-20 17:24:17 [administrator@pg-slave ~]$ sudo rm -rf /etc/systemd/system/pgautofailover.service
#安裝supervisor #安裝supervisor
2019-09-20 17:23:08 [administrator@pg-slave ~]$ sudo apt install supervisor 2019-09-20 17:23:08 [administrator@pg-slave ~]$ sudo apt install supervisor
@ -1245,16 +1037,10 @@ pgautofailover RUNNING pid 2232, uptime 0:00:04
17:31:04 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 320. 17:31:04 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 320.
17:31:09 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 320. 17:31:09 INFO Calling node_active for node default/4/0 with current state: secondary, PostgreSQL is running, sync_state is &quot;&quot;, WAL delta is 320.
2019-09-20 17:31:13 [administrator@pg-slave ~]$ 2019-09-20 17:31:13 [administrator@pg-slave ~]$
</code></pre> </code></pre><p>搞定,收工!準備寫 ansible playbook</p>
<hr>
<p>搞定,收工!準備寫 ansible playbook</p>
<hr />
<p>UPDATE</p> <p>UPDATE</p>
<p>新增用logrotate 來管理 pgautofailover logfile</p> <p>新增用logrotate 來管理 pgautofailover logfile</p>
<pre><code>sudo vim /etc/logrotate.d/pgautofailover <pre><code>sudo vim /etc/logrotate.d/pgautofailover
/var/log/supervisor/pgautofail*.log { /var/log/supervisor/pgautofail*.log {
@ -1267,12 +1053,8 @@ pgautofailover RUNNING pid 2232, uptime 0:00:04
notifempty notifempty
} }
</code></pre> </code></pre><p>UPDATE</p>
<p>UPDATE</p>
<p>當node 消失需要手動在monitor上執行以下指令來移除node 才能夠再次加入新的node</p> <p>當node 消失需要手動在monitor上執行以下指令來移除node 才能夠再次加入新的node</p>
<pre><code>2019-09-24 01:11:09 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;psql postgres://autoctl_node@monitor:5432/pg_auto_failover&quot; <pre><code>2019-09-24 01:11:09 [administrator@monitor ~]$ sudo runuser -l postgres -c &quot;psql postgres://autoctl_node@monitor:5432/pg_auto_failover&quot;
psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1)) psql (11.5 (Ubuntu 11.5-1.pgdg18.04+1))
Type &quot;help&quot; for help. Type &quot;help&quot; for help.
@ -1562,7 +1344,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -1574,7 +1356,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,24 +305,15 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這篇繼續講 pgbarman 透過 rsync/ssh 來備份 postgresql 資料庫的方式</p> <p>這篇繼續講 pgbarman 透過 rsync/ssh 來備份 postgresql 資料庫的方式</p>
<p>其實呢,透過 ssh 的方式來做備份,雖然最後有弄出來,但是我不知道到底做了什麼事才搞定</p> <p>其實呢,透過 ssh 的方式來做備份,雖然最後有弄出來,但是我不知道到底做了什麼事才搞定</p>
<p>也許要重新安裝一台來測試看看</p> <p>也許要重新安裝一台來測試看看</p>
<p>所以就簡單說一下邏輯、記得的指令、還有最後的config</p> <p>所以就簡單說一下邏輯、記得的指令、還有最後的config</p>
<h5 id="ssh">ssh</h5> <h5 id="ssh">ssh</h5>
<p>在db server 上,讓 barman server 可以用barman 帳號透過ssh key 登入 postgres 帳號 <p>在db server 上,讓 barman server 可以用barman 帳號透過ssh key 登入 postgres 帳號
然後在 barman server 上,讓 db server 可以用postgres帳號透過 ssh key 登入 barman 帳號</p> 然後在 barman server 上,讓 db server 可以用postgres帳號透過 ssh key 登入 barman 帳號</p>
<h5 id="barmand">barman.d</h5>
<h5 id="barman-d">barman.d</h5>
<p>在/etc/barman.d/ 底下新增一個hqs019-ssh.conf</p> <p>在/etc/barman.d/ 底下新增一個hqs019-ssh.conf</p>
<p>內容如下</p> <p>內容如下</p>
<pre><code>[hqs019-ssh] <pre><code>[hqs019-ssh]
description = &quot;hqs019 (via SSH)&quot; description = &quot;hqs019 (via SSH)&quot;
ssh_command = ssh postgres@hqs019 ssh_command = ssh postgres@hqs019
@ -335,32 +322,19 @@ backup_method = rsync
reuse_backup = link reuse_backup = link
parallel_jobs = 5 parallel_jobs = 5
archiver = on archiver = on
</code></pre> </code></pre><h5 id="postgresqlconf">postgresql.conf</h5>
<h5 id="postgresql-conf">postgresql.conf</h5>
<p>新增跟barman有關的設定如下</p> <p>新增跟barman有關的設定如下</p>
<pre><code>### for barman test <pre><code>### for barman test
wal_level = 'archive' wal_level = 'archive'
archive_mode = on archive_mode = on
archive_command = 'rsync -a %p barman@192.168.11.192:/var/lib/barman/hqs019-ssh/incoming/%f' archive_command = 'rsync -a %p barman@192.168.11.192:/var/lib/barman/hqs019-ssh/incoming/%f'
</code></pre> </code></pre><p>理論上這樣就可以了,但是實際上碰到很多問題</p>
<p>理論上這樣就可以了,但是實際上碰到很多問題</p>
<p>主要都是這個錯誤訊息</p> <p>主要都是這個錯誤訊息</p>
<pre><code>WAL archive: FAILED (please make sure WAL shipping is setup) <pre><code>WAL archive: FAILED (please make sure WAL shipping is setup)
</code></pre> </code></pre><p>碰到這狀況google 都會告訴你,在 postgresql.conf 裡面 archive_command 的路徑,要和 barman server 上的設定一致
<img src="https://i.imgur.com/3dMdytn.png" alt=""></p>
<p>碰到這狀況google 都會告訴你,在 postgresql.conf 裡面 archive_command 的路徑,要和 barman server 上的設定一致
<img src="https://i.imgur.com/3dMdytn.png" alt="" /></p>
<p>但是我的路徑就沒有問題,還是一直跳這個錯誤</p> <p>但是我的路徑就沒有問題,還是一直跳這個錯誤</p>
<p>接著我又在 barman server 這邊做了這些事情</p> <p>接著我又在 barman server 這邊做了這些事情</p>
<pre><code>barman check hqs019-ssh <pre><code>barman check hqs019-ssh
barman check hqs019-ssh barman check hqs019-ssh
barman check hqs019-ssh barman check hqs019-ssh
@ -384,18 +358,11 @@ barman backup hqs019-ssh
barman show-server hqs019 barman show-server hqs019
barman check hqs019 barman check hqs019
</code></pre> </code></pre><p>前面幾次 barman check 一直都不通過</p>
<p>前面幾次 barman check 一直都不通過</p>
<p>然後在 barman cron / barman switch-xlog hqs019-ssh (其實這個動作我做過好多次)</p> <p>然後在 barman cron / barman switch-xlog hqs019-ssh (其實這個動作我做過好多次)</p>
<p>想說確認一下psql 連接是不是正確(也的確正確無誤)</p> <p>想說確認一下psql 連接是不是正確(也的確正確無誤)</p>
<p>接著第一次 check 還是FAILED 喔,過沒多久我再跑一次 check 又正常了&hellip; WTF !!!</p> <p>接著第一次 check 還是FAILED 喔,過沒多久我再跑一次 check 又正常了&hellip; WTF !!!</p>
<p>只要check 正常,接著跑 backup 應該就會很順利</p> <p>只要check 正常,接著跑 backup 應該就會很順利</p>
<pre><code>barman@barman:~$ barman backup hqs019-ssh <pre><code>barman@barman:~$ barman backup hqs019-ssh
Starting backup using rsync-exclusive method for server hqs019-ssh in /var/lib/barman/hqs019-ssh/base/20190823T113229 Starting backup using rsync-exclusive method for server hqs019-ssh in /var/lib/barman/hqs019-ssh/base/20190823T113229
Backup start at LSN: 264/B7000028 (0000000100000264000000B7, 00000028) Backup start at LSN: 264/B7000028 (0000000100000264000000B7, 00000028)
@ -415,16 +382,10 @@ Processing xlog segments from file archival for hqs019-ssh
0000000100000264000000B7 0000000100000264000000B7
0000000100000264000000B7.00000028.backup 0000000100000264000000B7.00000028.backup
barman@barman:~$ barman@barman:~$
</code></pre> </code></pre><p>檢查一下狀態</p>
<p>檢查一下狀態</p>
<pre><code>barman@barman:~$ barman list-backup hqs019-ssh <pre><code>barman@barman:~$ barman list-backup hqs019-ssh
hqs019-ssh 20190823T113229 - Thu Aug 22 20:38:13 2019 - Size: 132.9 GiB - WAL Size: 0 B (tablespaces: tablespace_a:/var/lib/postgresql/10/main/tablespace_A, tablespace_b:/var/lib/postgresql/10/main/tablespace_B) hqs019-ssh 20190823T113229 - Thu Aug 22 20:38:13 2019 - Size: 132.9 GiB - WAL Size: 0 B (tablespaces: tablespace_a:/var/lib/postgresql/10/main/tablespace_A, tablespace_b:/var/lib/postgresql/10/main/tablespace_B)
</code></pre> </code></pre><p>然後為了驗證是不是跑增量備份,所以再執行一次 backup</p>
<p>然後為了驗證是不是跑增量備份,所以再執行一次 backup</p>
<pre><code>barman@barman:~$ barman backup hqs019-ssh <pre><code>barman@barman:~$ barman backup hqs019-ssh
Starting backup using rsync-exclusive method for server hqs019-ssh in /var/lib/barman/hqs019-ssh/base/20190823T132124 Starting backup using rsync-exclusive method for server hqs019-ssh in /var/lib/barman/hqs019-ssh/base/20190823T132124
Backup start at LSN: 264/B9000028 (0000000100000264000000B9, 00000028) Backup start at LSN: 264/B9000028 (0000000100000264000000B9, 00000028)
@ -439,22 +400,13 @@ Processing xlog segments from file archival for hqs019-ssh
0000000100000264000000B9 0000000100000264000000B9
0000000100000264000000B9.00000028.backup 0000000100000264000000B9.00000028.backup
barman@barman:~$ barman@barman:~$
</code></pre> </code></pre><p>可以發現第一次跑了一個多小時,第二次只跑了五秒鐘 (因為資料庫根本沒異動)</p>
<p>可以發現第一次跑了一個多小時,第二次只跑了五秒鐘 (因為資料庫根本沒異動)</p>
<p>到這邊雖然功能驗證沒有問題,可是不知道怎麼弄出來的,還是讓我很阿雜..</p> <p>到這邊雖然功能驗證沒有問題,可是不知道怎麼弄出來的,還是讓我很阿雜..</p>
<p>應該會再找時間來重作一台然後順便測試看看restore</p> <p>應該會再找時間來重作一台然後順便測試看看restore</p>
<p>update</p> <p>update</p>
<p>剛剛又做了一次測試config 都一樣</p> <p>剛剛又做了一次測試config 都一樣</p>
<p>果然要先做 barman cron/barman switch-xlog hqs019-ssh</p> <p>果然要先做 barman cron/barman switch-xlog hqs019-ssh</p>
<p>然後再做 barman check 就可以通過了</p> <p>然後再做 barman check 就可以通過了</p>
<p>在文件裡面很少提到這部份筆記一下用ansible 去跑的時候才不會忘記</p> <p>在文件裡面很少提到這部份筆記一下用ansible 去跑的時候才不會忘記</p>
</article> </article>
</div> </div>
@ -732,7 +684,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -744,7 +696,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在Ubuntu 18.04 下 透過 pgbarman streaming backup 備份 postgresql 10\/ backup postgresql 10 with pgbarman straming backup in ubuntu 18.04", "name" : "[筆記] 在Ubuntu 18.04 下 透過 pgbarman streaming backup 備份 postgresql 10\/ backup postgresql 10 with pgbarman straming backup in ubuntu 18.04",
"headline" : "[筆記] 在Ubuntu 18.04 下 透過 pgbarman streaming backup 備份 postgresql 10\/ backup postgresql 10 with pgbarman straming backup in ubuntu 18.04", "headline" : "[筆記] 在Ubuntu 18.04 下 透過 pgbarman streaming backup 備份 postgresql 10\/ backup postgresql 10 with pgbarman straming backup in ubuntu 18.04",
"description" : "\x3cp\x3e很久以前就有看到這個用來備份postgresql 的 pgbarman\x3c\/p\x3e\n\n\x3cp\x3e\x3ca href=\x22https:\/\/www.pgbarman.org\/\x22\x3ehttps:\/\/www.pgbarman.org\/\x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看\x3c\/p\x3e\n\n\x3cp\x3e不過呢雖然有弄起來但是還真不知道有些問題是怎麼解決的\x26hellip;\x3c\/p\x3e", "description" : "\x3cp\x3e很久以前就有看到這個用來備份postgresql 的 pgbarman\x3c\/p\x3e\n\x3cp\x3e\x3ca href=\x22https:\/\/www.pgbarman.org\/\x22\x3ehttps:\/\/www.pgbarman.org\/\x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看\x3c\/p\x3e\n\x3cp\x3e不過呢雖然有弄起來但是還真不知道有些問題是怎麼解決的\x26hellip;\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,121 +305,66 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>很久以前就有看到這個用來備份postgresql 的 pgbarman</p> <p>很久以前就有看到這個用來備份postgresql 的 pgbarman</p>
<p><a href="https://www.pgbarman.org/">https://www.pgbarman.org/</a></p> <p><a href="https://www.pgbarman.org/">https://www.pgbarman.org/</a></p>
<p>前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看</p> <p>前幾天老闆在slack 上面又提到,所以這次就花了點時間來玩玩看</p>
<p>不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&hellip;</p> <p>不過呢,雖然有弄起來,但是還真不知道有些問題是怎麼解決的&hellip;</p>
<p>pgbarman 的備份有分兩種</p> <p>pgbarman 的備份有分兩種</p>
<p>streaming &amp;&amp; rsync/SSH</p> <p>streaming &amp;&amp; rsync/SSH</p>
<p>原理就不說了,我一直沒搞懂 postgresql 的 streaming ..</p> <p>原理就不說了,我一直沒搞懂 postgresql 的 streaming ..</p>
<p>依照官方網站上的說法,比較推薦 streaming 備份的方式</p> <p>依照官方網站上的說法,比較推薦 streaming 備份的方式</p>
<p>原因是設定相對簡單WTF !</p> <p>原因是設定相對簡單WTF !</p>
<pre><code>On a general basis, starting from Barman 2.0, backup over streaming replication is the recommended setup for PostgreSQL 9.4 or higher <pre><code>On a general basis, starting from Barman 2.0, backup over streaming replication is the recommended setup for PostgreSQL 9.4 or higher
The reason why we recommend streaming backup is that, based on our experience, it is easier to setup than the traditional one The reason why we recommend streaming backup is that, based on our experience, it is easier to setup than the traditional one
</code></pre> </code></pre><p>事實上呢,設定的確是很簡單,可是有個致命的缺點</p>
<p>事實上呢,設定的確是很簡單,可是有個致命的缺點</p>
<pre><code>Because Barman transparently makes use of pg_basebackup, features such as incremental backup, parallel backup, deduplication, and network compression are currently not available. In this case, bandwidth limitation has some restrictions - compared to the traditional method via rsync. <pre><code>Because Barman transparently makes use of pg_basebackup, features such as incremental backup, parallel backup, deduplication, and network compression are currently not available. In this case, bandwidth limitation has some restrictions - compared to the traditional method via rsync.
</code></pre> </code></pre><p>如果要做差異/增量備份, streaming backup 不能做</p>
<p>如果要做差異/增量備份, streaming backup 不能做</p>
<p>所以每次備份都是完整備份也因此barman server 需要準備很大的硬碟空間</p> <p>所以每次備份都是完整備份也因此barman server 需要準備很大的硬碟空間</p>
<p>以我測試的資料庫來說一次備份目前是133G ,如果一天四次,保留七天</p> <p>以我測試的資料庫來說一次備份目前是133G ,如果一天四次,保留七天</p>
<p>就需要 133 x 4 x 7 = 3724G</p> <p>就需要 133 x 4 x 7 = 3724G</p>
<p>咦,這樣看起來,其實也還好啦 XDD</p> <p>咦,這樣看起來,其實也還好啦 XDD</p>
<hr>
<hr />
<p>現在開始設定的部份</p> <p>現在開始設定的部份</p>
<h4 id="設定-postgresql-server">設定 postgresql server</h4> <h4 id="設定-postgresql-server">設定 postgresql server</h4>
<p>IP: 192.168.11.19 <p>IP: 192.168.11.19
hostname: hqs019</p> hostname: hqs019</p>
<h5 id="在postgresql-建立相關帳號">在postgresql 建立相關帳號</h5> <h5 id="在postgresql-建立相關帳號">在postgresql 建立相關帳號</h5>
<p>streaming backup 需要先在postgresql Server 上建立一個具有 superuser 權限的帳號</p> <p>streaming backup 需要先在postgresql Server 上建立一個具有 superuser 權限的帳號</p>
<p>以及一個用來做replication 的資料庫帳號</p> <p>以及一個用來做replication 的資料庫帳號</p>
<p>這裡就簡單帶過</p> <p>這裡就簡單帶過</p>
<pre><code>sudo su - postgres <pre><code>sudo su - postgres
psql psql
create user barman with login superuser login password 'barmanpassword'; create user barman with login superuser login password 'barmanpassword';
CREATE ROLE stream_barman WITH REPLICATION PASSWORD 'password' LOGIN; CREATE ROLE stream_barman WITH REPLICATION PASSWORD 'password' LOGIN;
</code></pre> </code></pre><h5 id="鄉改-pg_hbaconf">鄉改 pg_hba.conf</h5>
<h5 id="鄉改-pg-hba-conf">鄉改 pg_hba.conf</h5>
<p>然後修改 pg_hba.conf加入底下兩行</p> <p>然後修改 pg_hba.conf加入底下兩行</p>
<pre><code># for barman test <pre><code># for barman test
host database_name barman 192.168.11.192/32 md5 host database_name barman 192.168.11.192/32 md5
host replication stream_barman 192.168.11.192/32 md5 host replication stream_barman 192.168.11.192/32 md5
</code></pre> </code></pre><p>當然,如果不考慮安全性問題, md5 直接改成用 trust ,可以省去一些麻煩。</p>
<h5 id="修改-postgresqlconf">修改 postgresql.conf</h5>
<p>當然,如果不考慮安全性問題, md5 直接改成用 trust ,可以省去一些麻煩。</p>
<h5 id="修改-postgresql-conf">修改 postgresql.conf</h5>
<p>接著修改postgresql.conf</p> <p>接著修改postgresql.conf</p>
<pre><code>### for barman test <pre><code>### for barman test
max_wal_senders = 5 max_wal_senders = 5
max_replication_slots = 3 max_replication_slots = 3
wal_level = 'archive' wal_level = 'archive'
archive_mode = on archive_mode = on
</code></pre> </code></pre><p>重起 postgresql service</p>
<p>重起 postgresql service</p>
<h4 id="設定barman-server">設定barman server</h4> <h4 id="設定barman-server">設定barman server</h4>
<p>IP: 192.168.11.192 <p>IP: 192.168.11.192
hostname: barman</p> hostname: barman</p>
<h5 id="安裝-barman">安裝 barman</h5> <h5 id="安裝-barman">安裝 barman</h5>
<p>barman 在18.04 中已經被放到標準repository 中</p> <p>barman 在18.04 中已經被放到標準repository 中</p>
<p>所以只要直接</p> <p>所以只要直接</p>
<pre><code>sudo apt install barman <pre><code>sudo apt install barman
</code></pre> </code></pre><p>就可以了</p>
<h5 id="設定-barmanconf">設定 barman.conf</h5>
<p>就可以了</p>
<h5 id="設定-barman-conf">設定 barman.conf</h5>
<p>安裝完成後,在/etc/barman.d/ 底下會有兩個範例檔案</p> <p>安裝完成後,在/etc/barman.d/ 底下會有兩個範例檔案</p>
<pre><code>streaming-server.conf-template <pre><code>streaming-server.conf-template
ssh-server.conf-template ssh-server.conf-template
</code></pre> </code></pre><p>複製 streaming-server 檔案</p>
<p>複製 streaming-server 檔案</p>
<pre><code>sudo cp /etc/barman.d/streaming-server.conf-template /etc/barman.d/hqs019.conf <pre><code>sudo cp /etc/barman.d/streaming-server.conf-template /etc/barman.d/hqs019.conf
</code></pre> </code></pre><p>內容如下</p>
<p>內容如下</p>
<pre><code>[hqs019] <pre><code>[hqs019]
description = &quot;hqs019 &quot; description = &quot;hqs019 &quot;
conninfo = host=192.168.11.19 user=barman dbname=database_name password=barmanpassword conninfo = host=192.168.11.19 user=barman dbname=database_name password=barmanpassword
@ -432,10 +373,7 @@ backup_method = postgres
retention_policy_mode = auto retention_policy_mode = auto
streaming_archiver = on streaming_archiver = on
slot_name = barman slot_name = barman
</code></pre> </code></pre><p>接著修改 /etc/barman.conf</p>
<p>接著修改 /etc/barman.conf</p>
<pre><code>[barman] <pre><code>[barman]
barman_user = barman barman_user = barman
configuration_files_directory = /etc/barman.d configuration_files_directory = /etc/barman.d
@ -447,16 +385,10 @@ immediate_checkpoint = true
basebackup_retry_times = 3 basebackup_retry_times = 3
basebackup_retry_sleep = 30 basebackup_retry_sleep = 30
last_backup_maximum_age = 1 DAYS last_backup_maximum_age = 1 DAYS
</code></pre> </code></pre><p>基本上這樣就設定完成了</p>
<p>基本上這樣就設定完成了</p>
<h5 id="檢查設定">檢查設定</h5> <h5 id="檢查設定">檢查設定</h5>
<p>barman 有一些指令可以用來檢查目前的設定</p> <p>barman 有一些指令可以用來檢查目前的設定</p>
<p>barman show-server hqs019 可以看到所有的設定,這裡的 hqs019 跟 barman.d/hqs019.conf 裡面用&rdquo;[ ]&rdquo; 包起來的名稱要一致</p> <p>barman show-server hqs019 可以看到所有的設定,這裡的 hqs019 跟 barman.d/hqs019.conf 裡面用&rdquo;[ ]&rdquo; 包起來的名稱要一致</p>
<pre><code>barman@barman:~$ barman show-server hqs019 <pre><code>barman@barman:~$ barman show-server hqs019
Server hqs019: Server hqs019:
active: True active: True
@ -544,10 +476,7 @@ Server hqs019:
wal_retention_policy: main wal_retention_policy: main
wals_directory: /var/lib/barman/hqs019/wals wals_directory: /var/lib/barman/hqs019/wals
xlogpos: 264/BA000F08 xlogpos: 264/BA000F08
</code></pre> </code></pre><p>然後用 barman check hqs019 來檢查config 有沒有問題</p>
<p>然後用 barman check hqs019 來檢查config 有沒有問題</p>
<pre><code>barman@barman:~$ barman check hqs019 <pre><code>barman@barman:~$ barman check hqs019
Server hqs019: Server hqs019:
PostgreSQL: OK PostgreSQL: OK
@ -569,14 +498,9 @@ Server hqs019:
receive-wal running: OK receive-wal running: OK
archiver errors: OK archiver errors: OK
barman@barman:~$ barman@barman:~$
</code></pre> </code></pre><p>那個backup maximum age FAILED 不用管他,因為都還沒跑過備份,這邊錯誤是正常的</p>
<p>那個backup maximum age FAILED 不用管他,因為都還沒跑過備份,這邊錯誤是正常的</p>
<p>其他都OK 的話,就可以開始備份了</p> <p>其他都OK 的話,就可以開始備份了</p>
<p>barman backup hqs019</p> <p>barman backup hqs019</p>
<pre><code>barman@ubuntu:~$ barman backup hqs019 <pre><code>barman@ubuntu:~$ barman backup hqs019
Starting backup using postgres method for server hqs019 in /var/lib/barman/hqs019/base/20190823T082258 Starting backup using postgres method for server hqs019 in /var/lib/barman/hqs019/base/20190823T082258
Backup start at LSN: 264/A10001A8 (0000000100000264000000A1, 000001A8) Backup start at LSN: 264/A10001A8 (0000000100000264000000A1, 000001A8)
@ -595,16 +519,10 @@ Processing xlog segments from streaming for hqs019
0000000100000264000000A2 0000000100000264000000A2
barman@ubuntu:~$ barman@ubuntu:~$
</code></pre> </code></pre><p>跑完可以用 barman list-backup hqs019 檢查</p>
<p>跑完可以用 barman list-backup hqs019 檢查</p>
<pre><code>barman@ubuntu:~$ barman list-backup hqs019 <pre><code>barman@ubuntu:~$ barman list-backup hqs019
hqs019 20190823T082258 - Thu Aug 22 17:29:26 2019 - Size: 133.0 GiB - WAL Size: 0 B (tablespaces: tablespace_a:/var/lib/postgresql/10/main/tablespace_A, tablespace_b:/var/lib/postgresql/10/main/tablespace_B) hqs019 20190823T082258 - Thu Aug 22 17:29:26 2019 - Size: 133.0 GiB - WAL Size: 0 B (tablespaces: tablespace_a:/var/lib/postgresql/10/main/tablespace_A, tablespace_b:/var/lib/postgresql/10/main/tablespace_B)
</code></pre> </code></pre><p>要刪除的話,要加入 backupID</p>
<p>要刪除的話,要加入 backupID</p>
<pre><code>barman@ubuntu:~$ barman delete hqs019 20190822T171355 <pre><code>barman@ubuntu:~$ barman delete hqs019 20190822T171355
Deleting backup 20190822T171355 for server hqs019 Deleting backup 20190822T171355 for server hqs019
Delete associated WAL segments: Delete associated WAL segments:
@ -613,12 +531,8 @@ Delete associated WAL segments:
0000000100000264000000A1 0000000100000264000000A1
Deleted backup 20190822T171355 (start time: Fri Aug 23 09:36:43 2019, elapsed time: 3 seconds) Deleted backup 20190822T171355 (start time: Fri Aug 23 09:36:43 2019, elapsed time: 3 seconds)
</code></pre> </code></pre><p>restore 的部份,暫時沒有測試,我想應該是要找時間測試看看怎麼還原才對</p>
<p>restore 的部份,暫時沒有測試,我想應該是要找時間測試看看怎麼還原才對</p>
<p>不過呢前面有提到用streaming backup ,每一次備份都是完整備份,非常的佔用空間、時間、頻寬</p> <p>不過呢前面有提到用streaming backup ,每一次備份都是完整備份,非常的佔用空間、時間、頻寬</p>
<p>所以還是要來試試看用rsync/SSH 備份的機制</p> <p>所以還是要來試試看用rsync/SSH 備份的機制</p>
</article> </article>
</div> </div>
@ -896,7 +810,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -908,7 +822,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 用zfs的snapshot 快照功能來做 postgresql 的備份還原 \/ Postgresql Backup Restore Using Zfs Snapshot", "name" : "[筆記] 用zfs的snapshot 快照功能來做 postgresql 的備份還原 \/ Postgresql Backup Restore Using Zfs Snapshot",
"headline" : "[筆記] 用zfs的snapshot 快照功能來做 postgresql 的備份還原 \/ Postgresql Backup Restore Using Zfs Snapshot", "headline" : "[筆記] 用zfs的snapshot 快照功能來做 postgresql 的備份還原 \/ Postgresql Backup Restore Using Zfs Snapshot",
"description" : "\x3cp\x3e前面測試了用pgbarman \/ pgbackrest 來備份 postgresql\x3c\/p\x3e\n\n\x3cp\x3e這次改從system file level 來下手\x3c\/p\x3e\n\n\x3cp\x3e採用zfs 的快照來備份、還原postgresql 資料庫\x3c\/p\x3e", "description" : "\x3cp\x3e前面測試了用pgbarman \/ pgbackrest 來備份 postgresql\x3c\/p\x3e\n\x3cp\x3e這次改從system file level 來下手\x3c\/p\x3e\n\x3cp\x3e採用zfs 的快照來備份、還原postgresql 資料庫\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,17 +305,11 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>前面測試了用pgbarman / pgbackrest 來備份 postgresql</p> <p>前面測試了用pgbarman / pgbackrest 來備份 postgresql</p>
<p>這次改從system file level 來下手</p> <p>這次改從system file level 來下手</p>
<p>採用zfs 的快照來備份、還原postgresql 資料庫</p> <p>採用zfs 的快照來備份、還原postgresql 資料庫</p>
<h3 id="建立測試資料庫tablesnapshot">建立測試資料庫、TABLE、snapshot</h3>
<h3 id="建立測試資料庫-table-snapshot">建立測試資料庫、TABLE、snapshot</h3>
<h4 id="資料庫現況">資料庫現況</h4> <h4 id="資料庫現況">資料庫現況</h4>
<p>只有系統預設的DB沒有其他多的東西</p> <p>只有系統預設的DB沒有其他多的東西</p>
<pre><code>postgres@hqdc034:~$ psql -c '\l' <pre><code>postgres@hqdc034:~$ psql -c '\l'
List of databases List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges Name | Owner | Encoding | Collate | Ctype | Access privileges
@ -333,10 +323,7 @@ if (!doNotTrack) {
postgres@hqdc034:~$ du -sh /zp/database/10/main/ postgres@hqdc034:~$ du -sh /zp/database/10/main/
232M /zp/database/10/main/ 232M /zp/database/10/main/
</code></pre> </code></pre><h4 id="建立第一次的快照">建立第一次的快照</h4>
<h4 id="建立第一次的快照">建立第一次的快照</h4>
<pre><code>2019-09-06 09:03:46 [changch@hqdc034 ~]$ sudo zfs list -t snapshot <pre><code>2019-09-06 09:03:46 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
no datasets available no datasets available
2019-09-06 09:03:53 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@init_db_no_demo 2019-09-06 09:03:53 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@init_db_no_demo
@ -344,19 +331,13 @@ no datasets available
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
zp/database@init_db_no_demo 0 - 231M - zp/database@init_db_no_demo 0 - 231M -
2019-09-06 09:04:15 [changch@hqdc034 ~]$ 2019-09-06 09:04:15 [changch@hqdc034 ~]$
</code></pre> </code></pre><h4 id="建立倒回測試資料庫-demo">建立、倒回測試資料庫 demo</h4>
<h4 id="建立-倒回測試資料庫-demo">建立、倒回測試資料庫 demo</h4>
<pre><code>postgres@hqdc034:~$ createdb demo <pre><code>postgres@hqdc034:~$ createdb demo
postgres@hqdc034:~$ psql demo &lt; /home/changch/Downloads/demo.sql postgres@hqdc034:~$ psql demo &lt; /home/changch/Downloads/demo.sql
SET SET
SET SET
略... 略...
</code></pre> </code></pre><p>再檢查一次資料庫的狀況,看到 demo DB出現了資料庫目錄也變大了</p>
<p>再檢查一次資料庫的狀況,看到 demo DB出現了資料庫目錄也變大了</p>
<pre><code>postgres@hqdc034:~$ psql -c '\l' <pre><code>postgres@hqdc034:~$ psql -c '\l'
List of databases List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges Name | Owner | Encoding | Collate | Ctype | Access privileges
@ -372,40 +353,26 @@ SET
postgres@hqdc034:~$ du -sh /zp/database/10/main/ postgres@hqdc034:~$ du -sh /zp/database/10/main/
2.1G /zp/database/10/main/ 2.1G /zp/database/10/main/
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><h4 id="建立第二次快照">建立第二次快照</h4>
<h4 id="建立第二次快照">建立第二次快照</h4>
<p>這次的快照,將包含剛剛倒回的 demo DB但是不包含等下才要建立的測試 table</p> <p>這次的快照,將包含剛剛倒回的 demo DB但是不包含等下才要建立的測試 table</p>
<pre><code>2019-09-06 09:16:01 [changch@hqdc034 ~]$ sudo zfs list -t snapshot <pre><code>2019-09-06 09:16:01 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
zp/database@init_db_no_demo 250K - 231M - zp/database@init_db_no_demo 250K - 231M -
zp/database@demo_db_just_restore 0 - 2.08G - zp/database@demo_db_just_restore 0 - 2.08G -
2019-09-06 09:16:04 [changch@hqdc034 ~]$ 2019-09-06 09:16:04 [changch@hqdc034 ~]$
</code></pre> </code></pre><h4 id="建立測試-table">建立測試 table</h4>
<h4 id="建立測試-table">建立測試 table</h4>
<pre><code>postgres@hqdc034:~$ psql -c 'create table test ( a int, b varchar(50) );' <pre><code>postgres@hqdc034:~$ psql -c 'create table test ( a int, b varchar(50) );'
CREATE TABLE CREATE TABLE
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><h4 id="建立第三次快照">建立第三次快照</h4>
<h4 id="建立第三次快照">建立第三次快照</h4>
<p>這次快照,只有建立 test table ,但是裡面沒有資料</p> <p>這次快照,只有建立 test table ,但是裡面沒有資料</p>
<pre><code>2019-09-06 09:18:34 [changch@hqdc034 ~]$ sudo zfs list -t snapshot <pre><code>2019-09-06 09:18:34 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
zp/database@init_db_no_demo 250K - 231M - zp/database@init_db_no_demo 250K - 231M -
zp/database@demo_db_just_restore 138K - 2.08G - zp/database@demo_db_just_restore 138K - 2.08G -
zp/database@demo_db_create_test_table_but_no_data 0 - 2.08G - zp/database@demo_db_create_test_table_but_no_data 0 - 2.08G -
2019-09-06 09:18:36 [changch@hqdc034 ~]$ 2019-09-06 09:18:36 [changch@hqdc034 ~]$
</code></pre> </code></pre><h4 id="在test-table-插入100萬筆資料">在test table 插入100萬筆資料</h4>
<h4 id="在test-table-插入100萬筆資料">在test table 插入100萬筆資料</h4>
<pre><code>postgres@hqdc034:~$ psql -c 'with aa as ( select * from generate_series (1,1000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;' <pre><code>postgres@hqdc034:~$ psql -c 'with aa as ( select * from generate_series (1,1000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;'
INSERT 0 1000000 INSERT 0 1000000
postgres@hqdc034:~$ psql -c 'select count(*) from test;' postgres@hqdc034:~$ psql -c 'select count(*) from test;'
@ -415,12 +382,8 @@ postgres@hqdc034:~$ psql -c 'select count(*) from test;'
(1 row) (1 row)
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><h4 id="建立第四次快照">建立第四次快照</h4>
<h4 id="建立第四次快照">建立第四次快照</h4>
<p>test table 內有 1000000 筆資料</p> <p>test table 內有 1000000 筆資料</p>
<pre><code>2019-09-06 09:18:36 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_1M_rows <pre><code>2019-09-06 09:18:36 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_1M_rows
2019-09-06 09:21:08 [changch@hqdc034 ~]$ sudo zfs list -t snapshot 2019-09-06 09:21:08 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
@ -429,10 +392,7 @@ zp/database@demo_db_just_restore 138K - 2.08G -
zp/database@demo_db_create_test_table_but_no_data 116K - 2.08G - zp/database@demo_db_create_test_table_but_no_data 116K - 2.08G -
zp/database@demo_db_test_table_with_1M_rows 0 - 2.15G - zp/database@demo_db_test_table_with_1M_rows 0 - 2.15G -
2019-09-06 09:21:09 [changch@hqdc034 ~]$ 2019-09-06 09:21:09 [changch@hqdc034 ~]$
</code></pre> </code></pre><h4 id="再次插入-100萬筆資料">再次插入 100萬筆資料</h4>
<h4 id="再次插入-100萬筆資料">再次插入 100萬筆資料</h4>
<pre><code>postgres@hqdc034:~$ time psql -c 'with aa as ( select * from generate_series (1,1000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;' <pre><code>postgres@hqdc034:~$ time psql -c 'with aa as ( select * from generate_series (1,1000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;'
INSERT 0 1000000 INSERT 0 1000000
@ -446,12 +406,8 @@ postgres@hqdc034:~$ psql -c 'select count(*) from test;'
(1 row) (1 row)
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><h4 id="建立第五次快照">建立第五次快照</h4>
<h4 id="建立第五次快照">建立第五次快照</h4>
<p>現在 test table 有 200萬筆資料了</p> <p>現在 test table 有 200萬筆資料了</p>
<pre><code>2019-09-06 09:21:09 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_2M_rows <pre><code>2019-09-06 09:21:09 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_2M_rows
2019-09-06 09:22:29 [changch@hqdc034 ~]$ sudo zfs list -t snapshot 2019-09-06 09:22:29 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
@ -461,10 +417,7 @@ zp/database@demo_db_create_test_table_but_no_data 116K - 2.08G -
zp/database@demo_db_test_table_with_1M_rows 218K - 2.15G - zp/database@demo_db_test_table_with_1M_rows 218K - 2.15G -
zp/database@demo_db_test_table_with_2M_rows 0 - 2.23G - zp/database@demo_db_test_table_with_2M_rows 0 - 2.23G -
2019-09-06 09:22:30 [changch@hqdc034 ~]$ 2019-09-06 09:22:30 [changch@hqdc034 ~]$
</code></pre> </code></pre><h4 id="玩大點直接湊滿1000萬筆資料好了">玩大點直接湊滿1000萬筆資料好了</h4>
<h4 id="玩大點-直接湊滿1000萬筆資料好了">玩大點直接湊滿1000萬筆資料好了</h4>
<pre><code>postgres@hqdc034:~$ time psql -c 'with aa as ( select * from generate_series (1,8000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;' <pre><code>postgres@hqdc034:~$ time psql -c 'with aa as ( select * from generate_series (1,8000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;'
INSERT 0 8000000 INSERT 0 8000000
@ -477,12 +430,8 @@ postgres@hqdc034:~$ psql -c 'select count(*) from test;'
10000000 10000000
(1 row) (1 row)
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><h4 id="建立第六次快照">建立第六次快照</h4>
<h4 id="建立第六次快照">建立第六次快照</h4>
<p>10M rows in test table</p> <p>10M rows in test table</p>
<pre><code>2019-09-06 09:22:30 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_10M_rows <pre><code>2019-09-06 09:22:30 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_10M_rows
2019-09-06 09:25:18 [changch@hqdc034 ~]$ sudo zfs list -t snapshot 2019-09-06 09:25:18 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
@ -493,21 +442,13 @@ zp/database@demo_db_test_table_with_1M_rows 218K - 2.15G -
zp/database@demo_db_test_table_with_2M_rows 530K - 2.23G - zp/database@demo_db_test_table_with_2M_rows 530K - 2.23G -
zp/database@demo_db_test_table_with_10M_rows 163K - 2.97G - zp/database@demo_db_test_table_with_10M_rows 163K - 2.97G -
2019-09-06 09:25:21 [changch@hqdc034 ~]$ 2019-09-06 09:25:21 [changch@hqdc034 ~]$
</code></pre> </code></pre><p>到1000萬筆資料為止現在資料庫大小是這樣</p>
<p>到1000萬筆資料為止現在資料庫大小是這樣</p>
<pre><code>postgres@hqdc034:~$ du -sh /zp/database/10/main/ <pre><code>postgres@hqdc034:~$ du -sh /zp/database/10/main/
3.0G /zp/database/10/main/ 3.0G /zp/database/10/main/
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><hr>
<hr />
<h3 id="還原測試">還原測試</h3> <h3 id="還原測試">還原測試</h3>
<p>最後一次做快照的時候demo DB 裡面有一千萬筆資料現在來砍掉500萬筆</p> <p>最後一次做快照的時候demo DB 裡面有一千萬筆資料現在來砍掉500萬筆</p>
<pre><code>postgres@hqdc034:~$ time psql -c 'delete from test where a &gt; 5000000;' <pre><code>postgres@hqdc034:~$ time psql -c 'delete from test where a &gt; 5000000;'
DELETE 3000000 DELETE 3000000
@ -526,27 +467,18 @@ real 0m0.268s
user 0m0.024s user 0m0.024s
sys 0m0.004s sys 0m0.004s
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><p>怪怪的為什麼只有砍掉300萬筆
<p>怪怪的為什麼只有砍掉300萬筆
這邊先不管等等正好來驗證restore的狀況</p> 這邊先不管等等正好來驗證restore的狀況</p>
<p>假設剛剛這個刪除是錯誤的動作我要回到1000萬資料的狀態就可以用zfs rollback 來達成</p> <p>假設剛剛這個刪除是錯誤的動作我要回到1000萬資料的狀態就可以用zfs rollback 來達成</p>
<h4 id="第一次還原">第一次還原</h4> <h4 id="第一次還原">第一次還原</h4>
<p>目標是還原到包含1000萬筆資料的狀態(現在是700萬筆)</p> <p>目標是還原到包含1000萬筆資料的狀態(現在是700萬筆)</p>
<pre><code>2019-09-06 09:25:21 [changch@hqdc034 ~]$ sudo service postgresql stop <pre><code>2019-09-06 09:25:21 [changch@hqdc034 ~]$ sudo service postgresql stop
* Stopping PostgreSQL 10 database server [ OK ] * Stopping PostgreSQL 10 database server [ OK ]
2019-09-06 10:14:12 [changch@hqdc034 ~]$ sudo zfs rollback -r zp/database@demo_db_test_table_with_10M_rows 2019-09-06 10:14:12 [changch@hqdc034 ~]$ sudo zfs rollback -r zp/database@demo_db_test_table_with_10M_rows
2019-09-06 10:14:28 [changch@hqdc034 ~]$ sudo service postgresql start 2019-09-06 10:14:28 [changch@hqdc034 ~]$ sudo service postgresql start
* Starting PostgreSQL 10 database server [ OK ] * Starting PostgreSQL 10 database server [ OK ]
2019-09-06 10:14:57 [changch@hqdc034 ~]$ 2019-09-06 10:14:57 [changch@hqdc034 ~]$
</code></pre> </code></pre><p>檢查一下</p>
<p>檢查一下</p>
<pre><code>postgres@hqdc034:~$ time psql -c 'select count(*) from test;' <pre><code>postgres@hqdc034:~$ time psql -c 'select count(*) from test;'
count count
---------- ----------
@ -558,13 +490,9 @@ real 0m5.019s
user 0m0.040s user 0m0.040s
sys 0m0.008s sys 0m0.008s
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><p>沒錯又回到1000萬筆資料的狀態了</p>
<p>沒錯又回到1000萬筆資料的狀態了</p>
<p>要注意的是如果回到更之前的狀態在該狀態之後的快照將會被清除除非你先做clone <p>要注意的是如果回到更之前的狀態在該狀態之後的快照將會被清除除非你先做clone
比如我現在要回到 200萬筆的狀態那1000萬筆資料的快照就會被刪除</p> 比如我現在要回到 200萬筆的狀態那1000萬筆資料的快照就會被刪除</p>
<pre><code>2019-09-06 10:17:32 [changch@hqdc034 ~]$ sudo service postgresql stop <pre><code>2019-09-06 10:17:32 [changch@hqdc034 ~]$ sudo service postgresql stop
* Stopping PostgreSQL 10 database server [ OK ] * Stopping PostgreSQL 10 database server [ OK ]
2019-09-06 10:18:50 [changch@hqdc034 ~]$ sudo zfs rollback -r zp/database@demo_db_test_table_with_2M_rows 2019-09-06 10:18:50 [changch@hqdc034 ~]$ sudo zfs rollback -r zp/database@demo_db_test_table_with_2M_rows
@ -589,11 +517,8 @@ real 0m0.175s
user 0m0.024s user 0m0.024s
sys 0m0.008s sys 0m0.008s
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><p>我剛剛應該先clone的&hellip;.
<p>我剛剛應該先clone的&hellip;.
沒關係我們再做一次新增800萬筆資料湊齊1000萬筆然後快照</p> 沒關係我們再做一次新增800萬筆資料湊齊1000萬筆然後快照</p>
<pre><code>postgres@hqdc034:~$ time psql -c 'with aa as ( select * from generate_series (1,8000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;' <pre><code>postgres@hqdc034:~$ time psql -c 'with aa as ( select * from generate_series (1,8000000) a ) insert into test select aa.a, md5(aa.a::varchar) from aa;'
INSERT 0 8000000 INSERT 0 8000000
@ -610,10 +535,7 @@ real 0m5.259s
user 0m0.024s user 0m0.024s
sys 0m0.008s sys 0m0.008s
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><p>做快照</p>
<p>做快照</p>
<pre><code>2019-09-06 10:19:17 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_10M_rows <pre><code>2019-09-06 10:19:17 [changch@hqdc034 ~]$ sudo zfs snapshot zp/database@demo_db_test_table_with_10M_rows
2019-09-06 10:22:59 [changch@hqdc034 ~]$ sudo zfs list -t snapshot 2019-09-06 10:22:59 [changch@hqdc034 ~]$ sudo zfs list -t snapshot
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
@ -624,17 +546,11 @@ zp/database@demo_db_test_table_with_1M_rows 218K - 2.15G -
zp/database@demo_db_test_table_with_2M_rows 56.4M - 2.23G - zp/database@demo_db_test_table_with_2M_rows 56.4M - 2.23G -
zp/database@demo_db_test_table_with_10M_rows 0 - 1.81G - zp/database@demo_db_test_table_with_10M_rows 0 - 1.81G -
2019-09-06 10:23:02 [changch@hqdc034 ~]$ 2019-09-06 10:23:02 [changch@hqdc034 ~]$
</code></pre> </code></pre><p>接著來測試看看 clone snapshot這是基本的說明</p>
<p>接著來測試看看 clone snapshot這是基本的說明</p>
<pre><code>Clones can only be created from a snapshot and a snapshot can not <pre><code>Clones can only be created from a snapshot and a snapshot can not
be deleted until you delete the clone that is based on this snapshot. be deleted until you delete the clone that is based on this snapshot.
To create a clone, use the zfs clone command. To create a clone, use the zfs clone command.
</code></pre> </code></pre><p>clone 會做出一份跟clone來源一模一樣的資料在快照模式下資料是唯讀的clone出來後就可以做異動。但是不能刪除clone來源的快照會提示錯誤。</p>
<p>clone 會做出一份跟clone來源一模一樣的資料在快照模式下資料是唯讀的clone出來後就可以做異動。但是不能刪除clone來源的快照會提示錯誤。</p>
<pre><code>2019-09-06 10:28:31 [changch@hqdc034 ~]$ sudo zfs clone zp/database@demo_db_test_table_with_10M_rows zp/database/clone_with_10M_rows <pre><code>2019-09-06 10:28:31 [changch@hqdc034 ~]$ sudo zfs clone zp/database@demo_db_test_table_with_10M_rows zp/database/clone_with_10M_rows
2019-09-06 10:29:21 [changch@hqdc034 ~]$ sudo zfs list 2019-09-06 10:29:21 [changch@hqdc034 ~]$ sudo zfs list
NAME USED AVAIL REFER MOUNTPOINT NAME USED AVAIL REFER MOUNTPOINT
@ -642,30 +558,20 @@ zp 3.08G 231G 22K /zp
zp/database 3.08G 231G 1.88G /zp/database zp/database 3.08G 231G 1.88G /zp/database
zp/database/clone_with_10M_rows 0 231G 1.81G /zp/database/clone_with_10M_rows zp/database/clone_with_10M_rows 0 231G 1.81G /zp/database/clone_with_10M_rows
2019-09-06 10:29:26 [changch@hqdc034 ~]$ 2019-09-06 10:29:26 [changch@hqdc034 ~]$
</code></pre> </code></pre><p>可以看到做了clone之後多了一個 zfs dataset
<p>可以看到做了clone之後多了一個 zfs dataset
試試看把資料庫路徑直接改到這個新做的dataset 看看能不能啟動資料庫 試試看把資料庫路徑直接改到這個新做的dataset 看看能不能啟動資料庫
修改 /etc/postgresql/10/main/postgresql.conf然後重起postgresql</p> 修改 /etc/postgresql/10/main/postgresql.conf然後重起postgresql</p>
<pre><code>#data_directory = '/var/lib/postgresql/10/main' # use data in another directory <pre><code>#data_directory = '/var/lib/postgresql/10/main' # use data in another directory
#data_directory = '/zp/database/10/main' #data_directory = '/zp/database/10/main'
data_directory = '/zp/database/clone_with_10M_rows/10/main' data_directory = '/zp/database/clone_with_10M_rows/10/main'
</code></pre> </code></pre><p><strong>啟動有比較久一點</strong> 而且好像沒成功啟動</p>
<p><strong>啟動有比較久一點</strong> 而且好像沒成功啟動</p>
<pre><code>2019-09-06 10:32:27 [changch@hqdc034 ~]$ sudo service postgresql restart <pre><code>2019-09-06 10:32:27 [changch@hqdc034 ~]$ sudo service postgresql restart
* Restarting PostgreSQL 10 database server [ OK ] * Restarting PostgreSQL 10 database server [ OK ]
2019-09-06 10:33:37 [changch@hqdc034 ~]$ 2019-09-06 10:33:37 [changch@hqdc034 ~]$
2019-09-06 10:33:37 [changch@hqdc034 ~]$ sudo netstat -antlp |grep 5432 2019-09-06 10:33:37 [changch@hqdc034 ~]$ sudo netstat -antlp |grep 5432
</code></pre> </code></pre><p>而且在 syslog &amp; postgresql log 中看不到什麼異常,怪了!
<p>而且在 syslog &amp; postgresql log 中看不到什麼異常,怪了!
而且再啟動一次就好了?</p> 而且再啟動一次就好了?</p>
<p>再來測試一次看看</p> <p>再來測試一次看看</p>
<pre><code>2019-09-06 10:37:22 [changch@hqdc034 ~]$ sudo service postgresql stop <pre><code>2019-09-06 10:37:22 [changch@hqdc034 ~]$ sudo service postgresql stop
* Stopping PostgreSQL 10 database server [ OK ] * Stopping PostgreSQL 10 database server [ OK ]
2019-09-06 10:38:03 [changch@hqdc034 ~]$ sudo zfs list 2019-09-06 10:38:03 [changch@hqdc034 ~]$ sudo zfs list
@ -694,11 +600,8 @@ zp/database/clone_with_10M_rows 0 231G 1.81G /zp/database/clone_with_10
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN -
tcp6 0 0 :::5432 :::* LISTEN - tcp6 0 0 :::5432 :::* LISTEN -
2019-09-06 10:39:13 [changch@hqdc034 ~]$ 2019-09-06 10:39:13 [changch@hqdc034 ~]$
</code></pre> </code></pre><p>這次就沒問題看來是我第一次下指令的時候不該用sudo netstat -antlp 去檢查?
<p>這次就沒問題看來是我第一次下指令的時候不該用sudo netstat -antlp 去檢查?
anyway 回到psql 來看看內容</p> anyway 回到psql 來看看內容</p>
<pre><code>postgres@hqdc034:~$ time psql -c 'select count(*) from test;' <pre><code>postgres@hqdc034:~$ time psql -c 'select count(*) from test;'
count count
---------- ----------
@ -710,12 +613,8 @@ real 0m4.716s
user 0m0.028s user 0m0.028s
sys 0m0.004s sys 0m0.004s
postgres@hqdc034:~$ postgres@hqdc034:~$
</code></pre> </code></pre><p>Good clone 出來的果然是1000萬筆資料時的狀態</p>
<hr>
<p>Good clone 出來的果然是1000萬筆資料時的狀態</p>
<hr />
<p>這次測試就先到此為止後面再來測試zfs的 replication and send/recv</p> <p>這次測試就先到此為止後面再來測試zfs的 replication and send/recv</p>
</article> </article>
</div> </div>
@ -997,7 +896,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -1009,7 +908,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] postgresql 效能測試 \/ postgresql benchmakr using pgbench", "name" : "[筆記] postgresql 效能測試 \/ postgresql benchmakr using pgbench",
"headline" : "[筆記] postgresql 效能測試 \/ postgresql benchmakr using pgbench", "headline" : "[筆記] postgresql 效能測試 \/ postgresql benchmakr using pgbench",
"description" : "\x3cp\x3e昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench\x3c\/p\x3e\n\n\x3cp\x3e分數大概如何想要跟他的筆電做個比較\x3c\/p\x3e\n\n\x3cp\x3e之前有跑過幾次這次就順便測試一下不同的硬體配置、以及不同的軟體版本\x3c\/p\x3e\n\n\x3cp\x3e對於pgbench 跑分會有多大的影響\x3c\/p\x3e", "description" : "\x3cp\x3e昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench\x3c\/p\x3e\n\x3cp\x3e分數大概如何想要跟他的筆電做個比較\x3c\/p\x3e\n\x3cp\x3e之前有跑過幾次這次就順便測試一下不同的硬體配置、以及不同的軟體版本\x3c\/p\x3e\n\x3cp\x3e對於pgbench 跑分會有多大的影響\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,50 +305,32 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench</p> <p>昨天老闆在slack 上面問說現在的幾台 DB Server 有沒有跑過 pgbench</p>
<p>分數大概如何,想要跟他的筆電做個比較</p> <p>分數大概如何,想要跟他的筆電做個比較</p>
<p>之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本</p> <p>之前有跑過幾次,這次就順便測試一下不同的硬體配置、以及不同的軟體版本</p>
<p>對於pgbench 跑分會有多大的影響</p> <p>對於pgbench 跑分會有多大的影響</p>
<p>OS: ubuntu 18.04.3 x64 <p>OS: ubuntu 18.04.3 x64
postgresql 版本: 10 / 11 / 12 postgresql 版本: 10 / 11 / 12
硬碟分成兩種,一個是透過 NFS 10G 網路存取的storage一個是本機三顆硬碟組成的 zfs raidz</p> 硬碟分成兩種,一個是透過 NFS 10G 網路存取的storage一個是本機三顆硬碟組成的 zfs raidz</p>
<p>大概步驟就是安裝postgresql &amp; tools 然後initialize pgbench table 最後就跑pgbench 測試</p> <p>大概步驟就是安裝postgresql &amp; tools 然後initialize pgbench table 最後就跑pgbench 測試</p>
<h3 id="install-tools-for-postgresql">install tools for postgresql</h3> <h3 id="install-tools-for-postgresql">install tools for postgresql</h3>
<p>sudo apt install postgresql-contrib</p> <p>sudo apt install postgresql-contrib</p>
<h3 id="su-to-postgres-and-initialize-pgbench-database">su to postgres and initialize pgbench database</h3> <h3 id="su-to-postgres-and-initialize-pgbench-database">su to postgres and initialize pgbench database</h3>
<p>sudo su - postgres <p>sudo su - postgres
createdb pgbench createdb pgbench
pgbench -i -U postgres -s 10 pgbench</p> pgbench -i -U postgres -s 10 pgbench</p>
<h3 id="running-the-test">running the test</h3> <h3 id="running-the-test">running the test</h3>
<p>pgbench -t 100 -c 100 -S -U postgres pgbench</p> <p>pgbench -t 100 -c 100 -S -U postgres pgbench</p>
<p>得出來的結果如下</p> <p>得出來的結果如下</p>
<p>| | 2 cores / 16G | 4 cores / 16G | <p>| | 2 cores / 16G | 4 cores / 16G |
| &mdash; | &mdash; | &mdash; | PGTUNE | NO PGTUNE | PGTUNE | NO PGTUNE | | &mdash; | &mdash; | &mdash; | PGTUNE | NO PGTUNE | PGTUNE | NO PGTUNE |
| PSQL Version | 10G Storage | Local Raidz | 10G Storage | Local Raidz | 10G Storage | Local Raidz | 10G Storage | Local Raidz | | PSQL Version | 10G Storage | Local Raidz | 10G Storage | Local Raidz | 10G Storage | Local Raidz | 10G Storage | Local Raidz |
| 10 | 9014.144993 | 9395.847239 | 9508.819462 | 10192.27069 | 13280.99918 | 13819.12767 | 15257.69002 | 15397.53475 | | 10 | 9014.144993 | 9395.847239 | 9508.819462 | 10192.27069 | 13280.99918 | 13819.12767 | 15257.69002 | 15397.53475 |
| 11 | 9418.477212 | 9333.790266 | 9070.990565 | 9071.182748 | 15455.80444 | 16079.6638 | 15710.24677 | 14274.59939 | | 11 | 9418.477212 | 9333.790266 | 9070.990565 | 9071.182748 | 15455.80444 | 16079.6638 | 15710.24677 | 14274.59939 |
| 12 | 8630.21746 | 8872.475173 | 9072.034237 | 9217.547833 | 16116.7502 | 12380.71452 | 17409.10363 | 14520.79393 |</p> | 12 | 8630.21746 | 8872.475173 | 9072.034237 | 9217.547833 | 16116.7502 | 12380.71452 | 17409.10363 | 14520.79393 |</p>
<p>Update: 喵的 Markdown 的表格不支援 colspan ,只好改用圖片方式呈現</p> <p>Update: 喵的 Markdown 的表格不支援 colspan ,只好改用圖片方式呈現</p>
<p><img src="https://i.imgur.com/vQFfj6Y.png" alt="&lsquo;postgresql pgbench banchmark reults&rsquo;"></p>
<p><img src="https://i.imgur.com/vQFfj6Y.png" alt="'postgresql pgbench banchmark reults'" /></p>
<p>另外補上一個 2 cores / 2G RAM 的結果</p> <p>另外補上一個 2 cores / 2G RAM 的結果</p>
<h3 id="postgresql-10--2g-ram--hdd-on-10g-storage">postgresql 10 , 2G RAM , HDD on 10G Storage</h3>
<h3 id="postgresql-10-2g-ram-hdd-on-10g-storage">postgresql 10 , 2G RAM , HDD on 10G Storage</h3>
<pre><code>postgres@ubuntu:~$ pgbench -t 100 -c 100 -S -U postgres pgbench <pre><code>postgres@ubuntu:~$ pgbench -t 100 -c 100 -S -U postgres pgbench
starting vacuum...end. starting vacuum...end.
transaction type: &lt;builtin: select only&gt; transaction type: &lt;builtin: select only&gt;
@ -365,45 +343,40 @@ number of transactions actually processed: 10000/10000
latency average = 11.583 ms latency average = 11.583 ms
tps = 8633.209610 (including connections establishing) tps = 8633.209610 (including connections establishing)
tps = 8651.036900 (excluding connections establishing) tps = 8651.036900 (excluding connections establishing)
</code></pre> </code></pre><p>有幾個地方值得注意</p>
<p>有幾個地方值得注意</p>
<ul> <ul>
<li><p>記憶體 2G-&gt;16G 效能的增加並沒有很明顯 tps 從 8633 略為上升到 9014</p> <li>
<p>記憶體 2G-&gt;16G 效能的增加並沒有很明顯 tps 從 8633 略為上升到 9014</p>
<ul> <ul>
<li>這個倒是讓我滿意外的一直以來都認為postgresql 非常的需要記憶體,但是實際跑測試卻不是這樣</li> <li>這個倒是讓我滿意外的一直以來都認為postgresql 非常的需要記憶體,但是實際跑測試卻不是這樣</li>
</ul></li> </ul>
</li>
<li><p>pgtune 的影響不大,甚至可以說是會降低效能</p> <li>
<p>pgtune 的影響不大,甚至可以說是會降低效能</p>
<ul> <ul>
<li>pgtune 是一個網頁服務可以協助做出「理論上」建議使用的postgresql config <li>pgtune 是一個網頁服務可以協助做出「理論上」建議使用的postgresql config
<a href="https://pgtune.leopard.in.ua/#/">https://pgtune.leopard.in.ua/#/</a></li> <a href="https://pgtune.leopard.in.ua/#/">https://pgtune.leopard.in.ua/#/</a></li>
<li>從結果可以看出使用pgtune 做出來的config 跟完全使用預設值的config 相比pgtune的效能大部分都略低於預設值</li> <li>從結果可以看出使用pgtune 做出來的config 跟完全使用預設值的config 相比pgtune的效能大部分都略低於預設值</li>
<li>這也讓我很好奇或許要花更多時間去研究postgresql 的config但是我不是 DBA 啊!</li> <li>這也讓我很好奇或許要花更多時間去研究postgresql 的config但是我不是 DBA 啊!</li>
</ul></li> </ul>
</li>
<li><p>CPU 核心數很明顯地影響pgbench</p> <li>
<p>CPU 核心數很明顯地影響pgbench</p>
<ul> <ul>
<li>從表格中可以看到當CPU Cores 增加pgbench的效能也明顯增加</li> <li>從表格中可以看到當CPU Cores 增加pgbench的效能也明顯增加</li>
<li>而我甚至還沒有指定用多核心去執行測試,如果要用多核心去測試,要把測試指令改成</li>
<li><p>而我甚至還沒有指定用多核心去執行測試,如果要用多核心去測試,要把測試指令改成</p> </ul>
<pre><code>pgbench -j 4 -t 100 -c 100 -S -U postgres pgbench <pre><code>pgbench -j 4 -t 100 -c 100 -S -U postgres pgbench
</code></pre></li> </code></pre></li>
</ul></li> <li>
<p>10G Storage和 3顆 2T SATA硬碟組成的 raidz 效能差不多</p>
<li><p>10G Storage和 3顆 2T SATA硬碟組成的 raidz 效能差不多</p>
<ul> <ul>
<li>如果本機改用 SSD RAID 甚至是 NVME SSD RAID ,效能應該會提高更多</li> <li>如果本機改用 SSD RAID 甚至是 NVME SSD RAID ,效能應該會提高更多</li>
<li>10G的部份最多大概就是略低於 1000MB 左右</li> <li>10G的部份最多大概就是略低於 1000MB 左右</li>
<li>如果換成 SSD 效能應該是還會提昇但是有限畢竟10Gb的頻寬限制就在那邊(理論值1250MB左右)</li> <li>如果換成 SSD 效能應該是還會提昇但是有限畢竟10Gb的頻寬限制就在那邊(理論值1250MB左右)</li>
</ul></li> </ul>
</li>
</ul> </ul>
</article> </article>
</div> </div>
@ -681,7 +654,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -693,7 +666,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 測試 proxmox 存取由 synology HA cluster 分享的NFS 目錄 \/ Proxmox With Synology High Availability", "name" : "[筆記] 測試 proxmox 存取由 synology HA cluster 分享的NFS 目錄 \/ Proxmox With Synology High Availability",
"headline" : "[筆記] 測試 proxmox 存取由 synology HA cluster 分享的NFS 目錄 \/ Proxmox With Synology High Availability", "headline" : "[筆記] 測試 proxmox 存取由 synology HA cluster 分享的NFS 目錄 \/ Proxmox With Synology High Availability",
"description" : "\x3cp\x3e前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415\x2b\x3c\/p\x3e\n\n\x3cp\x3e詳情請看 \x3ca href=\x22https:\/\/h.cowbay.org\/post\/first-try-synology-ha\/\x22\x3ehttps:\/\/h.cowbay.org\/post\/first-try-synology-ha\/\x3c\/a\x3e\x3c\/p\x3e\n\n\x3cp\x3e今天趁尾牙前夕手邊沒啥要緊事\x3c\/p\x3e\n\n\x3cp\x3e就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境\x3c\/p\x3e", "description" : "\x3cp\x3e前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415\x2b\x3c\/p\x3e\n\x3cp\x3e詳情請看 \x3ca href=\x22https:\/\/h.cowbay.org\/post\/first-try-synology-ha\/\x22\x3ehttps:\/\/h.cowbay.org\/post\/first-try-synology-ha\/\x3c\/a\x3e\x3c\/p\x3e\n\x3cp\x3e今天趁尾牙前夕手邊沒啥要緊事\x3c\/p\x3e\n\x3cp\x3e就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,66 +305,35 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+</p> <p>前幾天修復了因為intel cpu bug 導致無法使用的 synology DS415+</p>
<p>詳情請看 <a href="https://h.cowbay.org/post/first-try-synology-ha/">https://h.cowbay.org/post/first-try-synology-ha/</a></p> <p>詳情請看 <a href="https://h.cowbay.org/post/first-try-synology-ha/">https://h.cowbay.org/post/first-try-synology-ha/</a></p>
<p>今天趁尾牙前夕,手邊沒啥要緊事</p> <p>今天趁尾牙前夕,手邊沒啥要緊事</p>
<p>就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境</p> <p>就來玩玩看promox 加上 synology high availability 再加上 NFS share 的環境</p>
<p>先上架構圖</p> <p>先上架構圖</p>
<p><img src="https://i.imgur.com/k7IDZ4Y.png" alt=""></p>
<p><img src="https://i.imgur.com/k7IDZ4Y.png" alt="" /></p>
<p>架構很簡單NAS設定一組NFS share proxmox mount 進來然後開一台VM在NFS 上</p> <p>架構很簡單NAS設定一組NFS share proxmox mount 進來然後開一台VM在NFS 上</p>
<p>主要來談談proxmox 在碰到synology high availability 切換狀態、遇上腦裂(brain split)時候的狀況</p> <p>主要來談談proxmox 在碰到synology high availability 切換狀態、遇上腦裂(brain split)時候的狀況</p>
<p>觸發 brain split (說真的,我覺得腦裂很難聽 &hellip;)的情況,在上面連結那篇文章裡面有提到,就不多說了</p> <p>觸發 brain split (說真的,我覺得腦裂很難聽 &hellip;)的情況,在上面連結那篇文章裡面有提到,就不多說了</p>
<p>來講講後續的狀況</p> <p>來講講後續的狀況</p>
<p>發生 brain split 時,可以預期管理者會登入管理界面去修復</p> <p>發生 brain split 時,可以預期管理者會登入管理界面去修復</p>
<p>關於修復brain split 可以看看群暉的這篇文章</p> <p>關於修復brain split 可以看看群暉的這篇文章</p>
<p><a href="https://www.synology.com/zh-tw/knowledgebase/DSM/help/HighAvailability/split_brain">https://www.synology.com/zh-tw/knowledgebase/DSM/help/HighAvailability/split_brain</a></p> <p><a href="https://www.synology.com/zh-tw/knowledgebase/DSM/help/HighAvailability/split_brain">https://www.synology.com/zh-tw/knowledgebase/DSM/help/HighAvailability/split_brain</a></p>
<p>而我選擇的是 [將兩台伺服器一同保留於叢集中]</p> <p>而我選擇的是 [將兩台伺服器一同保留於叢集中]</p>
<p>在進行修復的過程中會發現VM這邊會變成 read only</p> <p>在進行修復的過程中會發現VM這邊會變成 read only</p>
<p>聽起來很合理,畢竟在修復時,所有服務幾乎都是停擺</p> <p>聽起來很合理,畢竟在修復時,所有服務幾乎都是停擺</p>
<p>但是呢等到修復完成後VM還是read only ,這就有點奇怪了</p> <p>但是呢等到修復完成後VM還是read only ,這就有點奇怪了</p>
<p>有跟群暉客服反應過這個狀況</p> <p>有跟群暉客服反應過這個狀況</p>
<p>所以在修復完成之後在proxmox server 這邊直接對NFS 存取做測試</p> <p>所以在修復完成之後在proxmox server 這邊直接對NFS 存取做測試</p>
<p>去下載一個template 是 OK 的在console 裡面直接在NFS touch file 也是可以的</p> <p>去下載一個template 是 OK 的在console 裡面直接在NFS touch file 也是可以的</p>
<p>所以Synology high availability 是有正常發揮作用</p> <p>所以Synology high availability 是有正常發揮作用</p>
<p>而promox 這邊在synology恢復之後也可以正常存取NFS ,所以也沒有問題</p> <p>而promox 這邊在synology恢復之後也可以正常存取NFS ,所以也沒有問題</p>
<p><del>那問題就是在VM裡面了當發生了某些狀況讓系統進入read only 就必須透過reboot 才能解決</del></p> <p><del>那問題就是在VM裡面了當發生了某些狀況讓系統進入read only 就必須透過reboot 才能解決</del></p>
<p><del>或者是看看這個指令用fsck去檢查filesystem 看看有沒有幫助</del></p> <p><del>或者是看看這個指令用fsck去檢查filesystem 看看有沒有幫助</del></p>
<pre><code>sudo fsck -Af -M <pre><code>sudo fsck -Af -M
</code></pre> </code></pre><p>UPDATE:</p>
<p>UPDATE:</p>
<p>在proxmox 論壇上提出了這個問題,有回覆說要用 NFS Version 4.1</p> <p>在proxmox 論壇上提出了這個問題,有回覆說要用 NFS Version 4.1</p>
<p>經過測試在掛載NFS share folder 時,如果有指定 NFS Version 4.1</p> <p>經過測試在掛載NFS share folder 時,如果有指定 NFS Version 4.1</p>
<p>那在HA Cluster 恢復之後VM也就跟著恢復正常</p> <p>那在HA Cluster 恢復之後VM也就跟著恢復正常</p>
<p>不必再重開機了!</p> <p>不必再重開機了!</p>
<p>所以這問題算是解決了!</p> <p>所以這問題算是解決了!</p>
</article> </article>
</div> </div>
@ -648,7 +613,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -660,7 +625,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[推薦] ulauncher ubuntu 18.04 底下,好用的 app launcher \/ Recommended Ulauncher in Ubuntu 1804", "name" : "[推薦] ulauncher ubuntu 18.04 底下,好用的 app launcher \/ Recommended Ulauncher in Ubuntu 1804",
"headline" : "[推薦] ulauncher ubuntu 18.04 底下,好用的 app launcher \/ Recommended Ulauncher in Ubuntu 1804", "headline" : "[推薦] ulauncher ubuntu 18.04 底下,好用的 app launcher \/ Recommended Ulauncher in Ubuntu 1804",
"description" : "\x3cp\x3e這兩天在找關於在 ubuntu 中做搜尋的軟體\x3c\/p\x3e\n\n\x3cp\x3e意外找到一個非常好用的工具 ulauncher\x3c\/p\x3e", "description" : "\x3cp\x3e這兩天在找關於在 ubuntu 中做搜尋的軟體\x3c\/p\x3e\n\x3cp\x3e意外找到一個非常好用的工具 ulauncher\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,97 +305,52 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這兩天在找關於在 ubuntu 中做搜尋的軟體</p> <p>這兩天在找關於在 ubuntu 中做搜尋的軟體</p>
<p>意外找到一個非常好用的工具 ulauncher</p> <p>意外找到一個非常好用的工具 ulauncher</p>
<p>官方網站: <a href="https://ulauncher.io/">https://ulauncher.io/</a></p> <p>官方網站: <a href="https://ulauncher.io/">https://ulauncher.io/</a></p>
<p>簡單的說這東西可以讓你不需要ubuntu 的 dash 輸入關鍵字尋找 app</p> <p>簡單的說這東西可以讓你不需要ubuntu 的 dash 輸入關鍵字尋找 app</p>
<p>舉例來說</p> <p>舉例來說</p>
<p>如果我想要啟動 libreoffice Calc</p> <p>如果我想要啟動 libreoffice Calc</p>
<p>通常我會按一下鍵盤上的 windows/super 鍵然後輸入calc</p> <p>通常我會按一下鍵盤上的 windows/super 鍵然後輸入calc</p>
<p>像是圖片中這樣</p> <p>像是圖片中這樣</p>
<p><img src="https://i.imgur.com/hlmtneN.png" alt=""></p>
<p><img src="https://i.imgur.com/hlmtneN.png" alt="" /></p>
<p>OK ,那這樣有什麼問題呢?</p> <p>OK ,那這樣有什麼問題呢?</p>
<p>最大的問題應該是fcitx 的 bug ,在這邊不能輸入中文搜尋,如果只是要找應用程式還好</p> <p>最大的問題應該是fcitx 的 bug ,在這邊不能輸入中文搜尋,如果只是要找應用程式還好</p>
<p>但是要找檔案就會有問題了</p> <p>但是要找檔案就會有問題了</p>
<p>那用 ulauncher 有什麼不同呢?</p> <p>那用 ulauncher 有什麼不同呢?</p>
<p>首先,因為 ulauncher 內建的呼叫快捷鍵是 ctrl+space</p> <p>首先,因為 ulauncher 內建的呼叫快捷鍵是 ctrl+space</p>
<p>跟 fcitx (對,又是他) 切換中文的快捷鍵衝突</p> <p>跟 fcitx (對,又是他) 切換中文的快捷鍵衝突</p>
<p>所以要改掉,可以改成自己喜歡的任意組合,像我就改成 ctl+ esc</p> <p>所以要改掉,可以改成自己喜歡的任意組合,像我就改成 ctl+ esc</p>
<p>叫出ulauncher 的視窗後,直接輸入 calc 也有一樣的效果</p> <p>叫出ulauncher 的視窗後,直接輸入 calc 也有一樣的效果</p>
<p><img src="https://i.imgur.com/RTYBGeT.png" alt=""></p>
<p><img src="https://i.imgur.com/RTYBGeT.png" alt="" /></p>
<p>當然啦,如果只是這樣,那也沒什麼了不起的</p> <p>當然啦,如果只是這樣,那也沒什麼了不起的</p>
<p>ulauncher 最大的好處是他支援各式各樣的extension</p> <p>ulauncher 最大的好處是他支援各式各樣的extension</p>
<p>可以在網站上瀏覽這些擴充套件,最好選擇 V2.0 的,他新舊版本不相容</p> <p>可以在網站上瀏覽這些擴充套件,最好選擇 V2.0 的,他新舊版本不相容</p>
<p><a href="https://ext.ulauncher.io/">https://ext.ulauncher.io/</a></p> <p><a href="https://ext.ulauncher.io/">https://ext.ulauncher.io/</a></p>
<p>拿幾個我裝的 extension 來示範</p> <p>拿幾個我裝的 extension 來示範</p>
<p>比如我常寫 ansible playbook</p> <p>比如我常寫 ansible playbook</p>
<p>可是又很常忘記某些模組、語法怎麼用</p> <p>可是又很常忘記某些模組、語法怎麼用</p>
<p>所以我都要開著瀏覽器去 ansible 官網看資料</p> <p>所以我都要開著瀏覽器去 ansible 官網看資料</p>
<p>現在我可以用 DevDocs 這個extension 直接查語法</p> <p>現在我可以用 DevDocs 這個extension 直接查語法</p>
<p>像是這樣</p> <p>像是這樣</p>
<p><img src="https://i.imgur.com/O3q9rqG.png" alt=""></p>
<p><img src="https://i.imgur.com/O3q9rqG.png" alt="" /></p>
<p>按下enter 或者 alt+1 就可以開啟相關語法的網頁</p> <p>按下enter 或者 alt+1 就可以開啟相關語法的網頁</p>
<p>又或者是常常要去查 IP也有相關的extension 可以用</p> <p>又或者是常常要去查 IP也有相關的extension 可以用</p>
<p><img src="https://i.imgur.com/9Xmv3pn.png" alt=""></p>
<p><img src="https://i.imgur.com/9Xmv3pn.png" alt="" /></p>
<p>再來就是 unicode 字元查詢</p> <p>再來就是 unicode 字元查詢</p>
<p>可以很簡單的複製 unicode 裡面的特殊字元</p> <p>可以很簡單的複製 unicode 裡面的特殊字元</p>
<p>像是狗貓牛豬</p> <p>像是狗貓牛豬</p>
<p>🐕🐈🐄🐖</p> <p>🐕🐈🐄🐖</p>
<p>房子車子孩子</p> <p>房子車子孩子</p>
<p>🏠🚚👦</p> <p>🏠🚚👦</p>
<p>是不是很方便!(當然前提是平常有用到這些符號啦)</p> <p>是不是很方便!(當然前提是平常有用到這些符號啦)</p>
<p>最後是我覺得最好用的搜尋檔案</p> <p>最後是我覺得最好用的搜尋檔案</p>
<p>之前在搜尋檔案的時候,都是先去點開檔案總管,然後用裡面的搜尋 <p>之前在搜尋檔案的時候,都是先去點開檔案總管,然後用裡面的搜尋
(好啦,我承認其實我很少用這個功能,檔案沒有多到記不得放在哪裡) (好啦,我承認其實我很少用這個功能,檔案沒有多到記不得放在哪裡)
(可是 👩 說很需要&hellip;.)</p> (可是 👩 說很需要&hellip;.)</p>
<p>不過這個功能要搭配 tracker 這個套件,我不確定 ubuntu 預設有沒有裝</p> <p>不過這個功能要搭配 tracker 這個套件,我不確定 ubuntu 預設有沒有裝</p>
<p>裝好之後,做一些簡單的設定,就可以直接搜尋檔案名稱了</p> <p>裝好之後,做一些簡單的設定,就可以直接搜尋檔案名稱了</p>
<p><img src="https://i.imgur.com/I5ZOY2m.png" alt=""></p>
<p><img src="https://i.imgur.com/I5ZOY2m.png" alt="" /></p>
<p>根本殺手級套件啊!</p> <p>根本殺手級套件啊!</p>
<p>強烈推薦大家一定要裝起來玩玩看!</p> <p>強烈推薦大家一定要裝起來玩玩看!</p>
</article> </article>
</div> </div>
@ -675,7 +626,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -687,7 +638,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "linux底下遠端遙控\x26管理的好用系統 Meshcentral \/ Remote Management \x26 control system Meshcentral", "name" : "linux底下遠端遙控\x26管理的好用系統 Meshcentral \/ Remote Management \x26 control system Meshcentral",
"headline" : "linux底下遠端遙控\x26管理的好用系統 Meshcentral \/ Remote Management \x26 control system Meshcentral", "headline" : "linux底下遠端遙控\x26管理的好用系統 Meshcentral \/ Remote Management \x26 control system Meshcentral",
"description" : "\x3cp\x3e之前在LAN\/windows環境下一直都是用ultravnc\/winvnc\/tigervnc之類的VNC軟體\x3c\/p\x3e\n\n\x3cp\x3e但是如果要過 internet 就會碰到各種開port的問題\x3c\/p\x3e\n\n\x3cp\x3e在這種環境下就有了當時 teamviewer 的橫空出世\x3c\/p\x3e\n\n\x3cp\x3e解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多\x3c\/p\x3e\n\n\x3cp\x3e只要下載teamviewer被控端開啟後報ID 給協助者就好了\x3c\/p\x3e", "description" : "\x3cp\x3e之前在LAN\/windows環境下一直都是用ultravnc\/winvnc\/tigervnc之類的VNC軟體\x3c\/p\x3e\n\x3cp\x3e但是如果要過 internet 就會碰到各種開port的問題\x3c\/p\x3e\n\x3cp\x3e在這種環境下就有了當時 teamviewer 的橫空出世\x3c\/p\x3e\n\x3cp\x3e解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多\x3c\/p\x3e\n\x3cp\x3e只要下載teamviewer被控端開啟後報ID 給協助者就好了\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,123 +305,69 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體</p> <p>之前在LAN/windows環境下一直都是用ultravnc/winvnc/tigervnc之類的VNC軟體</p>
<p>但是如果要過 internet 就會碰到各種開port的問題</p> <p>但是如果要過 internet 就會碰到各種開port的問題</p>
<p>在這種環境下,就有了當時 teamviewer 的橫空出世</p> <p>在這種環境下,就有了當時 teamviewer 的橫空出世</p>
<p>解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多</p> <p>解決了開PORT的問題讓被控端(通常是資訊技術相對弱勢,需要接受幫助的一方)不需要懂太多</p>
<p>只要下載teamviewer被控端開啟後報ID 給協助者就好了</p> <p>只要下載teamviewer被控端開啟後報ID 給協助者就好了</p>
<p>好景不常&hellip;ㄟ,好像也不能這麼說</p> <p>好景不常&hellip;ㄟ,好像也不能這麼說</p>
<p>teamviewer 是一套商業授權軟體要買license的</p> <p>teamviewer 是一套商業授權軟體要買license的</p>
<p>不知道用什麼方式偵測,一開始可以用,但是後來會出現視窗警告,再來就不讓你用了。</p> <p>不知道用什麼方式偵測,一開始可以用,但是後來會出現視窗警告,再來就不讓你用了。</p>
<p>於是又有了 anydesk 的出現</p> <p>於是又有了 anydesk 的出現</p>
<p>anydesk 的定義就是免費軟體,所以沒有授權問題</p> <p>anydesk 的定義就是免費軟體,所以沒有授權問題</p>
<p>可是 anydesk 在初期有頗多狀況比如像是windows的UAC或者是畫面反應速度過慢</p> <p>可是 anydesk 在初期有頗多狀況比如像是windows的UAC或者是畫面反應速度過慢</p>
<p>又或者是常常自動變成view only ,無法操作的狀況</p> <p>又或者是常常自動變成view only ,無法操作的狀況</p>
<p>當使用者需要讓我用anydesk連線進去時通常就已經是電腦有些什麼狀況了</p> <p>當使用者需要讓我用anydesk連線進去時通常就已經是電腦有些什麼狀況了</p>
<p>然後還要面對anydesk的種種問題實在是讓人很抓狂</p> <p>然後還要面對anydesk的種種問題實在是讓人很抓狂</p>
<p>終於某次因緣際會,讓我找到了這篇的主角</p> <p>終於某次因緣際會,讓我找到了這篇的主角</p>
<h2 id="meshcentral-">Meshcentral</h2>
<h2 id="meshcentral">Meshcentral</h2>
<p>簡單介紹一下Meshcentral 的優點</p> <p>簡單介紹一下Meshcentral 的優點</p>
<h3 id="安全性高-">安全性高</h3>
<h3 id="安全性高">安全性高</h3>
<p>teamviewer &amp; anydesk 之所以不需要開port就是被控/遙控兩邊都是先連線到他們提供的伺服器(通常在國外)</p> <p>teamviewer &amp; anydesk 之所以不需要開port就是被控/遙控兩邊都是先連線到他們提供的伺服器(通常在國外)</p>
<p>有人會擔心這樣畫面會不會被擷取之類的 我是認為想太多了啦,但就真的有人會擔心這種問題啊(嘆</p> <p>有人會擔心這樣畫面會不會被擷取之類的 我是認為想太多了啦,但就真的有人會擔心這種問題啊(嘆</p>
<p>meshcentral則不同他是安裝在LAN的機器上(當然要跨WAN也可以就開port吧)</p> <p>meshcentral則不同他是安裝在LAN的機器上(當然要跨WAN也可以就開port吧)</p>
<p>所以原則上從server到client這段的連線都是在LAN中加密進行不會有需要上傳到廠商伺服器的問題</p> <p>所以原則上從server到client這段的連線都是在LAN中加密進行不會有需要上傳到廠商伺服器的問題</p>
<p>自然安全性就高了很多</p> <p>自然安全性就高了很多</p>
<h3 id="速度快-">速度快</h3>
<h3 id="速度快">速度快</h3>
<p>如同前面所述因為都在LAN中進行不需要透過廠商在國外的Server所以操作的速度很快</p> <p>如同前面所述因為都在LAN中進行不需要透過廠商在國外的Server所以操作的速度很快</p>
<h3 id="操作簡單-">操作簡單</h3>
<h3 id="操作簡單">操作簡單</h3>
<p>一開始meshcentral 會需要在client 安裝agent在比較早期一點的版本這個動作需要先用anydesk連上被控端</p> <p>一開始meshcentral 會需要在client 安裝agent在比較早期一點的版本這個動作需要先用anydesk連上被控端</p>
<p>然後去開啟連結、以管理者權限進行安裝</p> <p>然後去開啟連結、以管理者權限進行安裝</p>
<p>新版改善了這個問題可以直接產生一個invite url 直接發信給user 請user去點連結進行安裝</p> <p>新版改善了這個問題可以直接產生一個invite url 直接發信給user 請user去點連結進行安裝</p>
<p>當然要先做好安裝步驟說明就是了不然windows會判斷這個是有問題的檔案不讓執行</p> <p>當然要先做好安裝步驟說明就是了不然windows會判斷這個是有問題的檔案不讓執行</p>
<p>裝完之後,被控端就不會再看到這東西了(所以也無從關閉除非從service.msc 去stop)</p> <p>裝完之後,被控端就不會再看到這東西了(所以也無從關閉除非從service.msc 去stop)</p>
<p>而且也不會碰到煩人的UAC訊息跳出來時畫面上的按鈕無法點選的問題(anydesk就有這種狀況需要透過config去排除)</p> <p>而且也不會碰到煩人的UAC訊息跳出來時畫面上的按鈕無法點選的問題(anydesk就有這種狀況需要透過config去排除)</p>
<h3 id="安裝容易-">安裝容易</h3>
<h3 id="安裝容易">安裝容易</h3>
<p>meshcentral的安裝很簡單在ubuntu 18.04 server 的環境底下執行以下指令</p> <p>meshcentral的安裝很簡單在ubuntu 18.04 server 的環境底下執行以下指令</p>
<pre><code>#install nodejs/npm
<pre><code> #install nodejs/npm sudo apt install nodejs npm
sudo apt install nodejs npm #make meshcentral working folder
#make meshcentral working folder sudo mkdir -p /opt/meshcentral
sudo mkdir -p /opt/meshcentral #install meshcentral
#install meshcentral cd /opt/meshcentral;npm install meshcentral
cd /opt/meshcentral;npm install meshcentral # start meshcentral
# start meshcentral cd /opt/meshcentral/node_modules/meshcentral;node meshcentral --cert {{ servier_ip_address }}
cd /opt/meshcentral/node_modules/meshcentral;node meshcentral --cert {{ servier_ip_address }} </code></pre><p>這樣就把meshcentral安裝&amp;啟動了</p>
</code></pre>
<p>這樣就把meshcentral安裝&amp;啟動了</p>
<p>應該是可以改用systemd or supervisor 來控制了,那個是另外的部份了</p> <p>應該是可以改用systemd or supervisor 來控制了,那個是另外的部份了</p>
<hr>
<hr /> <h3 id="meshcentral-簡易操作說明-">Meshcentral 簡易操作說明</h3>
<h3 id="meshcentral-簡易操作說明">Meshcentral 簡易操作說明</h3>
<p>meshcentral 在操作上也很簡單第一次安裝成功後開啟meshcentral的頁面</p> <p>meshcentral 在操作上也很簡單第一次安裝成功後開啟meshcentral的頁面</p>
<p>首先建立一個管理者帳號接著用管理者帳號進入後建立一個group</p> <p>首先建立一個管理者帳號接著用管理者帳號進入後建立一個group</p>
<p>然後進入這個group ,會看到一個 invite的連結</p> <p>然後進入這個group ,會看到一個 invite的連結</p>
<p><img src="https://i.imgur.com/MNrv2Sw.png" alt=""></p>
<p><img src="https://i.imgur.com/MNrv2Sw.png" alt="" /></p>
<p>點擊invite之後會詢問要產生多長有效時間的連結如果很懶就直接選unlimited</p> <p>點擊invite之後會詢問要產生多長有效時間的連結如果很懶就直接選unlimited</p>
<p>然後把這串URL記下來發給所有user(最好自己先run過一遍做一份安裝步驟一起發給使用者)</p> <p>然後把這串URL記下來發給所有user(最好自己先run過一遍做一份安裝步驟一起發給使用者)</p>
<p><img src="https://i.imgur.com/cXQBEWU.png" alt=""></p>
<p><img src="https://i.imgur.com/cXQBEWU.png" alt="" /></p>
<p>等到user照說明安裝agent之後在管理界面上就會看到client出現了</p> <p>等到user照說明安裝agent之後在管理界面上就會看到client出現了</p>
<p><img src="https://i.imgur.com/bQL6JJE.png" alt=""></p>
<p><img src="https://i.imgur.com/bQL6JJE.png" alt="" /></p>
<p>有亮起來的圖示就代表client online ,可以直接進去操作</p> <p>有亮起來的圖示就代表client online ,可以直接進去操作</p>
<p>操作畫面可以操考以下影片我是透過internet(兩邊都是CHT雙向100) 去控制遠端電腦播放youtube</p> <p>操作畫面可以操考以下影片我是透過internet(兩邊都是CHT雙向100) 去控制遠端電腦播放youtube</p>
<p>可以看到畫面是非常地流暢!</p> <p>可以看到畫面是非常地流暢!</p>
<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
<iframe src="https://www.youtube.com/embed/p6-BBYW51qc" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" allowfullscreen title="YouTube Video"></iframe> <iframe src="https://www.youtube.com/embed/p6-BBYW51qc" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" allowfullscreen title="YouTube Video"></iframe>
</div> </div>
<h3 id="總結-">總結</h3>
<h3 id="總結">總結</h3>
<p>這麼好用的系統,還不快去裝一套起來!</p> <p>這麼好用的系統,還不快去裝一套起來!</p>
</article> </article>
</div> </div>
@ -705,7 +647,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -717,7 +659,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 用ubuntu livecd 救援群暉 synology NAS內的資料 \/ rescue synology nas with ubuntu livecd", "name" : "[筆記] 用ubuntu livecd 救援群暉 synology NAS內的資料 \/ rescue synology nas with ubuntu livecd",
"headline" : "[筆記] 用ubuntu livecd 救援群暉 synology NAS內的資料 \/ rescue synology nas with ubuntu livecd", "headline" : "[筆記] 用ubuntu livecd 救援群暉 synology NAS內的資料 \/ rescue synology nas with ubuntu livecd",
"description" : "\x3cp\x3e2020\/01\/02 , 2020年上工的第一天群暉的 DS415\x2b NAS 掛了!\x3c\/p\x3e\n\n\x3cp\x3e因為群暉的文件在最關鍵的一步寫得亂七八糟\x3c\/p\x3e\n\n\x3cp\x3e所以在這邊紀錄一下我操作的步驟\x3c\/p\x3e", "description" : "\x3cp\x3e2020\/01\/02 , 2020年上工的第一天群暉的 DS415\x2b NAS 掛了!\x3c\/p\x3e\n\x3cp\x3e因為群暉的文件在最關鍵的一步寫得亂七八糟\x3c\/p\x3e\n\x3cp\x3e所以在這邊紀錄一下我操作的步驟\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,31 +305,18 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!</p> <p>2020/01/02 , 2020年上工的第一天群暉的 DS415+ NAS 掛了!</p>
<p>因為群暉的文件在最關鍵的一步寫得亂七八糟!</p> <p>因為群暉的文件在最關鍵的一步寫得亂七八糟!</p>
<p>所以在這邊紀錄一下我操作的步驟!</p> <p>所以在這邊紀錄一下我操作的步驟!</p>
<h4 id="建立可開機的ubuntu-隨身碟">建立可開機的ubuntu 隨身碟</h4> <h4 id="建立可開機的ubuntu-隨身碟">建立可開機的ubuntu 隨身碟</h4>
<p>建立 bootable ubuntu flash 的步驟,請參考底下網頁介紹,這邊就不多說了</p> <p>建立 bootable ubuntu flash 的步驟,請參考底下網頁介紹,這邊就不多說了</p>
<p><a href="https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0">https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0</a></p> <p><a href="https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0">https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu#0</a></p>
<h4 id="把nas上的硬碟接上pc">把NAS上的硬碟接上PC</h4> <h4 id="把nas上的硬碟接上pc">把NAS上的硬碟接上PC</h4>
<p>還好這次的NAS只有四顆如果有八顆我去哪裡生可以接八顆硬碟的主機&hellip;</p> <p>還好這次的NAS只有四顆如果有八顆我去哪裡生可以接八顆硬碟的主機&hellip;</p>
<h4 id="用隨身碟開機進入ubuntu-live-環境">用隨身碟開機進入ubuntu Live 環境</h4> <h4 id="用隨身碟開機進入ubuntu-live-環境">用隨身碟開機進入ubuntu Live 環境</h4>
<p>懶人沒截圖</p> <p>懶人沒截圖</p>
<h4 id="安裝必要套件">安裝必要套件</h4> <h4 id="安裝必要套件">安裝必要套件</h4>
<p>進入 ubuntu Live 之後,按 ctal + alt + t</p> <p>進入 ubuntu Live 之後,按 ctal + alt + t</p>
<p>開啟 terminal ,然後先安裝 mdadm &amp; lvm2</p> <p>開啟 terminal ,然後先安裝 mdadm &amp; lvm2</p>
<pre><code>ubuntu@ubuntu:~$ sudo apt install mdadm lvm2 <pre><code>ubuntu@ubuntu:~$ sudo apt install mdadm lvm2
Reading package lists... Done Reading package lists... Done
Building dependency tree Building dependency tree
@ -354,24 +337,14 @@ Fetched 1,346 kB in 3s (501 kB/s)
... ...
... ...
以下省略 以下省略
</code></pre> </code></pre><h4 id="scan-raid-and-lvm">scan raid and lvm</h4>
<h4 id="scan-raid-and-lvm">scan raid and lvm</h4>
<p>接下來先換成 root 操作</p> <p>接下來先換成 root 操作</p>
<pre><code>ubuntu@ubuntu:~$ sudo su - <pre><code>ubuntu@ubuntu:~$ sudo su -
</code></pre> </code></pre><p>然後掃描 raid &amp; LVM</p>
<p>然後掃描 raid &amp; LVM</p>
<pre><code>root@ubuntu:~# mdadm -Asf &amp;&amp; vgchange -ay <pre><code>root@ubuntu:~# mdadm -Asf &amp;&amp; vgchange -ay
mdadm: /dev/md/2 has been started with 4 drives. mdadm: /dev/md/2 has been started with 4 drives.
2 logical volume(s) in volume group &quot;vg1&quot; now active 2 logical volume(s) in volume group &quot;vg1&quot; now active
</code></pre> </code></pre><p>COOL 原本的VG出現了</p>
<p>COOL 原本的VG出現了</p>
<pre><code>root@ubuntu:~# vgdisplay <pre><code>root@ubuntu:~# vgdisplay
--- Volume group --- --- Volume group ---
VG Name vg1 VG Name vg1
@ -393,10 +366,7 @@ mdadm: /dev/md/2 has been started with 4 drives.
Alloc PE / Size 1427264 / 5.44 TiB Alloc PE / Size 1427264 / 5.44 TiB
Free PE / Size 0 / 0 Free PE / Size 0 / 0
VG UUID O1c8Uw-JmKy-EiKt-92OB-3K3y-roMi-9NUZ6H VG UUID O1c8Uw-JmKy-EiKt-92OB-3K3y-roMi-9NUZ6H
</code></pre> </code></pre><p>也可以看到 RAID 資訊了!</p>
<p>也可以看到 RAID 資訊了!</p>
<pre><code>root@ubuntu:~# mdadm -D /dev/md2 <pre><code>root@ubuntu:~# mdadm -D /dev/md2
/dev/md2: /dev/md2:
Version : 1.2 Version : 1.2
@ -429,30 +399,17 @@ Consistency Policy : resync
1 8 35 1 active sync /dev/sdc3 1 8 35 1 active sync /dev/sdc3
2 8 19 2 active sync /dev/sdb3 2 8 19 2 active sync /dev/sdb3
3 8 3 3 active sync /dev/sda3 3 8 3 3 active sync /dev/sda3
</code></pre> </code></pre><p>然後就會發生我之前寫的這篇的狀況</p>
<p>然後就會發生我之前寫的這篇的狀況</p>
<p><a href="https://h.cowbay.org/post/what-a-piss-in-synology-document/">https://h.cowbay.org/post/what-a-piss-in-synology-document/</a></p> <p><a href="https://h.cowbay.org/post/what-a-piss-in-synology-document/">https://h.cowbay.org/post/what-a-piss-in-synology-document/</a></p>
<p>問題發生了,總是要想辦法解決</p> <p>問題發生了,總是要想辦法解決</p>
<h4 id="scan-lv">scan lv</h4> <h4 id="scan-lv">scan lv</h4>
<pre><code>root@ubuntu:~# lvscan <pre><code>root@ubuntu:~# lvscan
ACTIVE '/dev/vg1/syno_vg_reserved_area' [12.00 MiB] inherit ACTIVE '/dev/vg1/syno_vg_reserved_area' [12.00 MiB] inherit
ACTIVE '/dev/vg1/volume_1' [5.44 TiB] inherit ACTIVE '/dev/vg1/volume_1' [5.44 TiB] inherit
</code></pre> </code></pre><p>OK ,在 vg1 底下有兩個 volume ,看大小來判斷,第二個是我們要的</p>
<p>OK ,在 vg1 底下有兩個 volume ,看大小來判斷,第二個是我們要的</p>
<p>用底下的指令就可以掛載了</p> <p>用底下的指令就可以掛載了</p>
<pre><code>mount /dev/vg1/volume_1 /mnt <pre><code>mount /dev/vg1/volume_1 /mnt
</code></pre> </code></pre><p>請依照自己的環境,把第一個路徑改掉,如果要掛載到別的目錄,那也把第二個 /mnt 改掉</p>
<p>請依照自己的環境,把第一個路徑改掉,如果要掛載到別的目錄,那也把第二個 /mnt 改掉</p>
<pre><code>root@ubuntu:/dev# mount /dev/vg1/volume_1 /mnt <pre><code>root@ubuntu:/dev# mount /dev/vg1/volume_1 /mnt
root@ubuntu:/dev# cd /mnt root@ubuntu:/dev# cd /mnt
root@ubuntu:/mnt# ls root@ubuntu:/mnt# ls
@ -460,9 +417,7 @@ root@ubuntu:/mnt# ls
aquota.group @download @iSCSITrg music synoquota.db aquota.group @download @iSCSITrg music synoquota.db
aquota.user @eaDir lost+found nfsforprox @tmp aquota.user @eaDir lost+found nfsforprox @tmp
@clamav @EP @maillog photo video @clamav @EP @maillog photo video
</code></pre> </code></pre><p>OK可以看到原本NAS 下的目錄了,接下來就可以進行檔案複製了!</p>
<p>OK可以看到原本NAS 下的目錄了,接下來就可以進行檔案複製了!</p>
</article> </article>
</div> </div>
@ -739,7 +694,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -751,7 +706,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 用pxe 安裝系統,完成後送出郵件通知 \/ send mail notification after pxe install", "name" : "[筆記] 用pxe 安裝系統,完成後送出郵件通知 \/ send mail notification after pxe install",
"headline" : "[筆記] 用pxe 安裝系統,完成後送出郵件通知 \/ send mail notification after pxe install", "headline" : "[筆記] 用pxe 安裝系統,完成後送出郵件通知 \/ send mail notification after pxe install",
"description" : "\x3cp\x3e最近有個任務需要大量安裝client\x3c\/p\x3e\n\n\x3cp\x3e想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot\x3c\/p\x3e\n\n\x3cp\x3e然後選擇OS版本就可以自動進行安裝\x3c\/p\x3e\n\n\x3cp\x3e安裝完成後會自動重新開機接著就用ansible來做user環境設定\x3c\/p\x3e\n\n\x3cp\x3ePXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了\x3c\/p\x3e\n\n\x3cp\x3e可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機\x3c\/p\x3e\n\n\x3cp\x3e就送出一封郵件來通知我說已經完成安裝可以執行ansible 了\x3c\/p\x3e\n\n\x3cp\x3e看似很簡單的一件事情卻搞了我兩天\x26hellip;.\x3c\/p\x3e", "description" : "\x3cp\x3e最近有個任務需要大量安裝client\x3c\/p\x3e\n\x3cp\x3e想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot\x3c\/p\x3e\n\x3cp\x3e然後選擇OS版本就可以自動進行安裝\x3c\/p\x3e\n\x3cp\x3e安裝完成後會自動重新開機接著就用ansible來做user環境設定\x3c\/p\x3e\n\x3cp\x3ePXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了\x3c\/p\x3e\n\x3cp\x3e可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機\x3c\/p\x3e\n\x3cp\x3e就送出一封郵件來通知我說已經完成安裝可以執行ansible 了\x3c\/p\x3e\n\x3cp\x3e看似很簡單的一件事情卻搞了我兩天\x26hellip;.\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,90 +305,49 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近有個任務需要大量安裝client</p> <p>最近有個任務需要大量安裝client</p>
<p>想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot</p> <p>想用PXE來處理只要user開機按F12(acer 桌機) 選擇PXE Boot</p>
<p>然後選擇OS版本就可以自動進行安裝</p> <p>然後選擇OS版本就可以自動進行安裝</p>
<p>安裝完成後會自動重新開機接著就用ansible來做user環境設定</p> <p>安裝完成後會自動重新開機接著就用ansible來做user環境設定</p>
<p>PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了</p> <p>PXE的部份本來是沒有什麼問題自動安裝系統的部份都做好了</p>
<p>可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機</p> <p>可是因為這次的量比較多想說讓每一台在完成PXE安裝後的第一次重開機</p>
<p>就送出一封郵件來通知我說已經完成安裝可以執行ansible 了</p> <p>就送出一封郵件來通知我說已經完成安裝可以執行ansible 了</p>
<p>看似很簡單的一件事情,卻搞了我兩天&hellip;.</p> <p>看似很簡單的一件事情,卻搞了我兩天&hellip;.</p>
<p>本來在 preseed 檔案中,就有 preseed/late_command 可以用</p> <p>本來在 preseed 檔案中,就有 preseed/late_command 可以用</p>
<p>但是測試了很多遍,才終於找到正確的語法</p> <p>但是測試了很多遍,才終於找到正確的語法</p>
<pre><code>d-i preseed/late_command \ <pre><code>d-i preseed/late_command \
in-target apt-file update; \ in-target apt-file update; \
in-target passwd --expire root ;\ in-target passwd --expire root ;\
in-target /bin/sh -c 'echo &quot;hostname|mail -s pxe_install_complete admin@abc.com&quot; &gt; /etc/rc.local' in-target /bin/sh -c 'echo &quot;hostname|mail -s pxe_install_complete admin@abc.com&quot; &gt; /etc/rc.local'
</code></pre> </code></pre><p>這會把目標主機上的 /etc/rc.local 的內容改成只有一行</p>
<p>這會把目標主機上的 /etc/rc.local 的內容改成只有一行</p>
<pre><code>hostname|mail -s pxe_install_complete admin@abc.com <pre><code>hostname|mail -s pxe_install_complete admin@abc.com
</code></pre> </code></pre><p>這樣就可以讓主機在完成系統安裝後,第一次重新開機時,送出郵件通知</p>
<p>這樣就可以讓主機在完成系統安裝後,第一次重新開機時,送出郵件通知</p>
<p>可是呢因為ubuntu 開機時,本來就會去執行 /etc/rc.local</p> <p>可是呢因為ubuntu 開機時,本來就會去執行 /etc/rc.local</p>
<p>所以「每次」開機後,都會送出郵件通知</p> <p>所以「每次」開機後,都會送出郵件通知</p>
<p>但是我只想要接到一次通知就好了啊</p> <p>但是我只想要接到一次通知就好了啊</p>
<p>有文章說可以用 s6-svc 來處理</p> <p>有文章說可以用 s6-svc 來處理</p>
<p>不過我沒弄懂怎麼用</p> <p>不過我沒弄懂怎麼用</p>
<p>另一個是用ansible來處理</p> <p>另一個是用ansible來處理</p>
<p>又或者是,讓這個指令在送出郵件後,「自我還原」或者「自我更新」</p> <p>又或者是,讓這個指令在送出郵件後,「自我還原」或者「自我更新」</p>
<p>自我還原的部份可以這樣做</p> <p>自我還原的部份可以這樣做</p>
<pre><code>hostname|mail -s pxe_install_complete admin@abc.com <pre><code>hostname|mail -s pxe_install_complete admin@abc.com
echo &quot;#!/bin/sh -e\nexit 0&quot; &gt; /etc/rc.local echo &quot;#!/bin/sh -e\nexit 0&quot; &gt; /etc/rc.local
</code></pre> </code></pre><p>所以preseed 那邊的語法就要改一下</p>
<p>所以preseed 那邊的語法就要改一下</p>
<pre><code> in-target /bin/sh -c 'echo &quot;hostname|mail -s pxe_install_complete admin@abc.com;\&quot;exit 0\&quot; &gt; /etc/rc.local' <pre><code> in-target /bin/sh -c 'echo &quot;hostname|mail -s pxe_install_complete admin@abc.com;\&quot;exit 0\&quot; &gt; /etc/rc.local'
</code></pre> </code></pre><p>這樣一來,在送出郵件後,/etc/rc.local 的檔案內容會被恢復成只有底下這一行</p>
<p>這樣一來,在送出郵件後,/etc/rc.local 的檔案內容會被恢復成只有底下這一行</p>
<pre><code>exit 0 <pre><code>exit 0
</code></pre> </code></pre><p>暫時先這樣子處理</p>
<h3 id="更新-">更新</h3>
<p>暫時先這樣子處理</p>
<h3 id="更新">更新</h3>
<p>因為直接把 /etc/rc.local 的內容改掉,實在讓我有點不放心</p> <p>因為直接把 /etc/rc.local 的內容改掉,實在讓我有點不放心</p>
<p>所以想到一個方式,先備份 /etc/rc.local 然後加入我要的功能</p> <p>所以想到一個方式,先備份 /etc/rc.local 然後加入我要的功能</p>
<p>因為我只需要它跑一次就好,所以就可以在最後面加入還原剛剛複製的備份檔案</p> <p>因為我只需要它跑一次就好,所以就可以在最後面加入還原剛剛複製的備份檔案</p>
<p>簡單說在preseed 檔案中 改成這樣</p> <p>簡單說在preseed 檔案中 改成這樣</p>
<pre><code>d-i preseed/late_command \ <pre><code>d-i preseed/late_command \
in-target apt-file update; \ in-target apt-file update; \
in-target passwd --expire root ;\ in-target passwd --expire root ;\
in-target cp /etc/rc.local /etc/rc.local.bak ;\ in-target cp /etc/rc.local /etc/rc.local.bak ;\
in-target /bin/sh -c 'echo &quot;hostname|mail -s pxe_install_complete admin@abc.com&quot; &gt; /etc/rc.local' ;\ in-target /bin/sh -c 'echo &quot;hostname|mail -s pxe_install_complete admin@abc.com&quot; &gt; /etc/rc.local' ;\
in-target /bin/sh -c 'echo &quot;cp /etc/rc.local.bak /etc/rc.local&quot; &gt;&gt; /etc/rc.local' in-target /bin/sh -c 'echo &quot;cp /etc/rc.local.bak /etc/rc.local&quot; &gt;&gt; /etc/rc.local'
</code></pre> </code></pre><p>在開機之後,會先送出郵件通知,然後會把剛剛複製的備份覆蓋回來,變成原本的 rc.local</p>
<p>在開機之後,會先送出郵件通知,然後會把剛剛複製的備份覆蓋回來,變成原本的 rc.local</p>
<p>這樣就不會有什麼問題了</p> <p>這樣就不會有什麼問題了</p>
</article> </article>
</div> </div>
@ -672,7 +627,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -684,7 +639,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在edgerouter上用wireguard 建立site to site VPN \/ Site to Site Vpn Using Wireguard in Two Edgerouters", "name" : "[筆記] 在edgerouter上用wireguard 建立site to site VPN \/ Site to Site Vpn Using Wireguard in Two Edgerouters",
"headline" : "[筆記] 在edgerouter上用wireguard 建立site to site VPN \/ Site to Site Vpn Using Wireguard in Two Edgerouters", "headline" : "[筆記] 在edgerouter上用wireguard 建立site to site VPN \/ Site to Site Vpn Using Wireguard in Two Edgerouters",
"description" : "\x3cp\x3e之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt\x3c\/p\x3e\n\n\x3cp\x3e然後用strongswan 來打 IPSEC site to site VPN\x3c\/p\x3e\n\n\x3cp\x3econfig 看起來不是很難 (只是看起來)\x3c\/p\x3e\n\n\x3cp\x3e但是實際上已經找不到當初的文件\x3c\/p\x3e\n\n\x3cp\x3e所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)\x3c\/p\x3e\n\n\x3cp\x3e後來採購了兩台edgerouter X 做測試\x3c\/p\x3e\n\n\x3cp\x3e也用openvpn 成功的建立了 site to site VPN\x3c\/p\x3e\n\n\x3cp\x3e本來想說 openvpn 已經夠簡單了\x3c\/p\x3e\n\n\x3cp\x3e今天看到文章說用wireguard 可以更簡單\x3c\/p\x3e\n\n\x3cp\x3e於是研究了一下發現還真的很簡單\x3c\/p\x3e", "description" : "\x3cp\x3e之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt\x3c\/p\x3e\n\x3cp\x3e然後用strongswan 來打 IPSEC site to site VPN\x3c\/p\x3e\n\x3cp\x3econfig 看起來不是很難 (只是看起來)\x3c\/p\x3e\n\x3cp\x3e但是實際上已經找不到當初的文件\x3c\/p\x3e\n\x3cp\x3e所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)\x3c\/p\x3e\n\x3cp\x3e後來採購了兩台edgerouter X 做測試\x3c\/p\x3e\n\x3cp\x3e也用openvpn 成功的建立了 site to site VPN\x3c\/p\x3e\n\x3cp\x3e本來想說 openvpn 已經夠簡單了\x3c\/p\x3e\n\x3cp\x3e今天看到文章說用wireguard 可以更簡單\x3c\/p\x3e\n\x3cp\x3e於是研究了一下發現還真的很簡單\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,35 +305,20 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt</p> <p>之前總部和分公司之間 是用buffalo 的小AP 灌 openwrt</p>
<p>然後用strongswan 來打 IPSEC site to site VPN</p> <p>然後用strongswan 來打 IPSEC site to site VPN</p>
<p>config 看起來不是很難 (只是看起來)</p> <p>config 看起來不是很難 (只是看起來)</p>
<p>但是實際上已經找不到當初的文件</p> <p>但是實際上已經找不到當初的文件</p>
<p>所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)</p> <p>所以要維護很困難(光那些RSA KEY 就不知道為何、如何產生)</p>
<p>後來採購了兩台edgerouter X 做測試</p> <p>後來採購了兩台edgerouter X 做測試</p>
<p>也用openvpn 成功的建立了 site to site VPN</p> <p>也用openvpn 成功的建立了 site to site VPN</p>
<p>本來想說 openvpn 已經夠簡單了</p> <p>本來想說 openvpn 已經夠簡單了</p>
<p>今天看到文章說用wireguard 可以更簡單</p> <p>今天看到文章說用wireguard 可以更簡單</p>
<p>於是研究了一下,發現還真的很簡單!</p> <p>於是研究了一下,發現還真的很簡單!</p>
<h3 id="download-deb-for-your-edgerouter">download deb for your edgerouter</h3> <h3 id="download-deb-for-your-edgerouter">download deb for your edgerouter</h3>
<h4 id="go-check-httpsgithubcomlochnairvyatta-wireguard-first">go check <a href="https://github.com/Lochnair/vyatta-wireguard">https://github.com/Lochnair/vyatta-wireguard</a> first</h4>
<h4 id="go-check-https-github-com-lochnair-vyatta-wireguard-first">go check <a href="https://github.com/Lochnair/vyatta-wireguard">https://github.com/Lochnair/vyatta-wireguard</a> first</h4>
<pre><code>curl -L -O https://github.com/Lochnair/vyatta-wireguard/releases/download/0.0.20190702-1/wireguard-v2.0-e50-0.0.20190702-1.deb <pre><code>curl -L -O https://github.com/Lochnair/vyatta-wireguard/releases/download/0.0.20190702-1/wireguard-v2.0-e50-0.0.20190702-1.deb
dpkg -i wireguard-v2.0-e50-0.0.20190702-1.deb dpkg -i wireguard-v2.0-e50-0.0.20190702-1.deb
</code></pre> </code></pre><p>process log</p>
<p>process log</p>
<pre><code>root@ubnt112:~# dpkg -i wireguard-v2.0-e50-0.0.20190702-1.deb <pre><code>root@ubnt112:~# dpkg -i wireguard-v2.0-e50-0.0.20190702-1.deb
Selecting previously unselected package wireguard. Selecting previously unselected package wireguard.
(Reading database ... 37024 files and directories currently installed.) (Reading database ... 37024 files and directories currently installed.)
@ -346,105 +327,60 @@ Adding 'diversion of /opt/vyatta/share/perl5/Vyatta/Interface.pm to /opt/vyatta/
Adding 'diversion of /opt/vyatta/share/vyatta-cfg/templates/firewall/options/mss-clamp/interface-type/node.def to /opt/vyatta/share/vyatta-cfg/templates/firewall/options/mss-clamp/interface-type/node.def.vyatta by wireguard' Adding 'diversion of /opt/vyatta/share/vyatta-cfg/templates/firewall/options/mss-clamp/interface-type/node.def to /opt/vyatta/share/vyatta-cfg/templates/firewall/options/mss-clamp/interface-type/node.def.vyatta by wireguard'
Unpacking wireguard (0.0.20190702-1) ... Unpacking wireguard (0.0.20190702-1) ...
Setting up wireguard (0.0.20190702-1) ... Setting up wireguard (0.0.20190702-1) ...
</code></pre> </code></pre><h4 id="generate-privatepublic-key-in-left-router">generate private/public key in left router</h4>
<h4 id="generate-private-public-key-in-left-router">generate private/public key in left router</h4>
<pre><code>wg genkey | tee /dev/tty | wg pubkey <pre><code>wg genkey | tee /dev/tty | wg pubkey
</code></pre> </code></pre><p>first one in private key and the next one is public key of this router</p>
<p>first one in private key and the next one is public key of this router</p>
<pre><code>QGAUHJSDFAdkfjskdjo1DP8H1NuLTrXH6kue6kphaQk/iAkc= <pre><code>QGAUHJSDFAdkfjskdjo1DP8H1NuLTrXH6kue6kphaQk/iAkc=
ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU=
</code></pre> </code></pre><h4 id="configure-left-site-edgerouter">configure left site edgerouter</h4>
<h4 id="configure-left-site-edgerouter">configure left site edgerouter</h4>
<pre><code>configure <pre><code>configure
set interfaces wireguard wg0 address 192.168.99.1/24 set interfaces wireguard wg0 address 192.168.99.1/24
set interfaces wireguard wg0 listen-port 51820 set interfaces wireguard wg0 listen-port 51820
set interfaces wireguard wg0 route-allowed-ips true set interfaces wireguard wg0 route-allowed-ips true
### paster your private key which was just been generate ### paster your private key which was just been generate
set interfaces wireguard wg0 private-key QGAUHJSDFAdkfjskdjo1DP8H1NuLTrXH6kue6kphaQk/iAkc= set interfaces wireguard wg0 private-key QGAUHJSDFAdkfjskdjo1DP8H1NuLTrXH6kue6kphaQk/iAkc=
</code></pre> </code></pre><h4 id="generate-privatepublic-key-in-right-router">generate private/public key in right router</h4>
<h4 id="generate-private-public-key-in-right-router">generate private/public key in right router</h4>
<pre><code>wg genkey | tee /dev/tty | wg pubkey <pre><code>wg genkey | tee /dev/tty | wg pubkey
</code></pre> </code></pre><p>first one in private key and the next one is public key of this router</p>
<p>first one in private key and the next one is public key of this router</p>
<pre><code>UBzmPabcdefghijklmnopqrlbi5tnsQqjoJ4+H4= <pre><code>UBzmPabcdefghijklmnopqrlbi5tnsQqjoJ4+H4=
tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk=
</code></pre> </code></pre><h4 id="configure-right-site-edgerouter">configure right site edgerouter</h4>
<h4 id="configure-right-site-edgerouter">configure right site edgerouter</h4>
<pre><code>configure <pre><code>configure
set interfaces wireguard wg0 address 192.168.99.2/24 set interfaces wireguard wg0 address 192.168.99.2/24
set interfaces wireguard wg0 listen-port 51820 set interfaces wireguard wg0 listen-port 51820
set interfaces wireguard wg0 route-allowed-ips true set interfaces wireguard wg0 route-allowed-ips true
### paster your private key which was just been generate ### paster your private key which was just been generate
set interfaces wireguard wg0 private-key UBzmPabcdefghijklmnopqrlbi5tnsQqjoJ4+H4= set interfaces wireguard wg0 private-key UBzmPabcdefghijklmnopqrlbi5tnsQqjoJ4+H4=
</code></pre> </code></pre><p>now , configure both router to talk to each other</p>
<p>now , configure both router to talk to each other</p>
<h4 id="configure-in-left-router">configure in left router</h4> <h4 id="configure-in-left-router">configure in left router</h4>
<pre><code>### use the right router public key here <pre><code>### use the right router public key here
set interfaces wireguard wg0 peer tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= allowed-ips 192.168.99.0/16 set interfaces wireguard wg0 peer tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= allowed-ips 192.168.99.0/16
set interfaces wireguard wg0 peer tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= endpoint 222.222.222.222:51820 set interfaces wireguard wg0 peer tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= endpoint 222.222.222.222:51820
set interfaces wireguard wg0 peer tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= persistent-keepalive 15 set interfaces wireguard wg0 peer tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= persistent-keepalive 15
</code></pre> </code></pre><h4 id="configre-in-right-router">configre in right router</h4>
<h4 id="configre-in-right-router">configre in right router</h4>
<pre><code>### use the left router public key here <pre><code>### use the left router public key here
set interfaces wireguard wg0 peer ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= allowed-ips 192.168.99.0/16 set interfaces wireguard wg0 peer ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= allowed-ips 192.168.99.0/16
set interfaces wireguard wg0 peer ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= endpoint 111.111.111.111:51280 set interfaces wireguard wg0 peer ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= endpoint 111.111.111.111:51280
set interfaces wireguard wg0 peer ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= persistent-keepalive 15 set interfaces wireguard wg0 peer ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= persistent-keepalive 15
</code></pre> </code></pre><h4 id="configure-firewall-policy-in-left-site-router">configure firewall policy in left site router</h4>
<h4 id="configure-firewall-policy-in-left-site-router">configure firewall policy in left site router</h4>
<pre><code>### change 40 to your own rule number <pre><code>### change 40 to your own rule number
set firewall name WAN_LOCAL rule 40 source port 51820 set firewall name WAN_LOCAL rule 40 source port 51820
set firewall name WAN_LOCAL rule 40 destination port 51820 set firewall name WAN_LOCAL rule 40 destination port 51820
</code></pre> </code></pre><h4 id="configure-firewall-policy-in-right-site-router">configure firewall policy in right site router</h4>
<h4 id="configure-firewall-policy-in-right-site-router">configure firewall policy in right site router</h4>
<pre><code>### change 40 to your own rule number <pre><code>### change 40 to your own rule number
set firewall name WAN_LOCAL rule 40 source port 51820 set firewall name WAN_LOCAL rule 40 source port 51820
set firewall name WAN_LOCAL rule 40 destination port 51820 set firewall name WAN_LOCAL rule 40 destination port 51820
</code></pre> </code></pre><p>then finally , commit these changes on both side router</p>
<p>then finally , commit these changes on both side router</p>
<pre><code>commit <pre><code>commit
### and save if you want ### and save if you want
save save
</code></pre> </code></pre><h4 id="oops--one-more-step--add-static-route">oops , one more step , add static route</h4>
<h4 id="oops-one-more-step-add-static-route">oops , one more step , add static route</h4>
<h5 id="manually-add-static-route-in-left-router">manually add static route in left router</h5> <h5 id="manually-add-static-route-in-left-router">manually add static route in left router</h5>
<pre><code>ip route add 192.168.111.0/24 dev wg0 <pre><code>ip route add 192.168.111.0/24 dev wg0
</code></pre> </code></pre><h5 id="manually-add-static-route-in-right-router">manually add static route in right router</h5>
<h5 id="manually-add-static-route-in-right-router">manually add static route in right router</h5>
<pre><code>ip route add 192.168.112.0/24 dev wg0 <pre><code>ip route add 192.168.112.0/24 dev wg0
</code></pre> </code></pre><h4 id="check-wireguard-status-in-both-router">check wireguard status in both router</h4>
<h4 id="check-wireguard-status-in-both-router">check wireguard status in both router</h4>
<h5 id="left">left</h5> <h5 id="left">left</h5>
<pre><code> root@ubnt112:~# sudo wg <pre><code> root@ubnt112:~# sudo wg
interface: wg0 interface: wg0
public key: ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= public key: ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU=
@ -458,10 +394,7 @@ peer: tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk=
transfer: 7.49 MiB received, 195.86 MiB sent transfer: 7.49 MiB received, 195.86 MiB sent
persistent keepalive: every 15 seconds persistent keepalive: every 15 seconds
root@ubnt112:~# root@ubnt112:~#
</code></pre> </code></pre><h5 id="right">right</h5>
<h5 id="right">right</h5>
<pre><code>interface: wg0 <pre><code>interface: wg0
public key: tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= public key: tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk=
private key: (hidden) private key: (hidden)
@ -474,16 +407,10 @@ peer: ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU=
transfer: 195.60 MiB received, 8.07 MiB sent transfer: 195.60 MiB received, 8.07 MiB sent
persistent keepalive: every 15 seconds persistent keepalive: every 15 seconds
root@ubnt111:~# root@ubnt111:~#
</code></pre> </code></pre><h3 id="need-more-edgerouter-and-lease-line-to-try-multiple-site-to-site-vpn-using-wideguard">need more edgerouter and lease line to try multiple site to site VPN using wideguard</h3>
<h3 id="need-more-edgerouter-and-lease-line-to-try-multiple-site-to-site-vpn-using-wideguard">need more edgerouter and lease line to try multiple site to site VPN using wideguard</h3>
<h5 id="need-to-study-about-allowed-ips">need to study about allowed-ips</h5> <h5 id="need-to-study-about-allowed-ips">need to study about allowed-ips</h5>
<h3 id="sort-out-scripts">sort out scripts</h3> <h3 id="sort-out-scripts">sort out scripts</h3>
<h5 id="left-router">left router</h5> <h5 id="left-router">left router</h5>
<pre><code>wg genkey | tee /dev/tty | wg pubkey <pre><code>wg genkey | tee /dev/tty | wg pubkey
QGAUHJSDFAdkfjskdjo1DP8H1NuLTrXH6kue6kphaQk/iAkc= QGAUHJSDFAdkfjskdjo1DP8H1NuLTrXH6kue6kphaQk/iAkc=
ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU= ta+GJCWNUHJSDFAdkfjskdjnkppY5FpsIs3a8dc4oArtV8FU=
@ -502,10 +429,7 @@ set firewall name WAN_LOCAL rule 40 destination port 51820
commit commit
save save
ip route add 192.168.111.0/24 dev wg0 ip route add 192.168.111.0/24 dev wg0
</code></pre> </code></pre><h5 id="right-router">right router</h5>
<h5 id="right-router">right router</h5>
<pre><code>wg genkey | tee /dev/tty | wg pubkey <pre><code>wg genkey | tee /dev/tty | wg pubkey
UBzmPabcdefghijklmnopqrlbi5tnsQqjoJ4+H4= UBzmPabcdefghijklmnopqrlbi5tnsQqjoJ4+H4=
tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk= tmlrPSabcdefghijklmnopqrIb1Enzf+108yotkhdRmk=
@ -801,7 +725,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -813,7 +737,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] Freenas Smartd 啟動失敗 Smartd Failed to Start in Freenas", "name" : "[筆記] Freenas Smartd 啟動失敗 Smartd Failed to Start in Freenas",
"headline" : "[筆記] Freenas Smartd 啟動失敗 Smartd Failed to Start in Freenas", "headline" : "[筆記] Freenas Smartd 啟動失敗 Smartd Failed to Start in Freenas",
"description" : "\x3cp\x3e這兩天在弄兩台Freenas 準備當作Proxmox 的Storage \x26amp; Server Backup\x3c\/p\x3e\n\n\x3cp\x3e因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10\x3c\/p\x3e\n\n\x3cp\x3e然後把Freenas 安裝在隨身碟上\x3c\/p\x3e\n\n\x3cp\x3e不過會一直出現Smartd failed to start 的錯誤訊息\x3c\/p\x3e", "description" : "\x3cp\x3e這兩天在弄兩台Freenas 準備當作Proxmox 的Storage \x26amp; Server Backup\x3c\/p\x3e\n\x3cp\x3e因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10\x3c\/p\x3e\n\x3cp\x3e然後把Freenas 安裝在隨身碟上\x3c\/p\x3e\n\x3cp\x3e不過會一直出現Smartd failed to start 的錯誤訊息\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,27 +305,16 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp; Server Backup</p> <p>這兩天在弄兩台Freenas 準備當作Proxmox 的Storage &amp; Server Backup</p>
<p>因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10</p> <p>因為伺服器的限制只能接六個SATA我接了六個2T的硬碟做raid10</p>
<p>然後把Freenas 安裝在隨身碟上</p> <p>然後把Freenas 安裝在隨身碟上</p>
<p>不過會一直出現Smartd failed to start 的錯誤訊息</p> <p>不過會一直出現Smartd failed to start 的錯誤訊息</p>
<p><img src="https://i.imgur.com/mj6lCc7.png" alt="Freenas smartd failed to start"></p>
<p><img src="https://i.imgur.com/mj6lCc7.png" alt="Freenas smartd failed to start" /></p>
<p>翻了一下論壇,發現因為系統安裝在隨身碟上</p> <p>翻了一下論壇,發現因為系統安裝在隨身碟上</p>
<p>然後預設會開啟隨身碟的smart</p> <p>然後預設會開啟隨身碟的smart</p>
<p>可是這樣反而會造成錯誤</p> <p>可是這樣反而會造成錯誤</p>
<p>所以只要去 Storage &ndash;&gt; View Disks 找到隨身碟的代號</p> <p>所以只要去 Storage &ndash;&gt; View Disks 找到隨身碟的代號</p>
<p>然後點兩下進去編輯,把 enable S.M.A.R.T 關閉</p> <p>然後點兩下進去編輯,把 enable S.M.A.R.T 關閉</p>
<p><img src="https://i.imgur.com/WnvsQie.png" alt="disable SMART on USB FLASH"></p>
<p><img src="https://i.imgur.com/WnvsQie.png" alt="disable SMART on USB FLASH" /></p>
<p>接著再去啟動 SMART ,就不會有錯誤訊息了</p> <p>接著再去啟動 SMART ,就不會有錯誤訊息了</p>
</article> </article>
</div> </div>
@ -605,7 +590,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -617,7 +602,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[雜念] 群暉 Synology NAS DS 415\x2b 誇張的維修費用", "name" : "[雜念] 群暉 Synology NAS DS 415\x2b 誇張的維修費用",
"headline" : "[雜念] 群暉 Synology NAS DS 415\x2b 誇張的維修費用", "headline" : "[雜念] 群暉 Synology NAS DS 415\x2b 誇張的維修費用",
"description" : "\x3cp\x3e前幾天公司的一台 Synology DS 415\x2b 發生異常\x3c\/p\x3e\n\n\x3cp\x3e注意到的時候四顆硬碟燈號都不斷的在閃爍\x3c\/p\x3e\n\n\x3cp\x3e但是已經無法登入系統\x3c\/p\x3e\n\n\x3cp\x3e重開機之後更慘四顆硬碟燈號全部橘燈恆亮\x3c\/p\x3e\n\n\x3cp\x3e底下的電源藍燈不斷的在閃爍\x3c\/p\x3e\n\n\x3cp\x3e雖然我一再表示不希望送修了\x3c\/p\x3e\n\n\x3cp\x3e一來是已經過保二來是DS415\x2b 本身就有intel bug三來是因為對synology的NAS 實在沒有愛\x26hellip;\x3c\/p\x3e\n\n\x3cp\x3e不過主管還是希望能夠先問群暉維修的費用多少\x3c\/p\x3e", "description" : "\x3cp\x3e前幾天公司的一台 Synology DS 415\x2b 發生異常\x3c\/p\x3e\n\x3cp\x3e注意到的時候四顆硬碟燈號都不斷的在閃爍\x3c\/p\x3e\n\x3cp\x3e但是已經無法登入系統\x3c\/p\x3e\n\x3cp\x3e重開機之後更慘四顆硬碟燈號全部橘燈恆亮\x3c\/p\x3e\n\x3cp\x3e底下的電源藍燈不斷的在閃爍\x3c\/p\x3e\n\x3cp\x3e雖然我一再表示不希望送修了\x3c\/p\x3e\n\x3cp\x3e一來是已經過保二來是DS415\x2b 本身就有intel bug三來是因為對synology的NAS 實在沒有愛\x26hellip;\x3c\/p\x3e\n\x3cp\x3e不過主管還是希望能夠先問群暉維修的費用多少\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -24,7 +24,7 @@
"datePublished": "2018-12-04 10:25:19 \x2b0800 CST", "datePublished": "2018-12-04 10:25:19 \x2b0800 CST",
"dateModified" : "2018-12-04 10:25:19 \x2b0800 CST", "dateModified" : "2018-12-04 10:25:19 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/post\/synology-ds415-repair-cost\/", "url" : "https:\/\/h.cowbay.org\/post\/synology-ds415-repair-cost\/",
"wordCount" : "58", "wordCount" : "56",
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-13.jpg"", "image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-13.jpg"",
"keywords" : [ ""NAS"",""群暉"",""synology"","Blog" ] "keywords" : [ ""NAS"",""群暉"",""synology"","Blog" ]
} }
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,39 +305,24 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>前幾天公司的一台 Synology DS 415+ 發生異常</p> <p>前幾天公司的一台 Synology DS 415+ 發生異常</p>
<p>注意到的時候,四顆硬碟燈號都不斷的在閃爍</p> <p>注意到的時候,四顆硬碟燈號都不斷的在閃爍</p>
<p>但是已經無法登入系統</p> <p>但是已經無法登入系統</p>
<p>重開機之後更慘,四顆硬碟燈號全部橘燈恆亮</p> <p>重開機之後更慘,四顆硬碟燈號全部橘燈恆亮</p>
<p>底下的電源藍燈不斷的在閃爍</p> <p>底下的電源藍燈不斷的在閃爍</p>
<p>雖然我一再表示不希望送修了</p> <p>雖然我一再表示不希望送修了</p>
<p>一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&hellip;</p> <p>一來是已經過保二來是DS415+ 本身就有intel bug三來是因為對synology的NAS 實在沒有愛&hellip;</p>
<p>不過主管還是希望能夠先問群暉維修的費用多少</p> <p>不過主管還是希望能夠先問群暉維修的費用多少</p>
<p>登入 account.synology.com 之後早上10:40 發了一張ticket</p> <p>登入 account.synology.com 之後早上10:40 發了一張ticket</p>
<p>請群暉提供RMA 流程</p> <p>請群暉提供RMA 流程</p>
<pre><code>線上運作時發現四個硬碟燈號同時都在快速閃爍重新開機後STATUS 藍燈持續閃爍,四個硬碟燈號都是橘燈恆亮。 <pre><code>線上運作時發現四個硬碟燈號同時都在快速閃爍重新開機後STATUS 藍燈持續閃爍,四個硬碟燈號都是橘燈恆亮。
進線客服詢問,把硬碟拔出來,空機開機還是一樣的狀況。 進線客服詢問,把硬碟拔出來,空機開機還是一樣的狀況。
請協助提供RMA 流程,謝謝! 請協助提供RMA 流程,謝謝!
</code></pre> </code></pre><p>然後「當天」下午 17:40 ,客服回信了</p>
<p>然後「當天」下午 17:40 ,客服回信了</p>
<p>嗯,一封郵件要等七個小時才回信&hellip;效率真是高啊!</p> <p>嗯,一封郵件要等七個小時才回信&hellip;效率真是高啊!</p>
<p>客服表示</p> <p>客服表示</p>
<pre><code>DS415提供原廠保固2年Synology針對此型號有額外增加1年的保固期限因此產品為3年保固產品 <pre><code>DS415提供原廠保固2年Synology針對此型號有額外增加1年的保固期限因此產品為3年保固產品
根據產品的序號目前機器是過保的狀態,為確認目前產品是否仍在保固內,請問您是否還保有當初的購買證明呢? 根據產品的序號目前機器是過保的狀態,為確認目前產品是否仍在保固內,請問您是否還保有當初的購買證明呢?
@ -349,33 +330,20 @@ if (!doNotTrack) {
若產品還在保固內我會儘速替您申請機器RMA的程序 若產品還在保固內我會儘速替您申請機器RMA的程序
若產品確認是過保狀態我會替您查詢目前最新更換DS415+主機板的報價供您參考 若產品確認是過保狀態我會替您查詢目前最新更換DS415+主機板的報價供您參考
</code></pre> </code></pre><p>產品已經過保了,就算用手邊的購買證明去算保固日期也是一樣</p>
<p>產品已經過保了,就算用手邊的購買證明去算保固日期也是一樣</p>
<p>所以請群暉客服直接提供維修主機板的報價</p> <p>所以請群暉客服直接提供維修主機板的報價</p>
<p>然後隔天收到回信了</p> <p>然後隔天收到回信了</p>
<pre><code>稍早跟物料人同仁確認目前DS415+的PCBA是還有庫存的主板報價是新台幣 $15,232(郵寄費 $100NTD) <pre><code>稍早跟物料人同仁確認目前DS415+的PCBA是還有庫存的主板報價是新台幣 $15,232(郵寄費 $100NTD)
由於主機板是整項產品單價最高的零件,一般我們會建議使用者若有更換的需求,轉考慮同等級新機種其實會比較划算. 由於主機板是整項產品單價最高的零件,一般我們會建議使用者若有更換的需求,轉考慮同等級新機種其實會比較划算.
以上資訊供您參考非常感謝您對Synology產品的支持 以上資訊供您參考非常感謝您對Synology產品的支持
</code></pre> </code></pre><p>嗯哼,一台當初購買價格不過<strong>一萬七千多</strong>的設備,維修報價是<!-- raw HTML omitted --> 15232<!-- raw HTML omitted --> ,還有什麼好說呢?</p>
<p>這個客服也很直接說了,<!-- raw HTML omitted -->考慮換新機種比較划算<!-- raw HTML omitted -->,所以就不維修了</p>
<p>嗯哼,一台當初購買價格不過<strong>一萬七千多</strong>的設備,維修報價是<strong> 15232</strong> ,還有什麼好說呢?</p>
<p>這個客服也很直接說了,<strong>考慮換新機種比較划算</strong>,所以就不維修了</p>
<p>只是這個型號(DS-415+)的NAS ,當初一共採購了四台</p> <p>只是這個型號(DS-415+)的NAS ,當初一共採購了四台</p>
<p>我到這邊不到一年維修了兩台更換了兩次硬碟重建了三次RAID</p> <p>我到這邊不到一年維修了兩台更換了兩次硬碟重建了三次RAID</p>
<p>群暉吶&hellip; Synology 吶&hellip;本來以為可以是真正的「台灣之光」的廠商吶..</p> <p>群暉吶&hellip; Synology 吶&hellip;本來以為可以是真正的「台灣之光」的廠商吶..</p>
<p>只是這將近十年下來的經驗&hellip;</p> <p>只是這將近十年下來的經驗&hellip;</p>
<p>我以後如果不是用「國際」大廠的NAS不然就是會自己搞 FREENAS 之類的opensource 系統了吧&hellip;</p> <p>我以後如果不是用「國際」大廠的NAS不然就是會自己搞 FREENAS 之類的opensource 系統了吧&hellip;</p>
</article> </article>
</div> </div>
@ -655,7 +623,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -667,7 +635,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 測試 postgresql 的pg_prewarm 對效能的影響 \/ test pg_prewarm in postgresql 11", "name" : "[筆記] 測試 postgresql 的pg_prewarm 對效能的影響 \/ test pg_prewarm in postgresql 11",
"headline" : "[筆記] 測試 postgresql 的pg_prewarm 對效能的影響 \/ test pg_prewarm in postgresql 11", "headline" : "[筆記] 測試 postgresql 的pg_prewarm 對效能的影響 \/ test pg_prewarm in postgresql 11",
"description" : "\x3cp\x3e老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面\x3c\/p\x3e\n\n\x3cp\x3e但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)\x3c\/p\x3e\n\n\x3cp\x3e在找資料的時候發現了這個postgresql 的 pg_prewarm extension\x3c\/p\x3e\n\n\x3cp\x3e好像有點意思就來測試看看吧\x3c\/p\x3e\n\n\x3cp\x3e只是目前還不知道該怎麼解讀測試的數據就是了\x26hellip;\x3c\/p\x3e\n\n\x3cp\x3e幹林北真的不是 DBA 啦 =.=\x3c\/p\x3e", "description" : "\x3cp\x3e老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面\x3c\/p\x3e\n\x3cp\x3e但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)\x3c\/p\x3e\n\x3cp\x3e在找資料的時候發現了這個postgresql 的 pg_prewarm extension\x3c\/p\x3e\n\x3cp\x3e好像有點意思就來測試看看吧\x3c\/p\x3e\n\x3cp\x3e只是目前還不知道該怎麼解讀測試的數據就是了\x26hellip;\x3c\/p\x3e\n\x3cp\x3e幹林北真的不是 DBA 啦 =.=\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,25 +305,15 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面</p> <p>老闆提到想要把新系統的 postgresql 資料庫都撈到記憶體裡面</p>
<p>但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)</p> <p>但是否決了我提出的ramdisk 作法(因為當機的話,資料就沒了)</p>
<p>在找資料的時候發現了這個postgresql 的 pg_prewarm extension</p> <p>在找資料的時候發現了這個postgresql 的 pg_prewarm extension</p>
<p>好像有點意思?就來測試看看吧!</p> <p>好像有點意思?就來測試看看吧!</p>
<p>只是目前還不知道該怎麼解讀測試的數據就是了&hellip;</p> <p>只是目前還不知道該怎麼解讀測試的數據就是了&hellip;</p>
<p>幹!林北真的不是 DBA 啦 =.=</p> <p>幹!林北真的不是 DBA 啦 =.=</p>
<p>安裝系統、postgresql 資料庫什麼的就不提了,那不是這次的重點</p> <p>安裝系統、postgresql 資料庫什麼的就不提了,那不是這次的重點</p>
<h4 id="修改-postgresqlconf">修改 postgresql.conf</h4>
<h4 id="修改-postgresql-conf">修改 postgresql.conf</h4>
<p>編輯postgresql.conf開啟平行處理以及設定可用記憶體容量</p> <p>編輯postgresql.conf開啟平行處理以及設定可用記憶體容量</p>
<p>這台測試機的環境是一台三代i7 , 24G RAM , 240G SSD安裝debian 10(buster)</p> <p>這台測試機的環境是一台三代i7 , 24G RAM , 240G SSD安裝debian 10(buster)</p>
<pre><code># load libiriaes <pre><code># load libiriaes
# 其實這次不會用到pg_stat_statements ,不過出於習慣,還是加入開機自動載入吧 # 其實這次不會用到pg_stat_statements ,不過出於習慣,還是加入開機自動載入吧
shared_preload_libraries = 'pg_stat_statements' shared_preload_libraries = 'pg_stat_statements'
@ -351,30 +337,19 @@ max_wal_size = 2GB
max_worker_processes = 8 max_worker_processes = 8
max_parallel_workers_per_gather = 4 max_parallel_workers_per_gather = 4
max_parallel_workers = 8 max_parallel_workers = 8
</code></pre> </code></pre><p>重新啟動postgresql ,準備開始測試囉!</p>
<p>重新啟動postgresql ,準備開始測試囉!</p>
<p>轉換成 postgres 身份後,進入 psql</p> <p>轉換成 postgres 身份後,進入 psql</p>
<h4 id="建立測試資料庫">建立測試資料庫</h4> <h4 id="建立測試資料庫">建立測試資料庫</h4>
<pre><code>postgres=# create database test; <pre><code>postgres=# create database test;
CREATE DATABASE CREATE DATABASE
postgres=# postgres=#
</code></pre> </code></pre><h4 id="連接測試資料庫建立pg_prewarm-extension">連接測試資料庫、建立pg_prewarm extension</h4>
<h4 id="連接測試資料庫-建立pg-prewarm-extension">連接測試資料庫、建立pg_prewarm extension</h4>
<pre><code>postgres=# \c test ; <pre><code>postgres=# \c test ;
You are now connected to database &quot;test&quot; as user &quot;postgres&quot;. You are now connected to database &quot;test&quot; as user &quot;postgres&quot;.
test=# CREATE EXTENSION pg_prewarm; test=# CREATE EXTENSION pg_prewarm;
CREATE EXTENSION CREATE EXTENSION
test=# test=#
</code></pre> </code></pre><h4 id="建立測試資料表塞入500萬筆資料">建立測試資料表塞入500萬筆資料</h4>
<h4 id="建立測試資料表-塞入500萬筆資料">建立測試資料表塞入500萬筆資料</h4>
<pre><code>test=# \timing <pre><code>test=# \timing
Timing is on. Timing is on.
test=# CREATE TABLE test_tbl AS test=# CREATE TABLE test_tbl AS
@ -382,18 +357,11 @@ SELECT floor(random() * (9923123) + 1)::int FROM generate_series(1, 5000000) AS
SELECT 5000000 SELECT 5000000
Time: 2940.602 ms (00:02.941) Time: 2940.602 ms (00:02.941)
test=# test=#
</code></pre> </code></pre><h4 id="檢查看看剛剛建立的table-用了多少空間">檢查看看剛剛建立的table 用了多少空間</h4>
<h4 id="檢查看看剛剛建立的table-用了多少空間">檢查看看剛剛建立的table 用了多少空間</h4>
<p>哎呀,看起來用得不多啊</p> <p>哎呀,看起來用得不多啊</p>
<pre><code>test=# SELECT pg_size_pretty(pg_relation_size('test_tbl')); <pre><code>test=# SELECT pg_size_pretty(pg_relation_size('test_tbl'));
173 MB 173 MB
</code></pre> </code></pre><p><strong>玩大一點,塞個一億筆資料好了</strong></p>
<p><strong>玩大一點,塞個一億筆資料好了</strong></p>
<pre><code>test=# drop table test_tbl; <pre><code>test=# drop table test_tbl;
Time: 0.361 ms Time: 0.361 ms
test=# CREATE TABLE test_tbl AS test=# CREATE TABLE test_tbl AS
@ -407,12 +375,8 @@ pg_size_pretty | 3457 MB
Time: 0.589 ms Time: 0.589 ms
test=# test=#
</code></pre> </code></pre><p>現在資料庫長到3457MB了</p>
<p>現在資料庫長到3457MB了</p>
<p>先來執行一些初步的取得基本數據</p> <p>先來執行一些初步的取得基本數據</p>
<pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl; <pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl;
QUERY PLAN QUERY PLAN
------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------
@ -432,12 +396,8 @@ test=#
(END) (END)
</code></pre> </code></pre><p>可以看到打中buffer 的部份其實很少,只有 160 大部分都是讀進去buffer (442318)</p>
<p>可以看到打中buffer 的部份其實很少,只有 160 大部分都是讀進去buffer (442318)</p>
<p>來看看 buffer 的使用狀況</p> <p>來看看 buffer 的使用狀況</p>
<pre><code>test=# CREATE EXTENSION pg_buffercache; <pre><code>test=# CREATE EXTENSION pg_buffercache;
CREATE EXTENSION CREATE EXTENSION
test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered, test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered,
@ -465,12 +425,8 @@ test-# group by c.oid,c.relname order by 3 desc limit 10;
Time: 148.719 ms Time: 148.719 ms
test=# test=#
</code></pre> </code></pre><p>可以看到這個 test_tbl 只有0.5% 被撈到shared_buffers 裡面</p>
<p>可以看到這個 test_tbl 只有0.5% 被撈到shared_buffers 裡面</p>
<p>接下來就把這個table全部推到shared_buffers 裡面去</p> <p>接下來就把這個table全部推到shared_buffers 裡面去</p>
<pre><code>test=# select pg_prewarm('test_tbl','buffer'); <pre><code>test=# select pg_prewarm('test_tbl','buffer');
pg_prewarm pg_prewarm
------------ ------------
@ -479,10 +435,7 @@ test=#
Time: 1938.043 ms (00:01.938) Time: 1938.043 ms (00:01.938)
test=# test=#
</code></pre> </code></pre><p>然後再來看一次shared_buffers的使用狀況</p>
<p>然後再來看一次shared_buffers的使用狀況</p>
<pre><code>test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered, <pre><code>test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered,
round(100.0 * count(*) / ( round(100.0 * count(*) / (
select setting from pg_settings select setting from pg_settings
@ -508,18 +461,11 @@ group by c.oid,c.relname order by 3 desc limit 10;
Time: 2778.354 ms (00:02.778) Time: 2778.354 ms (00:02.778)
test=# test=#
</code></pre> </code></pre><p>OK ,可以看到 test_tbl 已經通通被載入 shared_buffers 中</p>
<p>OK ,可以看到 test_tbl 已經通通被載入 shared_buffers 中</p>
<p><strong>buffered 表示表格被載入shared_buffers的大小</strong></p> <p><strong>buffered 表示表格被載入shared_buffers的大小</strong></p>
<p><strong>buffer_percent 表示這個表格佔用多少shared_buffers 的比例</strong></p> <p><strong>buffer_percent 表示這個表格佔用多少shared_buffers 的比例</strong></p>
<p><strong>percent_of_relation 表示這個表格有多少比例被載入 shared_buffers</strong></p> <p><strong>percent_of_relation 表示這個表格有多少比例被載入 shared_buffers</strong></p>
<p>再來跑一次explain看看狀況</p> <p>再來跑一次explain看看狀況</p>
<pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl; <pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl;
Time: 3551.785 ms (00:03.552) Time: 3551.785 ms (00:03.552)
Finalize Aggregate (cost=755978.52..755978.53 rows=1 width=8) (actual time=3427.286..3427.287 rows=1 loops=1) Finalize Aggregate (cost=755978.52..755978.53 rows=1 width=8) (actual time=3427.286..3427.287 rows=1 loops=1)
@ -536,16 +482,10 @@ Time: 3551.785 ms (00:03.552)
Execution Time: 3551.365 ms Execution Time: 3551.365 ms
(12 rows) (12 rows)
</code></pre> </code></pre><p>這邊就可以看到都是從buffer 讀出來所以 hit=442478</p>
<p>這邊就可以看到都是從buffer 讀出來所以 hit=442478</p>
<p>看樣子表格還是太小,所以沒有完全發揮?那再來把表格加大!</p> <p>看樣子表格還是太小,所以沒有完全發揮?那再來把表格加大!</p>
<p>先重開一次 postgresql 清除buffer</p> <p>先重開一次 postgresql 清除buffer</p>
<p>然後重新建立表格</p> <p>然後重新建立表格</p>
<pre><code>test=# drop table test_tbl; <pre><code>test=# drop table test_tbl;
DROP TABLE DROP TABLE
Time: 297.493 ms Time: 297.493 ms
@ -554,10 +494,7 @@ test-# SELECT floor(random() * (993343) + 1)::int FROM generate_series(1, 300000
SELECT 300000000 SELECT 300000000
Time: 290660.607 ms (04:50.661) Time: 290660.607 ms (04:50.661)
test=# test=#
</code></pre> </code></pre><p>一樣,看看用了多少容量</p>
<p>一樣,看看用了多少容量</p>
<pre><code>test=# SELECT pg_size_pretty(pg_relation_size('test_tbl')); <pre><code>test=# SELECT pg_size_pretty(pg_relation_size('test_tbl'));
pg_size_pretty pg_size_pretty
---------------- ----------------
@ -566,12 +503,8 @@ test=#
Time: 0.474 ms Time: 0.474 ms
test=# test=#
</code></pre> </code></pre><p>哇哈哈用了10G ,這次還不撐爆你!</p>
<p>哇哈哈用了10G ,這次還不撐爆你!</p>
<p>跑explain 看看狀況</p> <p>跑explain 看看狀況</p>
<pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl; <pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl;
Time: 22909.065 ms (00:22.909) Time: 22909.065 ms (00:22.909)
@ -591,12 +524,8 @@ Time: 22909.065 ms (00:22.909)
Execution Time: 22908.571 ms Execution Time: 22908.571 ms
(12 rows) (12 rows)
</code></pre> </code></pre><p>看一下現在 shared_buffers 使用狀況</p>
<p>看一下現在 shared_buffers 使用狀況</p>
<p>可以看到這個 test_tbl 幾乎沒被放入 shared_buffers 中</p> <p>可以看到這個 test_tbl 幾乎沒被放入 shared_buffers 中</p>
<pre><code>test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered, <pre><code>test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered,
round(100.0 * count(*) / ( round(100.0 * count(*) / (
select setting from pg_settings select setting from pg_settings
@ -622,10 +551,7 @@ group by c.oid,c.relname order by 3 desc limit 10;
Time: 163.936 ms Time: 163.936 ms
test=# test=#
</code></pre> </code></pre><p>強制把test_tbl 全部塞進 shared_buffers</p>
<p>強制把test_tbl 全部塞進 shared_buffers</p>
<pre><code>test=# select pg_prewarm('test_tbl','buffer'); <pre><code>test=# select pg_prewarm('test_tbl','buffer');
pg_prewarm pg_prewarm
------------ ------------
@ -634,10 +560,7 @@ test=#
Time: 7472.805 ms (00:07.473) Time: 7472.805 ms (00:07.473)
test=# test=#
</code></pre> </code></pre><p>確認一下test_tbl 有沒有被整個塞進去</p>
<p>確認一下test_tbl 有沒有被整個塞進去</p>
<pre><code>test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered, <pre><code>test=# select c.relname,pg_size_pretty(count(*) * 8192) as buffered,
round(100.0 * count(*) / ( round(100.0 * count(*) / (
select setting from pg_settings select setting from pg_settings
@ -663,10 +586,7 @@ group by c.oid,c.relname order by 3 desc limit 10;
Time: 4985.366 ms (00:04.985) Time: 4985.366 ms (00:04.985)
test=# test=#
</code></pre> </code></pre><p>GOOD let&rsquo;s do explain again !</p>
<p>GOOD let&rsquo;s do explain again !</p>
<pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl; <pre><code>test=# explain (analyze,buffers) select count(*) from test_tbl;
Time: 11451.188 ms (00:11.451) Time: 11451.188 ms (00:11.451)
QUERY PLAN QUERY PLAN
@ -684,18 +604,11 @@ Time: 11451.188 ms (00:11.451)
Planning Time: 0.039 ms Planning Time: 0.039 ms
Execution Time: 11450.781 ms Execution Time: 11450.781 ms
(12 rows) (12 rows)
</code></pre> </code></pre><p>確認一下果然大部分都打到cache 了但是因為shared_buffers 不夠大,所以還會從磁碟讀取一部分</p>
<p>確認一下果然大部分都打到cache 了但是因為shared_buffers 不夠大,所以還會從磁碟讀取一部分</p>
<p>而且時間也比之前還沒塞進shared_buffers 的時候要快了不少</p> <p>而且時間也比之前還沒塞進shared_buffers 的時候要快了不少</p>
<p>22908.571 &ndash;&gt; 11450.781 ms</p> <p>22908.571 &ndash;&gt; 11450.781 ms</p>
<hr>
<hr />
<p>從這次的測試看來我想如果有足夠大的記憶體能夠把資料表都塞入shared_buffers 中</p> <p>從這次的測試看來我想如果有足夠大的記憶體能夠把資料表都塞入shared_buffers 中</p>
<p>應該可以帶來不錯的效能增幅!</p> <p>應該可以帶來不錯的效能增幅!</p>
</article> </article>
</div> </div>
@ -971,7 +884,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -983,7 +896,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 用rsync 移轉 centos 6.2的老機器 Transfer Cent6.2 using rsync", "name" : "[筆記] 用rsync 移轉 centos 6.2的老機器 Transfer Cent6.2 using rsync",
"headline" : "[筆記] 用rsync 移轉 centos 6.2的老機器 Transfer Cent6.2 using rsync", "headline" : "[筆記] 用rsync 移轉 centos 6.2的老機器 Transfer Cent6.2 using rsync",
"description" : "\x3cp\x3e公司的一台老伺服器空間不足了要執行指令都會中斷所以想要擴充空間。\x3c\/p\x3e\n\n\x3cp\x3e看起來不難搞事實上\x26hellip;..\x3c\/p\x3e", "description" : "\x3cp\x3e公司的一台老伺服器空間不足了要執行指令都會中斷所以想要擴充空間。\x3c\/p\x3e\n\x3cp\x3e看起來不難搞事實上\x26hellip;..\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,46 +305,28 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。</p> <p>公司的一台老伺服器空間不足了,要執行指令都會中斷,所以想要擴充空間。</p>
<p>看起來不難搞,事實上&hellip;..</p> <p>看起來不難搞,事實上&hellip;..</p>
<p>因為前人的功績,所以這台當初的磁碟分割有點「特別」!</p> <p>因為前人的功績,所以這台當初的磁碟分割有點「特別」!</p>
<p>實體硬碟是兩顆500G SATA</p> <p>實體硬碟是兩顆500G SATA</p>
<p>然後各切三個 partition (sda1/sda2/sda3 and sdb1/sdb2/sdb3)</p> <p>然後各切三個 partition (sda1/sda2/sda3 and sdb1/sdb2/sdb3)</p>
<p>sda2/sdb2 用250M 來組 raid1 (/dev/md0) 給 /boot 用</p> <p>sda2/sdb2 用250M 來組 raid1 (/dev/md0) 給 /boot 用</p>
<p>sda1/sdb1 各用40G 組raid1 (/dev/md1) 做成LVM 的VG ,然後再切出四個大小不同的分割</p> <p>sda1/sdb1 各用40G 組raid1 (/dev/md1) 做成LVM 的VG ,然後再切出四個大小不同的分割</p>
<pre><code>* / (sysvg-root) <pre><code>* / (sysvg-root)
* /usr (sysvg-usr) * /usr (sysvg-usr)
* /var (sysvg-var) * /var (sysvg-var)
* /tmp (sysvg-tmp) * /tmp (sysvg-tmp)
</code></pre> </code></pre><p>What the Fuck !?!? 然後最好笑的是40G的空間還留了2G可以讓後面的倒楣鬼(對,就是我)</p>
<p>What the Fuck !?!? 然後最好笑的是40G的空間還留了2G可以讓後面的倒楣鬼(對,就是我)</p>
<p>在碰到空間不足的問題時,還可以「擴充」</p> <p>在碰到空間不足的問題時,還可以「擴充」</p>
<p>然後剩下的sda3/sdb3 大概有四百多G空間一樣是組raid1 然後分割給這些目錄用</p> <p>然後剩下的sda3/sdb3 大概有四百多G空間一樣是組raid1 然後分割給這些目錄用</p>
<pre><code>* /data (datavg-datatest) (對的,沒有錯 真的叫 datavg-datatest媽的你test個鬼啊還在test的東西直接上線使用) <pre><code>* /data (datavg-datatest) (對的,沒有錯 真的叫 datavg-datatest媽的你test個鬼啊還在test的東西直接上線使用)
* /web (datavg-web) * /web (datavg-web)
* /www (datavg-www) * /www (datavg-www)
* /home (datavg-home) * /home (datavg-home)
</code></pre> </code></pre><p>幹!誰可以告訴我 www/web 的差異在哪裡?為什麼要特別切兩個分割給這兩個目錄用?</p>
<p>幹!誰可以告訴我 www/web 的差異在哪裡?為什麼要特別切兩個分割給這兩個目錄用?</p>
<p>快下班了,明天再來寫&hellip;</p> <p>快下班了,明天再來寫&hellip;</p>
<p>繼續補坑..</p> <p>繼續補坑..</p>
<p>先說結論,最後成功的作法如下</p> <p>先說結論,最後成功的作法如下</p>
<ul> <ul>
<li>加裝一顆512G SSD 到機器上</li> <li>加裝一顆512G SSD 到機器上</li>
<li>安裝作業系統(centos 6.2) 到 512G SSD裝完後用SSD開機進入系統後先補完一些套件(lvm2,rsync等等)</li> <li>安裝作業系統(centos 6.2) 到 512G SSD裝完後用SSD開機進入系統後先補完一些套件(lvm2,rsync等等)</li>
@ -360,335 +338,187 @@ if (!doNotTrack) {
<li>重新開機,祈禱可以開起來</li> <li>重新開機,祈禱可以開起來</li>
<li>進入系統後,測試相關程式</li> <li>進入系統後,測試相關程式</li>
</ul> </ul>
<p>這次的過程,踩了很多坑&hellip;</p> <p>這次的過程,踩了很多坑&hellip;</p>
<p>導致中間有一段時間一直在鑽牛角尖,想要把問題解掉,加上沒有適合的硬體,就連新買的 1TB SSD 也是地雷</p> <p>導致中間有一段時間一直在鑽牛角尖,想要把問題解掉,加上沒有適合的硬體,就連新買的 1TB SSD 也是地雷</p>
<p>所以花了三天才算成功</p> <p>所以花了三天才算成功</p>
<p>簡單紀錄一下碰到了哪些問題,以及對應的解決方式(如果有得解的話)..</p> <p>簡單紀錄一下碰到了哪些問題,以及對應的解決方式(如果有得解的話)..</p>
<h3 id="加裝兩顆硬碟後原系統無法使用">加裝兩顆硬碟後,原系統無法使用</h3>
<h3 id="加裝兩顆硬碟後-原系統無法使用">加裝兩顆硬碟後,原系統無法使用</h3>
<p>這個問題非常奇怪,因為空間不足嘛,所以很直接就想說加硬碟進去擴充空間好了。</p> <p>這個問題非常奇怪,因為空間不足嘛,所以很直接就想說加硬碟進去擴充空間好了。</p>
<p>結果加了兩顆500G SATA硬碟之後原有的系統雖然可以開機但是 SSH 沒有啟動</p> <p>結果加了兩顆500G SATA硬碟之後原有的系統雖然可以開機但是 SSH 沒有啟動</p>
<p>想說就登入檢查一下看看是什麼問題導致SSH起不來然後呢這邊就碰到第一個地雷了</p> <p>想說就登入檢查一下看看是什麼問題導致SSH起不來然後呢這邊就碰到第一個地雷了</p>
<h1 id="沒有人有root-密碼">沒有人有root 密碼!!!!</h1> <h1 id="沒有人有root-密碼">沒有人有root 密碼!!!!</h1>
<p>雖然有兩個帳號可以登入但是都是一般user ,不能做 sudo</p> <p>雖然有兩個帳號可以登入但是都是一般user ,不能做 sudo</p>
<p>可以做sudo的帳號沒有人知道密碼(因為都是用key登入)</p> <p>可以做sudo的帳號沒有人知道密碼(因為都是用key登入)</p>
<p>那用root 登入吧,結果手邊紀錄的密碼都是錯的</p> <p>那用root 登入吧,結果手邊紀錄的密碼都是錯的</p>
<p>好吧那進rescue mode 改密碼總可以吧?事情如果那麼簡單就好了!</p> <p>好吧那進rescue mode 改密碼總可以吧?事情如果那麼簡單就好了!</p>
<p>進rescue mode 之後,要執行 passwd ,就會出現</p> <p>進rescue mode 之後,要執行 passwd ,就會出現</p>
<pre><code> /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory <pre><code> /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
</code></pre> </code></pre><p>很奇怪吧,為什麼加硬碟進去,就會碰到這個問題?</p>
<p>很奇怪吧,為什麼加硬碟進去,就會碰到這個問題?</p>
<p>這兩顆新增的硬碟之前是用來測試 zfs 的,所以上面有切了 zfs 的分割</p> <p>這兩顆新增的硬碟之前是用來測試 zfs 的,所以上面有切了 zfs 的分割</p>
<p>就因為這樣所以會碰到這種詭異的狀況嗎? 不知道,不確定,不想面對&hellip;</p> <p>就因為這樣所以會碰到這種詭異的狀況嗎? 不知道,不確定,不想面對&hellip;</p>
<p>好,針對 bad ELF interpreter 的問題,網路上的解法都是重新安裝套件</p> <p>好,針對 bad ELF interpreter 的問題,網路上的解法都是重新安裝套件</p>
<p>BUT ..yes , there is always a &ldquo;BUT&rdquo;</p> <p>BUT ..yes , there is always a &ldquo;BUT&rdquo;</p>
<p>yum install glibc.i686 一樣出現上面的錯誤,所以無法安裝&hellip;.</p> <p>yum install glibc.i686 一樣出現上面的錯誤,所以無法安裝&hellip;.</p>
<p>很好,卡關&hellip;換下一招!</p> <p>很好,卡關&hellip;換下一招!</p>
<p>P.S 其實在這邊犯了個錯誤,既然新增硬碟進去出了問題</p> <p>P.S 其實在這邊犯了個錯誤,既然新增硬碟進去出了問題</p>
<p>那應該移除這兩顆新增的硬碟就可以先恢復原來的狀態(可開機運作,只是要執行程式會空間不足)</p> <p>那應該移除這兩顆新增的硬碟就可以先恢復原來的狀態(可開機運作,只是要執行程式會空間不足)</p>
<!-- raw HTML omitted -->
<hr> <h3 id="clonezilla-來源是raid時無法調整目標磁區的大小">clonezilla 來源是raid時無法調整目標磁區的大小</h3>
<h3 id="clonezilla-來源是raid時-無法調整目標磁區的大小">clonezilla 來源是raid時無法調整目標磁區的大小</h3>
<p>因為上面失敗了,所以現在每次調整時,我都會用 clonezilla 先做一份磁碟的備份</p> <p>因為上面失敗了,所以現在每次調整時,我都會用 clonezilla 先做一份磁碟的備份</p>
<p>但是因為clonezilla 在處理來源是raid 磁區時是用dd 慢慢寫入</p> <p>但是因為clonezilla 在處理來源是raid 磁區時是用dd 慢慢寫入</p>
<p>備份時間很久因為原本的raid 已經切了99%的空間出去給LVM</p> <p>備份時間很久因為原本的raid 已經切了99%的空間出去給LVM</p>
<p>所以clonezilla 看到的使用量就是99% 也因此每次備份幾乎就是要用dd 寫完500G的資料</p> <p>所以clonezilla 看到的使用量就是99% 也因此每次備份幾乎就是要用dd 寫完500G的資料</p>
<p>有興趣可以玩看看,在傳統硬碟上這樣做要花多少時間&hellip;</p> <p>有興趣可以玩看看,在傳統硬碟上這樣做要花多少時間&hellip;</p>
<p>然後我每次都要複製兩顆出來&hellip;</p> <p>然後我每次都要複製兩顆出來&hellip;</p>
<p>在使用clonezilla 的過程中突然想到clonezilla 可以動態調整目標磁區大小</p> <p>在使用clonezilla 的過程中突然想到clonezilla 可以動態調整目標磁區大小</p>
<p>前提是目標磁碟空間比來源空間大</p> <p>前提是目標磁碟空間比來源空間大</p>
<p>這個功能要進入 advanced mode 才會看到</p> <p>這個功能要進入 advanced mode 才會看到</p>
<p>興沖沖的改用這個選項複製&hellip;..結果還是一樣的大小&hellip;</p> <p>興沖沖的改用這個選項複製&hellip;..結果還是一樣的大小&hellip;</p>
<p>其實這個結果不算意外啦,算是一個小嘗試,如果有支援就算賺到</p> <p>其實這個結果不算意外啦,算是一個小嘗試,如果有支援就算賺到</p>
<p>沒有支援也就算了..</p> <p>沒有支援也就算了..</p>
<!-- raw HTML omitted -->
<hr> <h3 id="raid擴充成功但不是預期的容量">raid擴充「成功」但不是預期的容量</h3>
<h3 id="raid擴充-成功-但不是預期的容量">raid擴充「成功」但不是預期的容量</h3>
<p>磁碟對拷完,改用對拷的磁碟開機</p> <p>磁碟對拷完,改用對拷的磁碟開機</p>
<p>然後再加入兩顆 500G 的SATA硬碟 (怪的是這次加兩顆硬碟就不會造成系統SSH無法啟動)</p> <p>然後再加入兩顆 500G 的SATA硬碟 (怪的是這次加兩顆硬碟就不會造成系統SSH無法啟動)</p>
<p>經過一番手腳 (簡單說就是 mdadm 搭配 <code>--add</code> , <code>--remove</code> , <code>--grow</code> , <code>--raid-devices</code> 這幾個參數下去跑)</p> <p>經過一番手腳 (簡單說就是 mdadm 搭配 <code>--add</code> , <code>--remove</code> , <code>--grow</code> , <code>--raid-devices</code> 這幾個參數下去跑)</p>
<p>終於成功把新的硬碟給加入原有的RAID了</p> <p>終於成功把新的硬碟給加入原有的RAID了</p>
<p>但是一檢查容量, WTF !! 為什麼還是跟原本一樣?</p> <p>但是一檢查容量, WTF !! 為什麼還是跟原本一樣?</p>
<p>這邊就要說到 raid 的原理了,直接跳過,說結論</p> <p>這邊就要說到 raid 的原理了,直接跳過,說結論</p>
<p>如果是 raid1(mirror) ,至少兩顆硬碟這部份沒有問題</p> <p>如果是 raid1(mirror) ,至少兩顆硬碟這部份沒有問題</p>
<p>但是不管你再加多少顆硬碟進去這個raid他的容量「不會改變」「不會改變」「不會改變」</p> <p>但是不管你再加多少顆硬碟進去這個raid他的容量「不會改變」「不會改變」「不會改變」</p>
<p>依照某個外國人的解釋,就是下面這樣</p> <p>依照某個外國人的解釋,就是下面這樣</p>
<pre><code>RAID 1 is pure mirroring. No matter how many drives you add to RAID 1, the size never increases. What you increase is how many drives can fail and how good your read performance is. <pre><code>RAID 1 is pure mirroring. No matter how many drives you add to RAID 1, the size never increases. What you increase is how many drives can fail and how good your read performance is.
</code></pre> </code></pre><p>所以在原地擴充現有的mirror 空間不可行!</p>
<p>所以在原地擴充現有的mirror 空間不可行!</p>
<p>下一招擴充不可行那我改raid type 可以吧??</p> <p>下一招擴充不可行那我改raid type 可以吧??</p>
<!-- raw HTML omitted -->
<hr>
<h3 id="convert-raid1-to-raid5">convert raid1 to raid5</h3> <h3 id="convert-raid1-to-raid5">convert raid1 to raid5</h3>
<p>既然raid1 直接加硬碟不可行那我能不能加入硬碟之後把raid1 轉成 raid5 呢?</p> <p>既然raid1 直接加硬碟不可行那我能不能加入硬碟之後把raid1 轉成 raid5 呢?</p>
<p>理論上是可以的</p> <p>理論上是可以的</p>
<p>BUT &hellip;(沒錯還是這個BUT)</p> <p>BUT &hellip;(沒錯還是這個BUT)</p>
<p>我參考底下這篇,過程其實很順利</p> <p>我參考底下這篇,過程其實很順利</p>
<p><a href="https://stevesubuntutweaks.blogspot.com/2015/06/converting-raid1-array-to-raid5-using.html">https://stevesubuntutweaks.blogspot.com/2015/06/converting-raid1-array-to-raid5-using.html</a></p> <p><a href="https://stevesubuntutweaks.blogspot.com/2015/06/converting-raid1-array-to-raid5-using.html">https://stevesubuntutweaks.blogspot.com/2015/06/converting-raid1-array-to-raid5-using.html</a></p>
<p>但是只要我動到放boot 那組RAID重開機之後就完全沒有畫面&hellip;..</p> <p>但是只要我動到放boot 那組RAID重開機之後就完全沒有畫面&hellip;..</p>
<p>不會載入 grub 來開機所以我完全不知道發生了什麼事也沒辦法進grub 改 root 位置</p> <p>不會載入 grub 來開機所以我完全不知道發生了什麼事也沒辦法進grub 改 root 位置</p>
<p>用rescue mode 進去想修grub ,都出現 unknown file system</p> <p>用rescue mode 進去想修grub ,都出現 unknown file system</p>
<p>那不要動不就好了嗎?那這樣就要掛著一顆原本的舊硬碟來開機啊!什麼蠢方法啊!</p> <p>那不要動不就好了嗎?那這樣就要掛著一顆原本的舊硬碟來開機啊!什麼蠢方法啊!</p>
<p>所以,失敗!&hellip;.</p> <p>所以,失敗!&hellip;.</p>
<p>不過我覺得這個方式應該是比較可行的才對,或許會再找虛擬機來測試看看</p> <p>不過我覺得這個方式應該是比較可行的才對,或許會再找虛擬機來測試看看</p>
<!-- raw HTML omitted -->
<hr>
<h3 id="migrate-system-using-rsync">migrate system using rsync</h3> <h3 id="migrate-system-using-rsync">migrate system using rsync</h3>
<p>正所謂事不過三,前面都失敗三次了(已經花了兩天多的時間)</p> <p>正所謂事不過三,前面都失敗三次了(已經花了兩天多的時間)</p>
<p>不能再這樣搞下去了</p> <p>不能再這樣搞下去了</p>
<p>這次改用之前就用過的「正統」解決方式</p> <p>這次改用之前就用過的「正統」解決方式</p>
<ul> <ul>
<li>卸除原本主機上的所有硬碟並新增一顆512G 的SSD</li> <li>卸除原本主機上的所有硬碟並新增一顆512G 的SSD</li>
<li>在新增的512G SSD上安裝一樣的作業系統(CentOS 6.2)</li>
<li><p>在新增的512G SSD上安裝一樣的作業系統(CentOS 6.2)</p>
<pre><code>這邊也有地雷...不知道為什麼CentOS 6.2 的ISO我用easy2boot 作到隨身碟上
安裝過程出現CDROM not FOUND的錯誤。好那我用光碟片開機總可以吧
BUT (又是你啊BUT兄 )
在安裝時一樣出現CDROM not FOUND , WTF !!
最後是透過用網路安裝的方式
指定URL到 http://vault.centos.org/6.2/os/x86_64 來進行安裝
而且一開始因為6.2裝不起來所以我改用centos 6.10 的ISO作到隨身碟進行安裝
這樣子安裝就可以,可是最後從原本硬碟把資料抄回來後,會不能開機
會有 /bin/awk too many links 類似這樣的錯誤訊息
總之,還是要想辦法裝回一樣的作業系統
</code></pre></li>
<li><p>系統安裝完成,關機,接上原本主機的一顆硬碟,準備把資料抄回來</p>
<pre><code>如果會怕可以用ubuntu 18.04 live DVD 開機,然後先安裝 mdadm
接著執行 mdadm --assemble --scan 偵測原本的RAID
這時候雖然會抓到RAID但是因為上面是LVM 所以沒辦法直接掛進來
需要再執行一次 vgchange -ay
原本的lvm 磁區,就會出現在 /dev/mapper 裡面
再執行 mount /dev/mapper/sysvg-usr /mnt 把目錄掛進來
</code></pre></li>
<li><p>分次掛載原本的目錄然後sync 回SSD</p>
<pre><code>我是直接在系統內操作沒有透過liveDVD
先備份 /etc , /usr
然後就看原本LVM切了幾個每一個都mount 進來然後把資料用rsync 抄回對應的路徑底下就好
抄完之後,把備份出來的 /etc.bak/fstab 複製回 /etc
這樣才能正常開機
</code></pre></li>
<li><p>重開機</p>
<pre><code>正常的話,這時候重開機應該是可以進入系統
接著就是請同事確認環境、指令是否可以執行
然後修改一些像是目錄權限, uid,gid 等等的問題
基本上系統這樣就轉完了
</code></pre></li>
</ul> </ul>
<pre><code> 這邊也有地雷...不知道為什麼CentOS 6.2 的ISO我用easy2boot 作到隨身碟上
<hr> 安裝過程出現CDROM not FOUND的錯誤。好那我用光碟片開機總可以吧
BUT (又是你啊BUT兄 )
在安裝時一樣出現CDROM not FOUND , WTF !!
最後是透過用網路安裝的方式
指定URL到 http://vault.centos.org/6.2/os/x86_64 來進行安裝
而且一開始因為6.2裝不起來所以我改用centos 6.10 的ISO作到隨身碟進行安裝
這樣子安裝就可以,可是最後從原本硬碟把資料抄回來後,會不能開機
會有 /bin/awk too many links 類似這樣的錯誤訊息
總之,還是要想辦法裝回一樣的作業系統
</code></pre><ul>
<li>系統安裝完成,關機,接上原本主機的一顆硬碟,準備把資料抄回來</li>
</ul>
<pre><code> 如果會怕可以用ubuntu 18.04 live DVD 開機,然後先安裝 mdadm
接著執行 mdadm --assemble --scan 偵測原本的RAID
這時候雖然會抓到RAID但是因為上面是LVM 所以沒辦法直接掛進來
需要再執行一次 vgchange -ay
原本的lvm 磁區,就會出現在 /dev/mapper 裡面
再執行 mount /dev/mapper/sysvg-usr /mnt 把目錄掛進來
</code></pre><ul>
<li>分次掛載原本的目錄然後sync 回SSD</li>
</ul>
<pre><code> 我是直接在系統內操作沒有透過liveDVD
先備份 /etc , /usr
然後就看原本LVM切了幾個每一個都mount 進來然後把資料用rsync 抄回對應的路徑底下就好
抄完之後,把備份出來的 /etc.bak/fstab 複製回 /etc
這樣才能正常開機
</code></pre><ul>
<li>重開機</li>
</ul>
<pre><code> 正常的話,這時候重開機應該是可以進入系統
接著就是請同事確認環境、指令是否可以執行
然後修改一些像是目錄權限, uid,gid 等等的問題
基本上系統這樣就轉完了
</code></pre><!-- raw HTML omitted -->
<h3 id="地雷產品">地雷產品</h3> <h3 id="地雷產品">地雷產品</h3>
<p>在這過程中因為本來想直接做線上升級到1TB的空間所以買了兩個 TCELL TT550 960G SSD 來用</p> <p>在這過程中因為本來想直接做線上升級到1TB的空間所以買了兩個 TCELL TT550 960G SSD 來用</p>
<p><img src="https://i.imgur.com/94hPMJG.png" alt="TCELL TT550 960G SSD"></p>
<p><img src="https://i.imgur.com/94hPMJG.png" alt="TCELL TT550 960G SSD" /></p>
<p>結果因為線上升級失敗改用rsync來做所以就把這兩顆SSD用 mdadm 組成raid1 來做系統</p> <p>結果因為線上升級失敗改用rsync來做所以就把這兩顆SSD用 mdadm 組成raid1 來做系統</p>
<p>安裝過程沒什麼問題,但是在從舊硬碟抄資料回來的時候,發現速度很慢,而且會有卡住的情況</p> <p>安裝過程沒什麼問題,但是在從舊硬碟抄資料回來的時候,發現速度很慢,而且會有卡住的情況</p>
<p><a href="https://www.youtube.com/watch?v=NOIyRFit64k">https://www.youtube.com/watch?v=NOIyRFit64k</a></p> <p><a href="https://www.youtube.com/watch?v=NOIyRFit64k">https://www.youtube.com/watch?v=NOIyRFit64k</a></p>
<p>從影片中可以看到,一開始複製檔案時,速度會往下掉,然後又慢慢爬上來,中間還會卡住</p> <p>從影片中可以看到,一開始複製檔案時,速度會往下掉,然後又慢慢爬上來,中間還會卡住</p>
<p>另一台用的是創見 S370 512G SSD 一顆 (MLC) ,這台就不會有這種問題</p> <p>另一台用的是創見 S370 512G SSD 一顆 (MLC) ,這台就不會有這種問題</p>
<p>但是用Crystal Disk Mark 去測試這顆SSD ,速度又是正常 (4xx/3xx)</p> <p>但是用Crystal Disk Mark 去測試這顆SSD ,速度又是正常 (4xx/3xx)</p>
<p>不知道是不是因為做RAID的關係或者是linux 的影響?</p> <p>不知道是不是因為做RAID的關係或者是linux 的影響?</p>
<p>總之最後這兩顆SSD 就被我退貨了&hellip;</p> <p>總之最後這兩顆SSD 就被我退貨了&hellip;</p>
<p>話說我跟TCELL似乎犯衝啊&hellip;</p> <p>話說我跟TCELL似乎犯衝啊&hellip;</p>
<p>上次買的4K EVO 64G隨身碟也是速度很慢跑了一次RMA換新的回來才正常</p> <p>上次買的4K EVO 64G隨身碟也是速度很慢跑了一次RMA換新的回來才正常</p>
<p>這次的960G SSD ($2999) 又有這種問題</p> <p>這次的960G SSD ($2999) 又有這種問題</p>
<p>看來下次要好好「評估」了..</p> <p>看來下次要好好「評估」了..</p>
<!-- raw HTML omitted -->
<hr>
<h3 id="測試raid1轉raid5擴充空間">測試raid1轉raid5擴充空間</h3> <h3 id="測試raid1轉raid5擴充空間">測試raid1轉raid5擴充空間</h3>
<p>前面有提到如果沒有LVM的話我應該可以很輕易的加入兩顆硬碟到原有的raid1然後就直接擴充容量</p> <p>前面有提到如果沒有LVM的話我應該可以很輕易的加入兩顆硬碟到原有的raid1然後就直接擴充容量</p>
<p>不過操作失敗了,但是我一直覺得這個應該很容易解決才對</p> <p>不過操作失敗了,但是我一直覺得這個應該很容易解決才對</p>
<p>所以我開了一台VM來做測試</p> <p>所以我開了一台VM來做測試</p>
<p>OS: Ubuntu 18.04 Server x64 <p>OS: Ubuntu 18.04 Server x64
HDD: 16G vmdisk x4</p> HDD: 16G vmdisk x4</p>
<p>一開始安裝時就在安裝程式內設定一組raid1 (/dev/vda, /dev/vdb)然後把系統灌在這個raid device上</p> <p>一開始安裝時就在安裝程式內設定一組raid1 (/dev/vda, /dev/vdb)然後把系統灌在這個raid device上</p>
<p>安裝完成後,先進入系統確認一下現在的狀態</p> <p>安裝完成後,先進入系統確認一下現在的狀態</p>
<p><img src="https://i.imgur.com/KDix5IJ.png" alt=""></p>
<p><img src="https://i.imgur.com/KDix5IJ.png" alt="" /></p>
<p>可以看到有一個raid1 的磁區,由 /dev/vda1 , /dev/vdb1 組成raid-devices:2 Array Size: 16765952 (15.99 GiB)</p> <p>可以看到有一個raid1 的磁區,由 /dev/vda1 , /dev/vdb1 組成raid-devices:2 Array Size: 16765952 (15.99 GiB)</p>
<p>然後還有兩個磁碟沒有用到 (/dev/vdc , /dev/vdd)</p> <p>然後還有兩個磁碟沒有用到 (/dev/vdc , /dev/vdd)</p>
<p>接著為了進行模擬測試,先拍個快照,然後改用 ubuntu 18.04 Desktop 的ISO開機</p> <p>接著為了進行模擬測試,先拍個快照,然後改用 ubuntu 18.04 Desktop 的ISO開機</p>
<p>進入系統後,要先開啟 terminal 來安裝 mdadm</p> <p>進入系統後,要先開啟 terminal 來安裝 mdadm</p>
<pre><code>apt install mdadm -y <pre><code>apt install mdadm -y
</code></pre> </code></pre><p><img src="https://i.imgur.com/0tnEdW5.png" alt="install mdadm in ubuntu 18.04 liveDVD"></p>
<p><img src="https://i.imgur.com/0tnEdW5.png" alt="install mdadm in ubuntu 18.04 liveDVD" /></p>
<p>然後把剛剛看到的兩顆還沒用到的磁碟切分割加入RAID內</p> <p>然後把剛剛看到的兩顆還沒用到的磁碟切分割加入RAID內</p>
<p>或者可以直接用sfdisk 從原有的磁碟抄partition table過來</p> <p>或者可以直接用sfdisk 從原有的磁碟抄partition table過來</p>
<p>我直接用 sfdisk 抄比較快,底下的指令是抄 vda 的partition table 到 vdc和 vdd</p> <p>我直接用 sfdisk 抄比較快,底下的指令是抄 vda 的partition table 到 vdc和 vdd</p>
<pre><code>sfdisk -d /dev/vda | sfdisk /dev/vdc <pre><code>sfdisk -d /dev/vda | sfdisk /dev/vdc
sfdisk -d /dev/vda | sfdisk /dev/vdd sfdisk -d /dev/vda | sfdisk /dev/vdd
</code></pre> </code></pre><p><img src="https://i.imgur.com/mlikld4.png" alt="sfdisk copt partition table"></p>
<p><img src="https://i.imgur.com/mlikld4.png" alt="sfdisk copt partition table" /></p>
<p>然後檢查一下是不是正確</p> <p>然後檢查一下是不是正確</p>
<pre><code>fdisk -l /dev/vdc <pre><code>fdisk -l /dev/vdc
fdisk -l /dev/vdd fdisk -l /dev/vdd
</code></pre> </code></pre><p><img src="https://i.imgur.com/5qQNLbu.png" alt="check result after sfdisk"></p>
<p><img src="https://i.imgur.com/5qQNLbu.png" alt="check result after sfdisk" /></p>
<p>再來就偵測原來的RAID然後加入兩個剛剛做出來的分割到raid群組內</p> <p>再來就偵測原來的RAID然後加入兩個剛剛做出來的分割到raid群組內</p>
<p>接著就直接把raid1轉成raid5然後把raid-devices:2 改成 4看一下狀態</p> <p>接著就直接把raid1轉成raid5然後把raid-devices:2 改成 4看一下狀態</p>
<p>可以看到在把raid-devices 提升到4顆之後原有的raid 就會開始進行reshape (不是rebuild唷)</p> <p>可以看到在把raid-devices 提升到4顆之後原有的raid 就會開始進行reshape (不是rebuild唷)</p>
<pre><code>mdadm --assemble --scan <pre><code>mdadm --assemble --scan
mdadm --add /dev/md0 /dev/vdc1 /dev/vdd1 mdadm --add /dev/md0 /dev/vdc1 /dev/vdd1
mdadm --grow /dev/md0 --level=5 mdadm --grow /dev/md0 --level=5
mdadm --grow /dev/md0 --raid-devices=4 mdadm --grow /dev/md0 --raid-devices=4
cat /proc/mdstat cat /proc/mdstat
</code></pre> </code></pre><p><img src="https://i.imgur.com/dxwQC0v.png" alt="convert raid1 to raid5 procedure"></p>
<p><img src="https://i.imgur.com/dxwQC0v.png" alt="convert raid1 to raid5 procedure" /></p>
<p>耐心等待raid reshape 跑完要一點時間我只用16G的磁碟來測試也要跑個七八分鐘左右</p> <p>耐心等待raid reshape 跑完要一點時間我只用16G的磁碟來測試也要跑個七八分鐘左右</p>
<p>不敢想像如果是幾TB的空間要跑多久&hellip;</p> <p>不敢想像如果是幾TB的空間要跑多久&hellip;</p>
<p>等上面的程序跑完後再看一下raid狀態就會看到原有的RAID空間變大了磁碟變多了心情變好了考試也都考100分了</p> <p>等上面的程序跑完後再看一下raid狀態就會看到原有的RAID空間變大了磁碟變多了心情變好了考試也都考100分了</p>
<p><img src="https://i.imgur.com/7E2qL8Q.png" alt="check raid status after reshape"></p>
<p><img src="https://i.imgur.com/7E2qL8Q.png" alt="check raid status after reshape" /></p>
<p>本來想說已經完成了興沖沖的把raid 掛進來看一下空間卻還是16G ?????</p> <p>本來想說已經完成了興沖沖的把raid 掛進來看一下空間卻還是16G ?????</p>
<pre><code>mount /dev/md0p1 /mnt <pre><code>mount /dev/md0p1 /mnt
df -h df -h
</code></pre> </code></pre><p><img src="https://i.imgur.com/ILjDN1g.png" alt="raid space still 16G"></p>
<p><img src="https://i.imgur.com/ILjDN1g.png" alt="raid space still 16G" /></p>
<p>其實這邊我一直沒搞懂,文章都說你就跑 e2fsck 檢查一次,然後跑 resize2fs 放大就結束了</p> <p>其實這邊我一直沒搞懂,文章都說你就跑 e2fsck 檢查一次,然後跑 resize2fs 放大就結束了</p>
<p>問題是,我這樣做沒用&hellip;</p> <p>問題是,我這樣做沒用&hellip;</p>
<p><img src="https://i.imgur.com/ij2AGw7.png" alt="raid not expand after e2fsck and resize2fs"></p>
<p><img src="https://i.imgur.com/ij2AGw7.png" alt="raid not expand after e2fsck and resize2fs" /></p>
<p>最後我是直接請出 gparted 來做</p> <p>最後我是直接請出 gparted 來做</p>
<p>叫出 gparted 之後可以直接看到剛剛增加的空間沒有被放到原有的raid</p> <p>叫出 gparted 之後可以直接看到剛剛增加的空間沒有被放到原有的raid</p>
<p>那就直接 resize吧</p> <p>那就直接 resize吧</p>
<p><img src="https://i.imgur.com/qLQMRAe.png" alt="unallocated space in gparted"></p>
<p><img src="https://i.imgur.com/qLQMRAe.png" alt="unallocated space in gparted" /></p>
<p>gparted resize 太簡單了&hellip;直接用拉的就好了</p> <p>gparted resize 太簡單了&hellip;直接用拉的就好了</p>
<p><img src="https://i.imgur.com/KAs3gwu.png" alt="resize partition in gparted"></p>
<p><img src="https://i.imgur.com/KAs3gwu.png" alt="resize partition in gparted" /></p>
<p>好,都做完了,重開機見真章!看看到底有沒有成功?</p> <p>好,都做完了,重開機見真章!看看到底有沒有成功?</p>
<p><img src="https://i.imgur.com/uGzxA9t.png" alt="check result after reboot"></p>
<p><img src="https://i.imgur.com/uGzxA9t.png" alt="check result after reboot" /></p>
<p>空間順利放大了,打完收工!</p> <p>空間順利放大了,打完收工!</p>
<p>我想以後如果又碰到一樣的狀況,大概就會用最後這個方式處理吧!</p> <p>我想以後如果又碰到一樣的狀況,大概就會用最後這個方式處理吧!</p>
</article> </article>
</div> </div>
@ -966,7 +796,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -978,7 +808,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "Transfer File Content Using Xclip in Terminal", "name" : "Transfer File Content Using Xclip in Terminal",
"headline" : "Transfer File Content Using Xclip in Terminal", "headline" : "Transfer File Content Using Xclip in Terminal",
"description" : "\x3cp\x3e工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。\x3c\/p\x3e\n\n\x3cp\x3e以前都是傻傻的用 scp 傳檔案\x3c\/p\x3e\n\n\x3cp\x3e之前就記得有這個xclip\/xsel 可以用,但是一直沒有弄清楚怎麼執行\x3c\/p\x3e\n\n\x3cp\x3e早上研究了一下順便做個筆記。\x3c\/p\x3e", "description" : "\x3cp\x3e工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。\x3c\/p\x3e\n\x3cp\x3e以前都是傻傻的用 scp 傳檔案\x3c\/p\x3e\n\x3cp\x3e之前就記得有這個xclip\/xsel 可以用,但是一直沒有弄清楚怎麼執行\x3c\/p\x3e\n\x3cp\x3e早上研究了一下順便做個筆記。\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,22 +305,13 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。</p> <p>工作上常會需要用ssh登入遠端主機檢查LOG有必要的時候還要把log複製回本機來處理。</p>
<p>以前都是傻傻的用 scp 傳檔案</p> <p>以前都是傻傻的用 scp 傳檔案</p>
<p>之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行</p> <p>之前就記得有這個xclip/xsel 可以用,但是一直沒有弄清楚怎麼執行</p>
<p>早上研究了一下,順便做個筆記。</p> <p>早上研究了一下,順便做個筆記。</p>
<h3 id="1-ssh-要加上--x-">1. ssh 要加上 -X</h3>
<h3 id="1-ssh-要加上-x">1. ssh 要加上 -X</h3>
<p>不然會出現</p> <p>不然會出現</p>
<pre><code>Error: Can't open display: (null) <pre><code>Error: Can't open display: (null)
</code></pre> </code></pre><p>這種錯誤訊息</p>
<p>這種錯誤訊息</p>
<pre><code>-X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file. <pre><code>-X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file.
X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X
@ -333,10 +320,7 @@ if (!doNotTrack) {
For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the
ForwardX11Trusted directive in ssh_config(5) for more information. ForwardX11Trusted directive in ssh_config(5) for more information.
</code></pre> </code></pre><h3 id="2-remote-主機要安裝-xclip--xsel-">2. remote 主機要安裝 xclip / xsel</h3>
<h3 id="2-remote-主機要安裝-xclip-xsel">2. remote 主機要安裝 xclip / xsel</h3>
<pre><code>2019-05-17 10:12:20 [minion@hqs019 ~]$ sudo apt install xsel <pre><code>2019-05-17 10:12:20 [minion@hqs019 ~]$ sudo apt install xsel
Reading package lists... Done Reading package lists... Done
Building dependency tree Building dependency tree
@ -372,12 +356,8 @@ Preparing to unpack .../xclip_0.12+svn84-4build1_amd64.deb ...
Unpacking xclip (0.12+svn84-4build1) ... Unpacking xclip (0.12+svn84-4build1) ...
Setting up xclip (0.12+svn84-4build1) ... Setting up xclip (0.12+svn84-4build1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
</code></pre> </code></pre><h3 id="3執行方式">3.執行方式</h3>
<h3 id="3-執行方式">3.執行方式</h3>
<p>執行以下指令,就可以把遠端的檔案內容傳送到「系統剪貼簿」,在本機就可以直接貼上了</p> <p>執行以下指令,就可以把遠端的檔案內容傳送到「系統剪貼簿」,在本機就可以直接貼上了</p>
<pre><code>cat copy_neonexus.csv |xclip -selection clipboard <pre><code>cat copy_neonexus.csv |xclip -selection clipboard
</code></pre> </code></pre>
</article> </article>
@ -654,7 +634,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -666,7 +646,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在 Ubuntu 1404 Preseed 加入開機後自動發郵件通知安裝完成", "name" : "[筆記] 在 Ubuntu 1404 Preseed 加入開機後自動發郵件通知安裝完成",
"headline" : "[筆記] 在 Ubuntu 1404 Preseed 加入開機後自動發郵件通知安裝完成", "headline" : "[筆記] 在 Ubuntu 1404 Preseed 加入開機後自動發郵件通知安裝完成",
"description" : "\x3cp\x3e這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04\x3c\/p\x3e\n\n\x3cp\x3e在安裝完成後會發出郵件通知管理者已經安裝完成\x3c\/p\x3e\n\n\x3cp\x3e可是某次ansible 更新之後,反而沒辦法安裝完成\x3c\/p\x3e\n\n\x3cp\x3e這次順手修改一下同時更新了ansible 的template\x3c\/p\x3e", "description" : "\x3cp\x3e這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04\x3c\/p\x3e\n\x3cp\x3e在安裝完成後會發出郵件通知管理者已經安裝完成\x3c\/p\x3e\n\x3cp\x3e可是某次ansible 更新之後,反而沒辦法安裝完成\x3c\/p\x3e\n\x3cp\x3e這次順手修改一下同時更新了ansible 的template\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,15 +305,10 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04</p> <p>這是之前做過的taskclient透過pxe開機後會自動安裝ubuntu 14.04</p>
<p>在安裝完成後,會發出郵件通知管理者已經安裝完成</p> <p>在安裝完成後,會發出郵件通知管理者已經安裝完成</p>
<p>可是某次ansible 更新之後,反而沒辦法安裝完成</p> <p>可是某次ansible 更新之後,反而沒辦法安裝完成</p>
<p>這次順手修改一下同時更新了ansible 的template</p> <p>這次順手修改一下同時更新了ansible 的template</p>
<p>###os-ubuntu-1404-desktop-preseed.cfg</p> <p>###os-ubuntu-1404-desktop-preseed.cfg</p>
<pre><code>### Localization <pre><code>### Localization
# Keyboard selection. # Keyboard selection.
@ -735,7 +726,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -747,7 +738,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "Ubuntu 1804 Install Root on Raid", "name" : "Ubuntu 1804 Install Root on Raid",
"headline" : "Ubuntu 1804 Install Root on Raid", "headline" : "Ubuntu 1804 Install Root on Raid",
"description" : "\x3cp\x3e最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上\x3c\/p\x3e\n\n\x3cp\x3e因為新開的機器大部分都是在proxmox上所以很少碰實體機器了\x3c\/p\x3e\n\n\x3cp\x3e結果在安裝過程中做raid碰到一些問題來紀錄一下\x3c\/p\x3e", "description" : "\x3cp\x3e最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上\x3c\/p\x3e\n\x3cp\x3e因為新開的機器大部分都是在proxmox上所以很少碰實體機器了\x3c\/p\x3e\n\x3cp\x3e結果在安裝過程中做raid碰到一些問題來紀錄一下\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,137 +305,72 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上</p> <p>最近在弄一台機器想要把ubuntu 18.04 安裝在software raid上</p>
<p>因為新開的機器大部分都是在proxmox上所以很少碰實體機器了</p> <p>因為新開的機器大部分都是在proxmox上所以很少碰實體機器了</p>
<p>結果在安裝過程中做raid碰到一些問題來紀錄一下</p> <p>結果在安裝過程中做raid碰到一些問題來紀錄一下</p>
<p>要先說明 Ubuntu 提供的ISO類型這會牽涉到後續裝raid</p> <p>要先說明 Ubuntu 提供的ISO類型這會牽涉到後續裝raid</p>
<p>底下這是ubuntu 網頁上的ISO列表</p> <p>底下這是ubuntu 網頁上的ISO列表</p>
<p><img src="https://i.imgur.com/32JIHL0.png" alt="ubuntu iso list"></p>
<p><img src="https://i.imgur.com/32JIHL0.png" alt="ubuntu iso list" /></p>
<p>大致上分為 Desktop/live-server 兩種</p> <p>大致上分為 Desktop/live-server 兩種</p>
<p>因為我要裝的是server所以我一開始當然是選live-server</p> <p>因為我要裝的是server所以我一開始當然是選live-server</p>
<p>但是用這個ISO開機要設定software raid時會出現警告訊息</p> <p>但是用這個ISO開機要設定software raid時會出現警告訊息</p>
<p>提示不可以把所有的分割區都指定給 RAID/LVM ,這樣會沒有地方可以放 /boot</p> <p>提示不可以把所有的分割區都指定給 RAID/LVM ,這樣會沒有地方可以放 /boot</p>
<p>錯誤如圖</p> <p>錯誤如圖</p>
<p><img src="https://i.imgur.com/uhSpn6w.png" alt="create root on raid error"></p>
<p><img src="https://i.imgur.com/uhSpn6w.png" alt="create root on raid error" /></p>
<p>所以我很「鄉愿」的,那就切一個/boot 給它用,算是暫時解決這問題 XD</p> <p>所以我很「鄉愿」的,那就切一個/boot 給它用,算是暫時解決這問題 XD</p>
<p>但是這樣的作法,總有一天會出事</p> <p>但是這樣的作法,總有一天會出事</p>
<p>因為如果這個 /boot 掛了雖然底下的系統有做mirror</p> <p>因為如果這個 /boot 掛了雖然底下的系統有做mirror</p>
<p>但還是不能開機那這樣做raid根本沒有意義啊</p> <p>但還是不能開機那這樣做raid根本沒有意義啊</p>
<p>所以研究了兩天,發現一個很重要的事情</p> <p>所以研究了兩天,發現一個很重要的事情</p>
<p>我根本就抓錯ISO了啊</p> <p>我根本就抓錯ISO了啊</p>
<p>會這樣想是因為中間有其他task在裝debian9</p> <p>會這樣想是因為中間有其他task在裝debian9</p>
<p>一開始也是抓live-dvd版本</p> <p>一開始也是抓live-dvd版本</p>
<p>但是這個版本沒有辦法自訂要安裝哪些套件所以預設安裝完會包含windows manager、office、字型等等</p> <p>但是這個版本沒有辦法自訂要安裝哪些套件所以預設安裝完會包含windows manager、office、字型等等</p>
<p>加起來總共5.x G &hellip;.</p> <p>加起來總共5.x G &hellip;.</p>
<p>然後我還要手動移除這些套件,這不是脫褲子放屁嗎?</p> <p>然後我還要手動移除這些套件,這不是脫褲子放屁嗎?</p>
<p>翻了一下google發現是因為ISO的關係要去下載netinst的ISO</p> <p>翻了一下google發現是因為ISO的關係要去下載netinst的ISO</p>
<p>才能在安裝過程中自訂套件</p> <p>才能在安裝過程中自訂套件</p>
<p>從這邊延伸到ubuntu的問題</p> <p>從這邊延伸到ubuntu的問題</p>
<p>會不會是我也抓錯ISO了呢</p> <p>會不會是我也抓錯ISO了呢</p>
<p>再次google相關訊息果然ubuntu也有類似的netboot ISO</p> <p>再次google相關訊息果然ubuntu也有類似的netboot ISO</p>
<p><img src="https://i.imgur.com/G2ImxhQ.png" alt="ubuntu mini iso"></p>
<p><img src="https://i.imgur.com/G2ImxhQ.png" alt="ubuntu mini iso" /></p>
<p>檔案很小只有60M左右趕快下載來安裝</p> <p>檔案很小只有60M左右趕快下載來安裝</p>
<p>這次果然可以在安裝過程中順利設定software raid並且掛載在 / 根目錄底下進行安裝</p> <p>這次果然可以在安裝過程中順利設定software raid並且掛載在 / 根目錄底下進行安裝</p>
<h2 id="but--對永遠少不了這個but">BUT &hellip;. 對永遠少不了這個BUT</h2>
<h2 id="but-對-永遠少不了這個but">BUT &hellip;. 對永遠少不了這個BUT</h2>
<p>安裝過程會卡住&hellip;</p> <p>安裝過程會卡住&hellip;</p>
<p><img src="https://i.imgur.com/FpWsjsO.png" alt="ubuntu install with mini iso hangs"></p>
<p><img src="https://i.imgur.com/FpWsjsO.png" alt="ubuntu install with mini iso hangs" /></p>
<p>卡在這邊幾個小時了,都不會動</p> <p>卡在這邊幾個小時了,都不會動</p>
<p>我在猜可能是mirror site 有問題,所以抓套件抓不到就卡住了?</p> <p>我在猜可能是mirror site 有問題,所以抓套件抓不到就卡住了?</p>
<p>一直卡著也不是辦法於是又去ubuntu官網看了一下發現有另外一個server的 ISO</p> <p>一直卡著也不是辦法於是又去ubuntu官網看了一下發現有另外一個server的 ISO</p>
<p>這個叫 &ldquo;Alternative Ubuntu Server installer&rdquo;</p> <p>這個叫 &ldquo;Alternative Ubuntu Server installer&rdquo;</p>
<p>在官網的這個位置</p> <p>在官網的這個位置</p>
<p><a href="https://www.ubuntu.com/download/alternative-downloads">https://www.ubuntu.com/download/alternative-downloads</a></p> <p><a href="https://www.ubuntu.com/download/alternative-downloads">https://www.ubuntu.com/download/alternative-downloads</a></p>
<p><img src="https://i.imgur.com/n0E1ea3.png" alt="Alternative Ubuntu Server Installer"></p>
<p><img src="https://i.imgur.com/n0E1ea3.png" alt="Alternative Ubuntu Server Installer" /></p>
<p>進入後,會有個列表,找到 server amd64 的ISO這個才是正確的</p> <p>進入後,會有個列表,找到 server amd64 的ISO這個才是正確的</p>
<p>和第一次不同的是,這個沒有&quot;live&rdquo; ,很重要!</p>
<p>和第一次不同的是,這個沒有&rdquo;live&rdquo; ,很重要!</p> <p><img src="https://i.imgur.com/c4GTujY.png" alt="Ubuntu alternative-downloads"></p>
<p><img src="https://i.imgur.com/c4GTujY.png" alt="Ubuntu alternative-downloads" /></p>
<p>用這個ISO開機就可以正常的做出software raid並且指定安裝作業系統也不會有卡住的狀況</p> <p>用這個ISO開機就可以正常的做出software raid並且指定安裝作業系統也不會有卡住的狀況</p>
<p>做出來的系統磁區大概是這樣 <p>做出來的系統磁區大概是這樣
<img src="https://i.imgur.com/dyWIH7E.png" alt="ubuntu root on software raid" /></p> <img src="https://i.imgur.com/dyWIH7E.png" alt="ubuntu root on software raid"></p>
<p>這台VM的硬碟是透過10G網卡連到一個四塊Sandisk 240G SSD 組成的raid0空間</p> <p>這台VM的硬碟是透過10G網卡連到一個四塊Sandisk 240G SSD 組成的raid0空間</p>
<p>順便看一下速度 <p>順便看一下速度
<img src="https://i.imgur.com/V9WwIOC.png" alt="10g nfs storage performance" /></p> <img src="https://i.imgur.com/V9WwIOC.png" alt="10g nfs storage performance"></p>
<p>10G就是快就是爽</p> <p>10G就是快就是爽</p>
<p>爽完之後,還是要確認一下&hellip; 首先先執行 sudo dpkg-reconfigure grub-pc</p> <p>爽完之後,還是要確認一下&hellip; 首先先執行 sudo dpkg-reconfigure grub-pc</p>
<p>看看是不是兩顆硬碟都有裝 grub ,這樣萬一有一顆硬碟故障,另一顆才能啟動</p> <p>看看是不是兩顆硬碟都有裝 grub ,這樣萬一有一顆硬碟故障,另一顆才能啟動</p>
<p><img src="https://i.imgur.com/7xAcCbz.png" alt="dpkg-reconfigure grub-pc"></p>
<p><img src="https://i.imgur.com/7xAcCbz.png" alt="dpkg-reconfigure grub-pc" /></p>
<p>看來因為是在安裝過程中就指定了要把系統裝在raid上所以ubuntu很聰明的也自動把grub裝在兩顆硬碟上了</p> <p>看來因為是在安裝過程中就指定了要把系統裝在raid上所以ubuntu很聰明的也自動把grub裝在兩顆硬碟上了</p>
<p>來試試看拔掉一顆硬碟還能不能正常運作</p> <p>來試試看拔掉一顆硬碟還能不能正常運作</p>
<p>直接在proxmox 管理界面中detach 一顆硬碟</p> <p>直接在proxmox 管理界面中detach 一顆硬碟</p>
<p><img src="https://i.imgur.com/lLFcdk0.png" alt="detach one of mirror raid"></p>
<p><img src="https://i.imgur.com/lLFcdk0.png" alt="detach one of mirror raid" /></p>
<p>果然報錯誤了</p> <p>果然報錯誤了</p>
<p><img src="https://i.imgur.com/1SFdVA0.png" alt="mirror raid failed"></p>
<p><img src="https://i.imgur.com/1SFdVA0.png" alt="mirror raid failed" /></p>
<p>重開機看看,也沒有問題,可以順利開機!</p> <p>重開機看看,也沒有問題,可以順利開機!</p>
<p>開機過程有看到raid 只剩下一顆在運作的訊息</p> <p>開機過程有看到raid 只剩下一顆在運作的訊息</p>
<p><img src="https://i.imgur.com/oZNIN4D.png" alt="mirror raid work with one disk only"></p>
<p><img src="https://i.imgur.com/oZNIN4D.png" alt="mirror raid work with one disk only" /></p>
<p>再來把硬碟加回去</p> <p>再來把硬碟加回去</p>
<p>然後用mdadm 指令加入分割區raid就會開始rebuid了</p> <p>然後用mdadm 指令加入分割區raid就會開始rebuid了</p>
<p><img src="https://i.imgur.com/3nu2Ij8.png" alt="mdadm rebuild raid"></p>
<p><img src="https://i.imgur.com/3nu2Ij8.png" alt="mdadm rebuild raid" /></p>
<p>所以如果有打算要做software raid來安裝ubuntu 作業系統的一開始就要選對ISO</p> <p>所以如果有打算要做software raid來安裝ubuntu 作業系統的一開始就要選對ISO</p>
<p>才不會白忙那麼多時間啊!</p> <p>才不會白忙那麼多時間啊!</p>
</article> </article>
</div> </div>
@ -717,7 +648,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -729,7 +660,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] ubuntu 18.04 preseeds ", "name" : "[筆記] ubuntu 18.04 preseeds ",
"headline" : "[筆記] ubuntu 18.04 preseeds ", "headline" : "[筆記] ubuntu 18.04 preseeds ",
"description" : "\x3cp\x3eubuntu 18.04 預設移掉了 \/etc\/rc.local 的功能\x3c\/p\x3e\n\n\x3cp\x3e變成要用 systemd 的方式來運作,可是有點難用…\x3c\/p\x3e\n\n\x3cp\x3e紀錄一下步驟再來研究怎麼整合到 preseed 裡面\x3c\/p\x3e", "description" : "\x3cp\x3eubuntu 18.04 預設移掉了 \/etc\/rc.local 的功能\x3c\/p\x3e\n\x3cp\x3e變成要用 systemd 的方式來運作,可是有點難用…\x3c\/p\x3e\n\x3cp\x3e紀錄一下步驟再來研究怎麼整合到 preseed 裡面\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,15 +305,10 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>ubuntu 18.04 預設移掉了 /etc/rc.local 的功能</p> <p>ubuntu 18.04 預設移掉了 /etc/rc.local 的功能</p>
<p>變成要用 systemd 的方式來運作,可是有點難用…</p> <p>變成要用 systemd 的方式來運作,可是有點難用…</p>
<p>紀錄一下步驟,再來研究怎麼整合到 preseed 裡面</p> <p>紀錄一下步驟,再來研究怎麼整合到 preseed 裡面</p>
<h3 id="1-建立-rc-localservice">1. 建立 rc-local.service</h3>
<h3 id="1-建立-rc-local-service">1. 建立 rc-local.service</h3> <h4 id="sudo-vi-etcsystemdsystemrc-localservice">sudo vi /etc/systemd/system/rc-local.service</h4>
<h4 id="sudo-vi-etc-systemd-system-rc-local-service">sudo vi /etc/systemd/system/rc-local.service</h4>
<pre><code>[Unit] <pre><code>[Unit]
Description=/etc/rc.local Compatibility Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local ConditionPathExists=/etc/rc.local
@ -332,20 +323,12 @@ SysVStartPriority=99
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
</code></pre> </code></pre><h3 id="2-建立-rclocalbak">2. 建立 rc.local.bak</h3>
<h3 id="2-建立-rc-local-bak">2. 建立 rc.local.bak</h3>
<p>這個檔案的作用是我只需要client在PXE 裝完系統後的第一次開機會發通知信件</p> <p>這個檔案的作用是我只需要client在PXE 裝完系統後的第一次開機會發通知信件</p>
<p>所以如果一直保留著 /etc/rc.local 的變動,就變成每次開機都會送出信件</p> <p>所以如果一直保留著 /etc/rc.local 的變動,就變成每次開機都會送出信件</p>
<p>因此,需要先保留原本的 rc.local</p> <p>因此,需要先保留原本的 rc.local</p>
<p>在送出通知信件之後,就用原來的 rc.local 蓋掉修改過的 rc.local</p> <p>在送出通知信件之後,就用原來的 rc.local 蓋掉修改過的 rc.local</p>
<h4 id="sudo-vi-etcrclocalbak">sudo vi /etc/rc.local.bak</h4>
<h4 id="sudo-vi-etc-rc-local-bak">sudo vi /etc/rc.local.bak</h4>
<pre><code>#!/bin/sh -e <pre><code>#!/bin/sh -e
# #
# rc.local # rc.local
@ -361,12 +344,8 @@ WantedBy=multi-user.target
exit 0 exit 0
</code></pre> </code></pre><h3 id="3-建立-rclocal">3. 建立 rc.local</h3>
<h4 id="sudo-vi-etcrclocal">sudo vi /etc/rc.local</h4>
<h3 id="3-建立-rc-local">3. 建立 rc.local</h3>
<h4 id="sudo-vi-etc-rc-local">sudo vi /etc/rc.local</h4>
<pre><code>#!/bin/sh -e <pre><code>#!/bin/sh -e
# #
# rc.local # rc.local
@ -384,22 +363,12 @@ hostname|mail -s pxe_install_complete changch@abc.com
cp /etc/rc.local.bak /etc/rc.local cp /etc/rc.local.bak /etc/rc.local
exit 0 exit 0
</code></pre> </code></pre><h3 id="4-修改-rclocal-permission">4. 修改 rc.local permission</h3>
<h3 id="4-修改-rc-local-permission">4. 修改 rc.local permission</h3>
<pre><code>sudo chmod +x /etc/rc.local <pre><code>sudo chmod +x /etc/rc.local
</code></pre> </code></pre><h3 id="5-啟用-rc-local-service">5. 啟用 rc-local service</h3>
<h3 id="5-啟用-rc-local-service">5. 啟用 rc-local service</h3>
<pre><code>sudo systemctl enable rc-local <pre><code>sudo systemctl enable rc-local
</code></pre> </code></pre><hr>
<hr />
<p>ubuntu 18.04 preseeds files</p> <p>ubuntu 18.04 preseeds files</p>
<pre><code># Title: Ubuntu 18.04 preseed.cfg <pre><code># Title: Ubuntu 18.04 preseed.cfg
# #
# File: templates/os-ubuntu-1804-amd64-preseed.cfg # File: templates/os-ubuntu-1804-amd64-preseed.cfg
@ -823,7 +792,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -835,7 +804,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] ubuntu 18.04 透過 dconf 修改系統 proxy \/ modify system proxy with dconf in ubuntu 18.04", "name" : "[筆記] ubuntu 18.04 透過 dconf 修改系統 proxy \/ modify system proxy with dconf in ubuntu 18.04",
"headline" : "[筆記] ubuntu 18.04 透過 dconf 修改系統 proxy \/ modify system proxy with dconf in ubuntu 18.04", "headline" : "[筆記] ubuntu 18.04 透過 dconf 修改系統 proxy \/ modify system proxy with dconf in ubuntu 18.04",
"description" : "\x3cp\x3e最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04\x3c\/p\x3e\n\n\x3cp\x3e因為公司政策的關係所以現在要連接internet ,需要申請\x3c\/p\x3e\n\n\x3cp\x3e然後 user 再去系統的proxy 設定新增一個 PAC 檔\x3c\/p\x3e\n\n\x3cp\x3e但是這個動作其實是去叫NetworkManager 這個服務\x3c\/p\x3e\n\n\x3cp\x3e可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定\x3c\/p\x3e\n\n\x3cp\x3e所以想試試看有沒有辦法不使用 NetworkManager 服務\x3c\/p\x3e\n\n\x3cp\x3e又能夠在 user level 修改 proxy 參數\x3c\/p\x3e\n\n\x3cp\x3e就想到了用 dconf 來做\x3c\/p\x3e", "description" : "\x3cp\x3e最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04\x3c\/p\x3e\n\x3cp\x3e因為公司政策的關係所以現在要連接internet ,需要申請\x3c\/p\x3e\n\x3cp\x3e然後 user 再去系統的proxy 設定新增一個 PAC 檔\x3c\/p\x3e\n\x3cp\x3e但是這個動作其實是去叫NetworkManager 這個服務\x3c\/p\x3e\n\x3cp\x3e可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定\x3c\/p\x3e\n\x3cp\x3e所以想試試看有沒有辦法不使用 NetworkManager 服務\x3c\/p\x3e\n\x3cp\x3e又能夠在 user level 修改 proxy 參數\x3c\/p\x3e\n\x3cp\x3e就想到了用 dconf 來做\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,67 +305,35 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04</p> <p>最近在準備升級client 的作業系統,從 ubuntu 14.04 準備升級到 18.04 或明年的 20.04</p>
<p>因為公司政策的關係所以現在要連接internet ,需要申請</p> <p>因為公司政策的關係所以現在要連接internet ,需要申請</p>
<p>然後 user 再去系統的proxy 設定新增一個 PAC 檔</p> <p>然後 user 再去系統的proxy 設定新增一個 PAC 檔</p>
<p>但是這個動作其實是去叫NetworkManager 這個服務</p> <p>但是這個動作其實是去叫NetworkManager 這個服務</p>
<p>可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定</p> <p>可是在18.04 上我會把這個服務關掉因為他會干擾我的DNS設定</p>
<p>所以想試試看有沒有辦法不使用 NetworkManager 服務</p> <p>所以想試試看有沒有辦法不使用 NetworkManager 服務</p>
<p>又能夠在 user level 修改 proxy 參數</p> <p>又能夠在 user level 修改 proxy 參數</p>
<p>就想到了用 dconf 來做</p> <p>就想到了用 dconf 來做</p>
<p>dconf 是在 ubuntu 底下很好用的工具</p> <p>dconf 是在 ubuntu 底下很好用的工具</p>
<p>可以用來觀察、修改使用者層級(user level)的系統設定\</p>
<p>可以用來觀察、修改使用者層級(user level)的系統設定</p>
<p>不過有一些語法要注意</p> <p>不過有一些語法要注意</p>
<p>簡單說一下用法</p> <p>簡單說一下用法</p>
<p>觀察user level 系統變數的變化</p> <p>觀察user level 系統變數的變化</p>
<p>開啟terminal 輸入以下指令</p> <p>開啟terminal 輸入以下指令</p>
<pre><code>dconf watch / <pre><code>dconf watch /
</code></pre> </code></pre><p>這個可以觀察user到底修改了些什麼</p>
<p>這個可以觀察user到底修改了些什麼</p>
<p>只要是透過右上角的系統設定修改的值</p> <p>只要是透過右上角的系統設定修改的值</p>
<p>這個指令都可以觀察到,非常好用</p> <p>這個指令都可以觀察到,非常好用</p>
<p>當找到了要修改的 KEY</p> <p>當找到了要修改的 KEY</p>
<p>就可以用</p> <p>就可以用</p>
<pre><code>dconf read/write KEY <pre><code>dconf read/write KEY
</code></pre> </code></pre><p>比如說我要修改proxy</p>
<p>比如說我要修改proxy</p>
<p>我先用 dconf watch / 抓到了KEY是 /system/proxy/host</p> <p>我先用 dconf watch / 抓到了KEY是 /system/proxy/host</p>
<p>那我就可以用</p> <p>那我就可以用</p>
<pre><code>dconf write /system/proxy/http/host &quot;'192.168.1.7'&quot; <pre><code>dconf write /system/proxy/http/host &quot;'192.168.1.7'&quot;
dconf write /system/proxy/http/port '3128' dconf write /system/proxy/http/port '3128'
</code></pre> </code></pre><p>來把系統的http proxy 改成 192.168.1.7:3128</p>
<p>來把系統的http proxy 改成 192.168.1.7:3128</p>
<p>要注意的是,上面的 host 是字串,要用<code>&quot;''&quot;</code>包起來</p> <p>要注意的是,上面的 host 是字串,要用<code>&quot;''&quot;</code>包起來</p>
<p>下面的只是數字,就不用外面的<code>&quot;&quot;</code></p> <p>下面的只是數字,就不用外面的<code>&quot;&quot;</code></p>
<p>不過這修改好像還是必須要NetworkManager 生效才行</p> <p>不過這修改好像還是必須要NetworkManager 生效才行</p>
<p>還需要再測試看看</p> <p>還需要再測試看看</p>
</article> </article>
</div> </div>
@ -645,7 +609,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -657,7 +621,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "Ubuntu 18.04 Kernel 4.15.0-106 Unable to Start Wireguard Interface", "name" : "Ubuntu 18.04 Kernel 4.15.0-106 Unable to Start Wireguard Interface",
"headline" : "Ubuntu 18.04 Kernel 4.15.0-106 Unable to Start Wireguard Interface", "headline" : "Ubuntu 18.04 Kernel 4.15.0-106 Unable to Start Wireguard Interface",
"description" : "\x3cp\x3e工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)\x3c\/p\x3e\n\n\x3cp\x3e結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了\x3c\/p\x3e\n\n\x3cp\x3e手動下指令也啟動不了\x3c\/p\x3e\n\n\x3cp\x3e查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包\x3c\/p\x3e\n\n\x3cp\x3e看來就連kernel 最好都不要自動升級\x26hellip;\x3c\/p\x3e", "description" : "\x3cp\x3e工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)\x3c\/p\x3e\n\x3cp\x3e結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了\x3c\/p\x3e\n\x3cp\x3e手動下指令也啟動不了\x3c\/p\x3e\n\x3cp\x3e查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包\x3c\/p\x3e\n\x3cp\x3e看來就連kernel 最好都不要自動升級\x26hellip;\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,17 +305,11 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)</p> <p>工作用的電腦昨天終於難得的reboot了(uptime 看了一下,大概是三百多天)</p>
<p>結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了</p> <p>結果重開機之後發現原本在打tunnel 連 ptt 的 wireguard VPN 掛掉了</p>
<p>手動下指令也啟動不了</p> <p>手動下指令也啟動不了</p>
<p>查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包</p> <p>查了一下發現是 ubuntu 18.04 kernel 4.15.0-106 的包</p>
<p>看來就連kernel 最好都不要自動升級&hellip;</p> <p>看來就連kernel 最好都不要自動升級&hellip;</p>
<p>一開始不管怎麼下指令要啟動wireguard Interface 都會出錯</p> <p>一開始不管怎麼下指令要啟動wireguard Interface 都會出錯</p>
<pre><code>root@hqdc034:~# wg-quick up wg0 <pre><code>root@hqdc034:~# wg-quick up wg0
[#] ip link add wg0 type wireguard [#] ip link add wg0 type wireguard
RTNETLINK answers: Operation not supported RTNETLINK answers: Operation not supported
@ -332,32 +322,18 @@ RTNETLINK answers: Operation not supported
Unable to access interface: Protocol not supported Unable to access interface: Protocol not supported
[#] ip link delete dev wg1 [#] ip link delete dev wg1
Cannot find device &quot;wg1&quot; Cannot find device &quot;wg1&quot;
</code></pre> </code></pre><p>因為很久沒動了所以wireguard config 檔案應該是沒有問題</p>
<p>因為很久沒動了所以wireguard config 檔案應該是沒有問題</p>
<p>不過還是檢查看看?</p> <p>不過還是檢查看看?</p>
<pre><code>root@hqdc034:~# wg showconf wg0 <pre><code>root@hqdc034:~# wg showconf wg0
Unable to access interface: Protocol not supported Unable to access interface: Protocol not supported
</code></pre> </code></pre><p>很好果然不是config 的問題看來是wireguard 某些套件有狀況了</p>
<p>很好果然不是config 的問題看來是wireguard 某些套件有狀況了</p>
<p>用modprobe 檢查一下</p> <p>用modprobe 檢查一下</p>
<pre><code>root@hqdc034:~# modprobe wireguard <pre><code>root@hqdc034:~# modprobe wireguard
modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.15.0-106-generic modprobe: FATAL: Module wireguard not found in directory /lib/modules/4.15.0-106-generic
</code></pre> </code></pre><p>OK 找到問題了看起來是新版本的kernel 有某些狀況?</p>
<p>OK 找到問題了看起來是新版本的kernel 有某些狀況?</p>
<p>anyway</p> <p>anyway</p>
<p>要解決其實很簡單,要不就直接上 20.04 XD</p> <p>要解決其實很簡單,要不就直接上 20.04 XD</p>
<p>要不就重裝 wireguard-dkms (這個似乎是新釋出的套件,本來沒有這個的)</p> <p>要不就重裝 wireguard-dkms (這個似乎是新釋出的套件,本來沒有這個的)</p>
<pre><code>root@hqdc034:~# apt-get install wireguard-dkms wireguard-tools linux-headers-$(uname -r) <pre><code>root@hqdc034:~# apt-get install wireguard-dkms wireguard-tools linux-headers-$(uname -r)
正在讀取套件清單... 完成 正在讀取套件清單... 完成
正在重建相依關係 正在重建相依關係
@ -425,10 +401,7 @@ depmod...
DKMS: install completed. DKMS: install completed.
Updating loolwsd systemplate Updating loolwsd systemplate
</code></pre> </code></pre><p>跑完之後重起wireguard interface 就 OK 了</p>
<p>跑完之後重起wireguard interface 就 OK 了</p>
<pre><code>root@hqdc034:~# wg-quick up wg0 <pre><code>root@hqdc034:~# wg-quick up wg0
[#] ip link add wg0 type wireguard [#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63 [#] wg setconf wg0 /dev/fd/63
@ -747,7 +720,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -759,7 +732,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 在 ubuntu 20.04 底下用certbot 透過Cloudflare 申請全域的 Letsencrypt 憑證", "name" : "[筆記] 在 ubuntu 20.04 底下用certbot 透過Cloudflare 申請全域的 Letsencrypt 憑證",
"headline" : "[筆記] 在 ubuntu 20.04 底下用certbot 透過Cloudflare 申請全域的 Letsencrypt 憑證", "headline" : "[筆記] 在 ubuntu 20.04 底下用certbot 透過Cloudflare 申請全域的 Letsencrypt 憑證",
"description" : "\x3cp\x3e之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題\x3c\/p\x3e\n\n\x3cp\x3e也不用煩惱怎麼去更新一堆有的沒的\x3c\/p\x3e\n\n\x3cp\x3e不過實際應用上還是偶爾會拿這些憑證檔案來用的狀況\x3c\/p\x3e\n\n\x3cp\x3e雖然可以從caddy 上面取得這些檔案\x3c\/p\x3e\n\n\x3cp\x3e但是基本上這些檔案都是綁定一個特定的hostname\x3c\/p\x3e\n\n\x3cp\x3e可是我想要有一個憑證可以給同網域底下的機器用 ( Wildcard certificates )\x3c\/p\x3e", "description" : "\x3cp\x3e之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題\x3c\/p\x3e\n\x3cp\x3e也不用煩惱怎麼去更新一堆有的沒的\x3c\/p\x3e\n\x3cp\x3e不過實際應用上還是偶爾會拿這些憑證檔案來用的狀況\x3c\/p\x3e\n\x3cp\x3e雖然可以從caddy 上面取得這些檔案\x3c\/p\x3e\n\x3cp\x3e但是基本上這些檔案都是綁定一個特定的hostname\x3c\/p\x3e\n\x3cp\x3e可是我想要有一個憑證可以給同網域底下的機器用 ( Wildcard certificates )\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -24,7 +24,7 @@
"datePublished": "2020-09-02 15:55:40 \x2b0800 CST", "datePublished": "2020-09-02 15:55:40 \x2b0800 CST",
"dateModified" : "2020-09-02 15:55:40 \x2b0800 CST", "dateModified" : "2020-09-02 15:55:40 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/post\/ubuntu-letsencrypt-cloudflare-wildcard\/", "url" : "https:\/\/h.cowbay.org\/post\/ubuntu-letsencrypt-cloudflare-wildcard\/",
"wordCount" : "471", "wordCount" : "469",
"image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-4.jpg"", "image" : "https://h.cowbay.orghttps://h.cowbay.org/images/post-default-4.jpg"",
"keywords" : [ ""certbot"",""Cloudflare"",""Letsencrypt"","Blog" ] "keywords" : [ ""certbot"",""Cloudflare"",""Letsencrypt"","Blog" ]
} }
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,80 +305,43 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題</p> <p>之前用caddy 作為反向代理其中一個優勢就是caddy 會自動處理Letsencrypt 憑證的問題</p>
<p>也不用煩惱怎麼去更新一堆有的沒的</p> <p>也不用煩惱怎麼去更新一堆有的沒的</p>
<p>不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況</p> <p>不過,實際應用上,還是偶爾會拿這些憑證檔案來用的狀況</p>
<p>雖然可以從caddy 上面取得這些檔案</p> <p>雖然可以從caddy 上面取得這些檔案</p>
<p>但是基本上這些檔案都是綁定一個特定的hostname</p> <p>但是基本上這些檔案都是綁定一個特定的hostname</p>
<p>可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )</p> <p>可是我想要有一個憑證,可以給同網域底下的機器用 ( Wildcard certificates )</p>
<p>要申請Wildcard certificates ,必須要採用 DNS 驗證的方式</p> <p>要申請Wildcard certificates ,必須要採用 DNS 驗證的方式</p>
<p>一般手動操作的步驟,會先產生一組亂數字串,然後更新 DNS 上面去</p> <p>一般手動操作的步驟,會先產生一組亂數字串,然後更新 DNS 上面去</p>
<p>如果要改成自動化,要多一些步驟</p> <p>如果要改成自動化,要多一些步驟</p>
<h3 id="安裝-certbot-及-cloudflare-外掛">安裝 certbot 及 Cloudflare 外掛</h3> <h3 id="安裝-certbot-及-cloudflare-外掛">安裝 certbot 及 Cloudflare 外掛</h3>
<p>首先,先來安裝會用到的套件</p> <p>首先,先來安裝會用到的套件</p>
<pre><code>sudo apt install certbot letsencrypt python3-certbot-dns-cloudflare <pre><code>sudo apt install certbot letsencrypt python3-certbot-dns-cloudflare
</code></pre> </code></pre><h3 id="設定-cloudflare-api">設定 cloudflare API</h3>
<h3 id="設定-cloudflare-api">設定 cloudflare API</h3>
<p>這個步驟我測了好久網路上的說明似乎都過期了造成cloudflare API 那邊會發生錯誤</p> <p>這個步驟我測了好久網路上的說明似乎都過期了造成cloudflare API 那邊會發生錯誤</p>
<p>先登入 cloudflare 管理界面的API token 設定</p> <p>先登入 cloudflare 管理界面的API token 設定</p>
<p><a href="https://dash.cloudflare.com/profile/api-tokens">https://dash.cloudflare.com/profile/api-tokens</a></p> <p><a href="https://dash.cloudflare.com/profile/api-tokens">https://dash.cloudflare.com/profile/api-tokens</a></p>
<p>建立一組token</p> <p>建立一組token</p>
<p>內容如下</p> <p>內容如下</p>
<p><img src="'https://i.imgur.com/3dZN6qC.png'" alt="&lsquo;cloudflare API&rsquo;"></p>
<p>![&lsquo;cloudflare API&rsquo;](&lsquo;<a href="https://i.imgur.com/3dZN6qC.png'">https://i.imgur.com/3dZN6qC.png'</a>)</p>
<p>在權限設定的地方,選擇三個項目</p> <p>在權限設定的地方,選擇三個項目</p>
<p>zone-zone settings-edit <p>zone-zone settings-edit
zone-zone-edit zone-zone-edit
zone-DNS-edit</p> zone-DNS-edit</p>
<p>在下一個 zone resources 選擇 include-All zones</p> <p>在下一個 zone resources 選擇 include-All zones</p>
<p>存檔後會產生一組 API token ,接著就是用這組 token 來做DNS更新</p> <p>存檔後會產生一組 API token ,接著就是用這組 token 來做DNS更新</p>
<h3 id="編輯-cloudflare-設定檔">編輯 cloudflare 設定檔</h3> <h3 id="編輯-cloudflare-設定檔">編輯 cloudflare 設定檔</h3>
<p>在 /etc底下新增一個 cloudflare.ini</p> <p>在 /etc底下新增一個 cloudflare.ini</p>
<p>內容如下</p> <p>內容如下</p>
<pre><code>sudo vim /etc/cloudflare.ini <pre><code>sudo vim /etc/cloudflare.ini
dns_cloudflare_email = #email@address.here dns_cloudflare_email = #email@address.here
dns_cloudflare_api_key = #API token here dns_cloudflare_api_key = #API token here
</code></pre> </code></pre><p>存檔後離開然後改一下權限不然等一下certbot 會跳警告</p>
<p>存檔後離開然後改一下權限不然等一下certbot 會跳警告</p>
<pre><code>sudo chmod 0600 /etc/cloudflare.ini <pre><code>sudo chmod 0600 /etc/cloudflare.ini
</code></pre> </code></pre><h3 id="執行certbot-取得憑證">執行certbot 取得憑證</h3>
<h3 id="執行certbot-取得憑證">執行certbot 取得憑證</h3>
<p>執行以下的指令</p> <p>執行以下的指令</p>
<pre><code>sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare.ini --preferred-challenges=dns --email admin@abc.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d abc.com -d *.abc.com <pre><code>sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare.ini --preferred-challenges=dns --email admin@abc.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d abc.com -d *.abc.com
</code></pre> </code></pre><p>正常的話,會是這樣的結果</p>
<p>正常的話,會是這樣的結果</p>
<pre><code>sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare.ini --preferred-challenges=dns --email admin@abc.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d abc.com -d *.abc.com <pre><code>sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare.ini --preferred-challenges=dns --email admin@abc.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d abc.com -d *.abc.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log Saving debug log to /var/log/letsencrypt/letsencrypt.log
@ -409,12 +368,8 @@ IMPORTANT NOTES:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le Donating to EFF: https://eff.org/donate-le
</code></pre> </code></pre><p>這樣子就取得了全域通用的SSL 憑證檔案</p>
<p>這樣子就取得了全域通用的SSL 憑證檔案</p>
<p>如果看到底下這種錯誤</p> <p>如果看到底下這種錯誤</p>
<pre><code>administrator@ubuntu:~$ sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare.ini --preferred-challenges=dns --email admin@abc.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d abc.com -d *.abc.com <pre><code>administrator@ubuntu:~$ sudo certbot certonly --dns-cloudflare --dns-cloudflare-credentials /etc/cloudflare.ini --preferred-challenges=dns --email admin@abc.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d abc.com -d *.abc.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator dns-cloudflare, Installer None Plugins selected: Authenticator dns-cloudflare, Installer None
@ -424,14 +379,9 @@ dns-01 challenge for abc.com
dns-01 challenge for abc.com dns-01 challenge for abc.com
Cleaning up challenges Cleaning up challenges
Error determining zone_id: 6003 Invalid request headers. Please confirm that you have supplied valid Cloudflare API credentials. (Did you copy your entire API key?) Error determining zone_id: 6003 Invalid request headers. Please confirm that you have supplied valid Cloudflare API credentials. (Did you copy your entire API key?)
</code></pre> </code></pre><p>那就是cloudflare API 那邊的權限設定錯了,我就是在這邊卡很久&hellip;</p>
<p>那就是cloudflare API 那邊的權限設定錯了,我就是在這邊卡很久&hellip;</p>
<p>請參照上面的步驟和圖片正確的設定</p> <p>請參照上面的步驟和圖片正確的設定</p>
<p>可以用 certbot certificates 來驗證看看</p> <p>可以用 certbot certificates 來驗證看看</p>
<pre><code>administrator@ubuntu:~$ sudo certbot certificates <pre><code>administrator@ubuntu:~$ sudo certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log Saving debug log to /var/log/letsencrypt/letsencrypt.log
@ -443,23 +393,14 @@ Found the following certs:
Certificate Path: /etc/letsencrypt/live/abc.com/fullchain.pem Certificate Path: /etc/letsencrypt/live/abc.com/fullchain.pem
Private Key Path: /etc/letsencrypt/live/abc.com/privkey.pem Private Key Path: /etc/letsencrypt/live/abc.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
</code></pre> </code></pre><p>之後就可以用</p>
<p>之後就可以用</p>
<pre><code>sudo certbot renew <pre><code>sudo certbot renew
</code></pre> </code></pre><p>來更新憑證</p>
<p>來更新憑證</p>
<p>寫到/etc/crontab 去排程每個月的1號自動更新</p> <p>寫到/etc/crontab 去排程每個月的1號自動更新</p>
<pre><code>administrator@ubuntu:~$ echo &quot;* * 1 * * root /usr/bin/certbot renew&quot; |sudo tee -a /etc/crontab <pre><code>administrator@ubuntu:~$ echo &quot;* * 1 * * root /usr/bin/certbot renew&quot; |sudo tee -a /etc/crontab
* * 1 * * root /usr/bin/certbot renew * * 1 * * root /usr/bin/certbot renew
administrator@ubuntu:~$ administrator@ubuntu:~$
</code></pre> </code></pre><p>接下來就等三個月之後,檢查看看憑證是否有自動更新了!</p>
<p>接下來就等三個月之後,檢查看看憑證是否有自動更新了!</p>
</article> </article>
</div> </div>
@ -738,7 +679,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -750,7 +691,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

@ -13,7 +13,7 @@
"articleSection" : "post", "articleSection" : "post",
"name" : "[筆記] 幾種可以自建服務的 File Sharing 系統比較", "name" : "[筆記] 幾種可以自建服務的 File Sharing 系統比較",
"headline" : "[筆記] 幾種可以自建服務的 File Sharing 系統比較", "headline" : "[筆記] 幾種可以自建服務的 File Sharing 系統比較",
"description" : "\x3cp\x3e感覺最近應該會用到類似這樣的功能趁著最近比較閒一點\x3c\/p\x3e\n\n\x3cp\x3e就把系統弄起來玩玩看順便建立ansible 的playbook\x3c\/p\x3e", "description" : "\x3cp\x3e感覺最近應該會用到類似這樣的功能趁著最近比較閒一點\x3c\/p\x3e\n\x3cp\x3e就把系統弄起來玩玩看順便建立ansible 的playbook\x3c\/p\x3e",
"inLanguage" : "en", "inLanguage" : "en",
"author" : "Eric Chang", "author" : "Eric Chang",
"creator" : "Eric Chang", "creator" : "Eric Chang",
@ -24,7 +24,7 @@
"datePublished": "2021-06-25 15:49:54 \x2b0800 CST", "datePublished": "2021-06-25 15:49:54 \x2b0800 CST",
"dateModified" : "2021-06-25 15:49:54 \x2b0800 CST", "dateModified" : "2021-06-25 15:49:54 \x2b0800 CST",
"url" : "https:\/\/h.cowbay.org\/post\/various-self-hosted-file-sharing-system-test\/", "url" : "https:\/\/h.cowbay.org\/post\/various-self-hosted-file-sharing-system-test\/",
"wordCount" : "171", "wordCount" : "170",
"image" : "https://h.cowbay.org/images/post-default-18.jpg"", "image" : "https://h.cowbay.org/images/post-default-18.jpg"",
"keywords" : [ "Blog" ] "keywords" : [ "Blog" ]
} }
@ -45,9 +45,9 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<link href="https://h.cowbay.org/css/style.css?v=1626744134" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/style.css?v=1629951055" rel="stylesheet" id="theme-stylesheet" type='text/css' media='all'>
<link href="https://h.cowbay.org/css/custom.css?v=1626744134" rel="stylesheet" type='text/css' media='all'> <link href="https://h.cowbay.org/css/custom.css?v=1629951055" rel="stylesheet" type='text/css' media='all'>
<link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon"> <link rel="icon" href="https://h.cowbay.org/img/favicon.ico" type="image/x-icon">
@ -81,10 +81,6 @@ if (!doNotTrack) {
<ul id="menu-secondary-items" class="menu-secondary-items"> <ul id="menu-secondary-items" class="menu-secondary-items">
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/"></a>
</li>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category"> <li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<a href="/categories/ansible">ansible</a> <a href="/categories/ansible">ansible</a>
</li> </li>
@ -309,134 +305,82 @@ if (!doNotTrack) {
<div class="entry-content"> <div class="entry-content">
<article> <article>
<p>感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點</p> <p>感覺最近應該會用到類似這樣的功能,趁著最近比較閒一點</p>
<p>就把系統弄起來玩玩看順便建立ansible 的playbook</p> <p>就把系統弄起來玩玩看順便建立ansible 的playbook</p>
<h3 id="linx-server">linx-server</h3> <h3 id="linx-server">linx-server</h3>
<p><a href="https://github.com/andreimarcu/linx-server">https://github.com/andreimarcu/linx-server</a></p> <p><a href="https://github.com/andreimarcu/linx-server">https://github.com/andreimarcu/linx-server</a></p>
<p>目前已經停止開發的樣子</p> <p>目前已經停止開發的樣子</p>
<p>有Docker 版本,裝起來很容易,用起來也不難</p> <p>有Docker 版本,裝起來很容易,用起來也不難</p>
<p>可以自行架設伺服器</p> <p>可以自行架設伺服器</p>
<p>可以上傳任意類型的檔案</p> <p>可以上傳任意類型的檔案</p>
<p>可以直接線上分享文字</p> <p>可以直接線上分享文字</p>
<p>可以自定分享密碼</p> <p>可以自定分享密碼</p>
<p>上傳界面可以鎖密碼,但是鎖了密碼之後,就沒辦法用命令上傳檔案(不知道怎麼帶KEY進去)</p> <p>上傳界面可以鎖密碼,但是鎖了密碼之後,就沒辦法用命令上傳檔案(不知道怎麼帶KEY進去)</p>
<h4 id="不支援整個目錄上傳">不支援整個目錄上傳</h4> <h4 id="不支援整個目錄上傳">不支援整個目錄上傳</h4>
<h4 id="關於api-如何使用沒有一個完整的說明">關於API 如何使用沒有一個完整的說明</h4> <h4 id="關於api-如何使用沒有一個完整的說明">關於API 如何使用沒有一個完整的說明</h4>
<h4 id="始終找不到怎麼建立api-key">始終找不到怎麼建立API KEY</h4> <h4 id="始終找不到怎麼建立api-key">始終找不到怎麼建立API KEY</h4>
<p><img src="https://i.imgur.com/83WOenv.png" alt=""></p>
<p><img src="https://i.imgur.com/83WOenv.png" alt="" /></p>
<p>在console 下,可以直接上傳並取得超連結</p> <p>在console 下,可以直接上傳並取得超連結</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">chchang@hqdc039:~/docker/linx-server$ cat linx-server.conf
<pre><code class="language-shell">chchang@hqdc039:~/docker/linx-server$ cat linx-server.conf bind <span style="color:#f92672">=</span> 0.0.0.0:7779
bind = 0.0.0.0:7779 sitename <span style="color:#f92672">=</span> myLinx
sitename = myLinx siteurl <span style="color:#f92672">=</span> https://share.com.tw
siteurl = https://share.com.tw maxsize <span style="color:#f92672">=</span> <span style="color:#ae81ff">4294967296</span>
maxsize = 4294967296 maxexpiry <span style="color:#f92672">=</span> <span style="color:#ae81ff">43200</span>
maxexpiry = 43200 selifpath <span style="color:#f92672">=</span> s
selifpath = s allowhotlink <span style="color:#f92672">=</span> false
allowhotlink = false remoteuploads <span style="color:#f92672">=</span> false
remoteuploads = false nologs <span style="color:#f92672">=</span> true
nologs = true force-random-filename <span style="color:#f92672">=</span> true
force-random-filename = true cleanup-every-minutes <span style="color:#f92672">=</span> <span style="color:#ae81ff">5</span>
cleanup-every-minutes = 5 basicauth <span style="color:#f92672">=</span> false
basicauth = false authfile <span style="color:#f92672">=</span> /data/authfile
authfile = /data/authfile
chchang@hqdc039:~/docker/linx-server$ docker-compose up -d chchang@hqdc039:~/docker/linx-server$ docker-compose up -d
Creating linx-server ... done Creating linx-server ... <span style="color:#66d9ef">done</span>
chchang@hqdc039:~/docker/linx-server$ ./linx-client README.md chchang@hqdc039:~/docker/linx-server$ ./linx-client README.md
Copied https://share.com.tw/fyd81h81.md into clipboard! Copied https://share.com.tw/fyd81h81.md into clipboard!
chchang@hqdc039:~/docker/linx-server$ chchang@hqdc039:~/docker/linx-server$
</code></pre> </code></pre></div><h3 id="psitransfer">Psitransfer</h3>
<h3 id="psitransfer">Psitransfer</h3>
<p><a href="https://github.com/psi-4ward/psitransfer">https://github.com/psi-4ward/psitransfer</a></p> <p><a href="https://github.com/psi-4ward/psitransfer">https://github.com/psi-4ward/psitransfer</a></p>
<p>不支援command 上傳</p> <p>不支援command 上傳</p>
<p>有docker版本架設容易</p> <p>有docker版本架設容易</p>
<p>適合給一般使用者用,可以自行設定密碼、保存期限</p> <p>適合給一般使用者用,可以自行設定密碼、保存期限</p>
<p>比較特別的是下載的連結可以產生QRCODE</p> <p>比較特別的是下載的連結可以產生QRCODE</p>
<p>上傳檔案的頁面也可以鎖密碼</p> <p>上傳檔案的頁面也可以鎖密碼</p>
<p><img src="https://i.imgur.com/UMnPo0W.png" alt=""></p>
<p><img src="https://i.imgur.com/UMnPo0W.png" alt="" /></p>
<h3 id="pictshare">pictshare</h3> <h3 id="pictshare">pictshare</h3>
<p><a href="https://github.com/HaschekSolutions/pictshare">https://github.com/HaschekSolutions/pictshare</a></p> <p><a href="https://github.com/HaschekSolutions/pictshare">https://github.com/HaschekSolutions/pictshare</a></p>
<p>有docker版本但是需要自己手動調整</p> <p>有docker版本但是需要自己手動調整</p>
<p>不然調整過的config 都會被蓋掉</p> <p>不然調整過的config 都會被蓋掉</p>
<p>調整過後的docker-compose.yml 我放了一份到github 上</p> <p>調整過後的docker-compose.yml 我放了一份到github 上</p>
<p><a href="https://github.com/changchichung/docker-compose-pictshare">https://github.com/changchichung/docker-compose-pictshare</a></p> <p><a href="https://github.com/changchichung/docker-compose-pictshare">https://github.com/changchichung/docker-compose-pictshare</a></p>
<p>需要拿掉pictshare.sh 中每次自動更新config的部分</p> <p>需要拿掉pictshare.sh 中每次自動更新config的部分</p>
<p>雖然web UI 有點醜,但是基本上想要的功能都有了</p> <p>雖然web UI 有點醜,但是基本上想要的功能都有了</p>
<p>可以用WEB傳也可以用terminal 傳</p> <p>可以用WEB傳也可以用terminal 傳</p>
<p>不限制上傳的檔案類型</p> <p>不限制上傳的檔案類型</p>
<p>可以限制可以上傳的subnet</p> <p>可以限制可以上傳的subnet</p>
<p>回傳的URL 也可以有副檔名,所以可以直接連結當作圖床</p> <p>回傳的URL 也可以有副檔名,所以可以直接連結當作圖床</p>
<p>算是很不錯用的了</p> <p>算是很不錯用的了</p>
<p><img src="https://i.imgur.com/4ujMfRA.png" alt=""></p>
<p><img src="https://i.imgur.com/4ujMfRA.png" alt="" /></p>
<h4 id="upload-in-terminal">upload in terminal</h4> <h4 id="upload-in-terminal">upload in terminal</h4>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">chchang@hqdc039:~/docker/pictshare$ pict ~/Downloads/images/IMG_20190717_092723.jpg
<pre><code class="language-shell">chchang@hqdc039:~/docker/pictshare$ pict ~/Downloads/images/IMG_20190717_092723.jpg
https://share.com.tw/1dpobr.jpg https://share.com.tw/1dpobr.jpg
chchang@hqdc039:~/docker/pictshare$ chchang@hqdc039:~/docker/pictshare$
</code></pre> </code></pre></div><p>就先決定用這個 <!-- raw HTML omitted -->pictshare<!-- raw HTML omitted --></p>
<p>就先決定用這個 <strong>pictshare</strong></p>
<h3 id="另外推薦的工具-anypaste">另外推薦的工具 anypaste</h3> <h3 id="另外推薦的工具-anypaste">另外推薦的工具 anypaste</h3>
<p><a href="https://github.com/markasoftware/anypaste">https://github.com/markasoftware/anypaste</a></p> <p><a href="https://github.com/markasoftware/anypaste">https://github.com/markasoftware/anypaste</a></p>
<p>這個雖然不能自己建立服務需要依賴internet 上已經存在的多個網站服務</p> <p>這個雖然不能自己建立服務需要依賴internet 上已經存在的多個網站服務</p>
<p>像是 file.io imgur hastebin 等等</p> <p>像是 file.io imgur hastebin 等等</p>
<p>不過呢如果不是那麼計較安全性要上傳的檔案不介意丟在internet上公開</p> <p>不過呢如果不是那麼計較安全性要上傳的檔案不介意丟在internet上公開</p>
<p>那真的很推薦這個指令不用安裝有的沒的一大堆anypaste 本身就是一個script 整合了各家服務的上傳指令</p> <p>那真的很推薦這個指令不用安裝有的沒的一大堆anypaste 本身就是一個script 整合了各家服務的上傳指令</p>
<p>所以「理論上」 要修改也不是太難..</p> <p>所以「理論上」 要修改也不是太難..</p>
<p>跑起來大概像這樣</p> <p>跑起來大概像這樣</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">chchang@hqdc039:~/docker/pictshare$ anypaste ~/Downloads/images/IMG_20190717_092723.jpg
<pre><code class="language-shell">chchang@hqdc039:~/docker/pictshare$ anypaste ~/Downloads/images/IMG_20190717_092723.jpg
Current file: /home/chchang/Downloads/images/IMG_20190717_092723.jpg Current file: /home/chchang/Downloads/images/IMG_20190717_092723.jpg
Attempting to upload with plugin 'imgur' Attempting to upload with plugin <span style="color:#e6db74">&#39;imgur&#39;</span>
################################################################################################################# 100.0% <span style="color:#75715e">################################################################################################################# 100.0%</span>
Link: https://imgur.com/y0Suzjf Link: https://imgur.com/y0Suzjf
Direct: https://i.imgur.com/y0Suzjf.jpg Direct: https://i.imgur.com/y0Suzjf.jpg
@ -444,12 +388,10 @@ Edit: https://imgur.com/edit?deletehashD
Delete: https://imgur.com/delete/fNJ Delete: https://imgur.com/delete/fNJ
Upload complete. Upload complete.
Sucessfully uploaded: '/home/chchang/Downloads/images/IMG_20190717_092723.jpg' Sucessfully uploaded: <span style="color:#e6db74">&#39;/home/chchang/Downloads/images/IMG_20190717_092723.jpg&#39;</span>
All files processed. Have a nice day! All files processed. Have a nice day!
chchang@hqdc039:~/docker/pictshare$ chchang@hqdc039:~/docker/pictshare$
</code></pre> </code></pre></div><p>也是非常方便的一個工具,值得推薦!</p>
<p>也是非常方便的一個工具,值得推薦!</p>
</article> </article>
</div> </div>
@ -722,7 +664,7 @@ title="pinterest icon"></i>
</ul> <div class="design-credit"> </ul> <div class="design-credit">
<p>&copy; 2018 Göran Svensson</p> <p>© 2018 Göran Svensson</p>
<p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p> <p>Nederburg Hugo Theme by <a href="https://appernetic.io">Appernetic</a>.</p>
@ -734,7 +676,7 @@ title="pinterest icon"></i>
</div> </div>
<script src="https://h.cowbay.org/js/jquery.min.js"></script> <script src="https://h.cowbay.org/js/jquery.min.js"></script>
<script src="https://h.cowbay.org/js/jquerymigrate.js"></script> <script src="https://h.cowbay.org/js/jquerymigrate.js"></script>
<script src="https://h.cowbay.org/js/production.min.js?v=1626744134"></script> <script src="https://h.cowbay.org/js/production.min.js?v=1629951055"></script>
</body> </body>
</html> </html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save