forked from ninehills/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
1,570 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
blog.ninehills.tech | ||
ninehills.tech |
4 changes: 4 additions & 0 deletions
4
assets/js/highlight.min.b95bacdc39e37a332a9f883b1e78be4abc1fdca2bc1f2641f55e3cd3dabd4d61.js
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!doctype html><html lang=en dir=auto><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=robots content="index, follow"><title>九原山</title><meta name=description content><meta name=author content><link rel=canonical href=https://ninehills.tech/><link crossorigin=anonymous href=/assets/css/stylesheet.min.c88963fe2d79462000fd0fb1b3737783c32855d340583e4523343f8735c787f0.css integrity="sha256-yIlj/i15RiAA/Q+xs3N3g8MoVdNAWD5FIzQ/hzXHh/A=" rel="preload stylesheet" as=style><link rel=icon href=https://ninehills.tech/favicon.ico><link rel=icon type=image/png sizes=16x16 href=https://ninehills.tech/favicon-16x16.png><link rel=icon type=image/png sizes=32x32 href=https://ninehills.tech/favicon-32x32.png><link rel=apple-touch-icon href=https://ninehills.tech/apple-touch-icon.png><link rel=mask-icon href=https://ninehills.tech/safari-pinned-tab.svg><meta name=theme-color content="#2e2e33"><meta name=msapplication-TileColor content="#2e2e33"><meta name=generator content="Hugo 0.112.6"><link rel=alternate type=application/rss+xml href=https://ninehills.tech/index.xml><noscript><style>#theme-toggle,.top-link{display:none}</style><style>@media(prefers-color-scheme:dark){:root{--theme:rgb(29, 30, 32);--entry:rgb(46, 46, 51);--primary:rgb(218, 218, 219);--secondary:rgb(155, 156, 157);--tertiary:rgb(65, 66, 68);--content:rgb(196, 196, 197);--hljs-bg:rgb(46, 46, 51);--code-bg:rgb(55, 56, 62);--border:rgb(51, 51, 51)}.list{background:var(--theme)}.list:not(.dark)::-webkit-scrollbar-track{background:0 0}.list:not(.dark)::-webkit-scrollbar-thumb{border-color:var(--theme)}}</style></noscript><meta property="og:title" content="九原山"><meta property="og:description" content><meta property="og:type" content="website"><meta property="og:url" content="https://ninehills.tech/"><meta name=twitter:card content="summary"><meta name=twitter:title content="九原山"><meta name=twitter:description content><script type=application/ld+json>{"@context":"https://schema.org","@type":"Organization","name":"九原山","url":"https://ninehills.tech/","description":"","thumbnailUrl":"https://ninehills.tech/favicon.ico","sameAs":[]}</script></head><body class=list id=top><script>localStorage.getItem("pref-theme")==="dark"?document.body.classList.add("dark"):localStorage.getItem("pref-theme")==="light"?document.body.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches&&document.body.classList.add("dark")</script><header class=header><nav class=nav><div class=logo><a href=https://ninehills.tech/ accesskey=h title="九原山 (Alt + H)">九原山</a> | ||
<span class=logo-switches><button id=theme-toggle accesskey=t title="(Alt + T)"><svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/></svg><svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentcolor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg></button></span></div><ul id=menu></ul></nav></header><main class=main><article class=post-entry><header class=entry-header><h2>[MIT 6.824 分布式系统课程] Lab2 Raft 心得</h2></header><section class=entry-content><p>Raft struct 的成员 1 Raft 节点的角色,可以使用Go常量 | ||
const ( Follower = iota // 0 Candidate // 1 Leader // 2 ) 2 使用Buffered Channel进行异步通信,比如等待心跳包结果等情况,我定义了如下Channel | ||
chanHeartbeat chan bool // 收到心跳 chanWinVote chan bool // 赢得选举 chanGrantVote chan bool // 获得选举票 chanApply chan ApplyMsg // 用来commit的channel 在Make()中需要初始化Channel为Buffered Channel | ||
rf.chanWinVote = make(chan bool, 10) rf.chanGrantVote = make(chan bool, 10) rf.chanHeartbeat = make(chan bool, 10) 3 Raft struct大部分成员都是论文的Figure 2的内容 | ||
4 发送broadcastRequestVote后,需要进行voteCount 计数,以确定是否赢得Vote,所以 Raft struct需要增加voteCount成员 | ||
协程冲突问题 Raft有如下成员来进行加锁...</p></section><footer class=entry-footer><span title='2018-02-28 09:36:26 +0000 UTC'>February 28, 2018</span></footer><a class=entry-link aria-label="post link to [MIT 6.824 分布式系统课程] Lab2 Raft 心得" href=https://ninehills.tech/posts/ninehills-ninehills.github.io-300952316-post-62/></a></article><article class=post-entry><header class=entry-header><h2>解决 Mac Docker.qcow2 文件过大的问题</h2></header><section class=entry-content><p>背景:Docker on Mac 长时间运行后,Docker.qcow2就会变得很大,需要压缩 | ||
参考:https://github.com/docker/for-mac/issues/371 | ||
Author: yankcrime NB: You’ll need to install qemu via Homebrew as this process requires qemu-img to recompress the qcow2 disk image. | ||
$ cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux | ||
$ mv Docker.qcow2 Docker.qcow2.original | ||
$ du -hs Docker.qcow2.original | ||
12G Docker.qcow2.original | ||
$ qemu-img convert -O qcow2 Docker.qcow2.original Docker.qcow2 | ||
$ rm Docker.qcow2.original | ||
$ du -hs Docker.qcow2 | ||
772M Docker.qcow2 除此之外,还有一个根本解决问题的方法,就是不要在虚拟机内保存任何数据,全部使用Volume,这样当文件过大时,删除文件,重启Docker后,重新创建容器即可。 | ||
回复也记录下常用的一些容器的启动,用于备忘: | ||
# jupyter with spark | ||
docker run -p 8888:8888 -d -v /Users/baidu/WorkSpace/Jupyter:/home/jovyan/work --name all-spark-notebook jupyter/all-spark-notebook | ||
# jupyter with go | ||
docker run -p 8887:8888 -d -v /Users/baidu/WorkSpace/Jupyter:/go/workspace --name go-notebook dwhitena/gophernotes jupyter notebook --no-browser --ip=0....</p></section><footer class=entry-footer><span title='2017-07-13 02:21:52 +0000 UTC'>July 13, 2017</span></footer><a class=entry-link aria-label="post link to 解决 Mac Docker.qcow2 文件过大的问题" href=https://ninehills.tech/posts/ninehills-ninehills.github.io-242567191-post-3/></a></article><footer class=page-footer><nav class=pagination><a class=prev href=https://ninehills.tech/>« Prev Page</a></nav></footer></main><footer class=footer><span>© 2023 <a href=https://ninehills.tech/>九原山</a></span> | ||
<span>Powered by | ||
<a href=https://gohugo.io/ rel="noopener noreferrer" target=_blank>Hugo</a> & | ||
<a href=https://git.io/hugopapermod rel=noopener target=_blank>PaperMod</a></span></footer><a href=#top aria-label="go to top" title="Go to Top (Alt + G)" class=top-link id=top-link accesskey=g><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 6" fill="currentcolor"><path d="M12 6H0l6-6z"/></svg></a><script>let menu=document.getElementById("menu");menu&&(menu.scrollLeft=localStorage.getItem("menu-scroll-position"),menu.onscroll=function(){localStorage.setItem("menu-scroll-position",menu.scrollLeft)}),document.querySelectorAll('a[href^="#"]').forEach(e=>{e.addEventListener("click",function(e){e.preventDefault();var t=this.getAttribute("href").substr(1);window.matchMedia("(prefers-reduced-motion: reduce)").matches?document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView():document.querySelector(`[id='${decodeURIComponent(t)}']`).scrollIntoView({behavior:"smooth"}),t==="top"?history.replaceState(null,null," "):history.pushState(null,null,`#${t}`)})})</script><script>var mybutton=document.getElementById("top-link");window.onscroll=function(){document.body.scrollTop>800||document.documentElement.scrollTop>800?(mybutton.style.visibility="visible",mybutton.style.opacity="1"):(mybutton.style.visibility="hidden",mybutton.style.opacity="0")}</script><script>document.getElementById("theme-toggle").addEventListener("click",()=>{document.body.className.includes("dark")?(document.body.classList.remove("dark"),localStorage.setItem("pref-theme","light")):(document.body.classList.add("dark"),localStorage.setItem("pref-theme","dark"))})</script></body></html> |
Oops, something went wrong.