Skip to content

Instantly share code, notes, and snippets.

Last active July 27, 2017 06:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?

Cloud Native


Useful commands


$ sudo systemctl status update_engine
$ sudo systemctl unmask update_engine
$ sudo systemctl start update_engine
$ update_engine_client -update

# Need to update twice for A and B regions.


etcd2 to etcd3

Useful commands

Backing up the datastore

# etcdctl backup --data-dir /var/lib/etcd2/ --backup-dir ./170511_1727

# This is for bug of 1122.2.0
scp -r
chown -R
etcd disaster recovery on CoreOS Container Linux

$ sudo etcdctl backup --data-dir /var/lib/etcd2 --backup-dir /var/lib/etcd2_backup

/run/systemd/system/etcd2.service.d/98-force-new-cluster.conf drop-in file with the following contents:


# Be careful about the ownership of etcd2
$ sudo chown -R etcd:etcd /var/lib/etcd2
check 40-etcd-cluster.conf to start a clean cluster

remove 98-force-new-cluster.conf at the end

etcdctl member list
etcdctl cluster-health
# This is for bug of 1122.2.0
rsync -avzh member tony@
$ ETCDCTL_API=3 ./etcdctl --endpoints $ENDPOINTS -w table endpoint status
$ ETCDCTL_API=3 ./etcdctl --endpoints=$ENDPOINTS endpoint health

$ ETCDCTL_API=3 ./etcdctl get "" --from-key --keys-only --limit 10
$ ETCDCTL_API=3 ./etcdctl get "" --from-key --print-value-only --limit 10
$ ETCDCTL_API=3 ./etcdctl get "" --from-key --keys-only --limit 20000 | grep tony-ubuntu-40rx7


- vim ------------------------------------------------------
% - find ( { [ ] } )
# , * - find word under the cursor.
g# , g*
0 ^ $ g_ f F t T , ; - Move on current line.
{This is a book. It is not a pen.}
x , X - delete the character under the cursor and to the left of the cursor, respectively.
u , ctrl-r - undo and redo.
This is a book.
w , W - word and extended word
Zone selection <action>a<object> or <action>i<object>
Visual selection: v,V,<C-v> , gv
Block selection 0<C-v><C-d>I-- [ESC]
Macros : qa do something q, @a, @@
# , * - find word under the cursor.
:set incsearch
:set hlsearch
% - find matching ( { [
[{ - back to the {
bn - buffer previous
C-^ - previous buffer
viwp - past buffer on a word
^E ^Y ^U ^D ^F ^B
~ change case
J - Join lines
iw is ip i' i" i` i( i[ i{ it
aw as ap a' a" a` a( a[ a{ at
# folds
zf zF zd zD zE
- vim-go ---------------------------------------------------
yif , yaf
gS , gJ
ff <tab> , json <tab> , <C-j> - code template
:GoMetaLinter - style advises
:GoAlternate - jump to test file
gd , ctrl-] , ctrl-t - def movement
:GoDecls , :GoDeclsDir - similar to F8
]] , [[ - jump to func
:GoFiles - list package files
:GoDeps - list package dependency
:GoReferrers - find who is calling
:ccl , :pc , :lcl
:GoCallees , GoCallers
:GoImpl io.ReadWriteCloser
:GoImpl b *B fmt.Stringer
<C-x><C-o> , <tab>
- tmux -----------------------------------------------------
# session management
tmux ls (or tmux list-sessions)
tmux new -s session-name
tmux attach -t [session name]
tmux kill-session -t session-name
Ctrl-b d Detach from session
Ctrl-b s list out sessions
Ctrl-b c Create new window
Ctrl-b d Detach current client
Ctrl-b n Move to the next window
Ctrl-b p Move to the previous window
Ctrl-b & Kill the current window
Ctrl-b , Rename the current window
Ctrl-b q Show pane numbers (used to switch between panes)
Ctrl-b o Switch to the next pane
Ctrl-b ? List all keybindings
# moving between windows
Ctrl-b n (Move to the next window)
Ctrl-b p (Move to the previous window)
Ctrl-b w (List all windows / window numbers)
Ctrl-b window number (Move to the specified window number, the
default bindings are from 0 -- 9)
# Tiling commands
Ctrl-b % (Split the window vertically)
Ctrl-b " (Split window horizontally)
Ctrl-b o (Goto next pane)
Ctrl-b q (Show pane numbers, when the numbers show up type the key to go to that pane)
Ctrl-b { (Move the current pane left)
Ctrl-b } (Move the current pane right)
# Make a pane its own window
Ctrl-b : "break-pane"
Ctrl-b : "swap-window -s 0 -t 1"
# add to ~/.tmux.conf
bind | split-window -h
bind - split-window -v
# vi keys in copy mode
Ctrl-b [ - enter copy mode
Ctrl-b PageUp - enter copy mode
space - start selection
enter - end selection
Ctrl-b ] - paste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment