在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ Linux/ 使用
利用數(shù)據(jù)卷容器來(lái)備份、恢復(fù)、遷移數(shù)據(jù)卷
Docker 網(wǎng)絡(luò)實(shí)現(xiàn)
實(shí)戰(zhàn) Django
YAML 模板文件
名字空間
控制組
編輯網(wǎng)絡(luò)配置文件
列出
進(jìn)入容器
Compose 命令說(shuō)明
創(chuàng)建 Tomcat/Weblogic 集群
守護(hù)態(tài)運(yùn)行
快速配置指南
其它安全特性
示例:創(chuàng)建一個(gè)點(diǎn)到點(diǎn)連接
CentOS 系列安裝 Docker
數(shù)據(jù)卷容器
鏡像
指令
創(chuàng)建鏡像
Docker 容器
創(chuàng)建鏡像
常用倉(cāng)庫(kù)
總結(jié)
什么是 Docker
存出和載入鏡像
使用
獲取鏡像
容器互聯(lián)
為什么要使用 Docker?
使用 Wordpress 入門(mén) Fig
啟動(dòng)
容器訪問(wèn)控制
私有倉(cāng)庫(kù)
使用
基本架構(gòu)
自定義網(wǎng)橋
環(huán)境變量參考
實(shí)戰(zhàn) Rail
服務(wù)端的防護(hù)
刪除
鏡像的實(shí)現(xiàn)原理
多臺(tái)物理主機(jī)之間的容器互聯(lián)
Docker 倉(cāng)庫(kù)
簡(jiǎn)介
數(shù)據(jù)卷
命令參考
使用 Supervisor 來(lái)管理進(jìn)程
移除
基本結(jié)構(gòu)
命令查詢(xún)
終止容器
聯(lián)合文件系統(tǒng)
安裝
簡(jiǎn)介
配置 DNS
內(nèi)核能力機(jī)制
導(dǎo)出和導(dǎo)入容器
配置 docker0 網(wǎng)橋
倉(cāng)庫(kù)配置文件
內(nèi)核名字空間
標(biāo)準(zhǔn)化開(kāi)發(fā)測(cè)試和生產(chǎn)環(huán)境
外部訪問(wèn)容器
fig.yml 參考
Ubuntu 系列安裝 Docker
有用資源
安裝
端口映射實(shí)現(xiàn)
安裝 Fig
工具和示例
簡(jiǎn)介
控制組
容器格式
Docker Hub

使用

etcdctl 是一個(gè)命令行客戶(hù)端,它能提供一些簡(jiǎn)潔的命令,供用戶(hù)直接跟 etcd 服務(wù)打交道,而無(wú)需基于 HTTP API 方式。這在某些情況下將很方便,例如用戶(hù)對(duì)服務(wù)進(jìn)行測(cè)試或者手動(dòng)修改數(shù)據(jù)庫(kù)內(nèi)容。我們也推薦在剛接觸 etcd 時(shí)通過(guò) etcdctl 命令來(lái)熟悉相關(guān)的操作,這些操作跟 HTTP API 實(shí)際上是對(duì)應(yīng)的。

etcd 項(xiàng)目二進(jìn)制發(fā)行包中已經(jīng)包含了 etcdctl 工具,沒(méi)有的話,可以從 github.com/coreos/etcd/releases 下載。

etcdctl 支持如下的命令,大體上分為數(shù)據(jù)庫(kù)操作和非數(shù)據(jù)庫(kù)操作兩類(lèi),后面將分別進(jìn)行解釋。

$ etcdctl -h
NAME:
   etcdctl - A simple command line client for etcd.

USAGE:
   etcdctl [global options] command [command options] [arguments...]

VERSION:
   2.0.0-rc.1

COMMANDS:
   backup   backup an etcd directory
   mk       make a new key with a given value
   mkdir    make a new directory
   rm       remove a key
   rmdir    removes the key if it is an empty directory or a key-value pair
   get      retrieve the value of a key
   ls       retrieve a directory
   set      set the value of a key
   setdir   create a new or existing directory
   update   update an existing key with a given value
   updatedir    update an existing directory
   watch    watch a key for changes
   exec-watch   watch a key for changes and exec an executable
   member   member add, remove and list subcommands
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --debug          output cURL commands which can be used to reproduce the request
   --no-sync            don't synchronize cluster information before sending request
   --output, -o 'simple'    output response in the given format (`simple` or `json`)
   --peers, -C          a comma-delimited list of machine addresses in the cluster (default: "127.0.0.1:4001")
   --cert-file          identify HTTPS client using this SSL certificate file
   --key-file           identify HTTPS client using this SSL key file
   --ca-file            verify certificates of HTTPS-enabled servers using this CA bundle
   --help, -h           show help
   --version, -v        print the version

數(shù)據(jù)庫(kù)操作

數(shù)據(jù)庫(kù)操作圍繞對(duì)鍵值和目錄的 CRUD (符合 REST 風(fēng)格的一套操作:Create)完整生命周期的管理。

etcd 在鍵的組織上采用了層次化的空間結(jié)構(gòu)(類(lèi)似于文件系統(tǒng)中目錄的概念),用戶(hù)指定的鍵可以為單獨(dú)的名字,如 testkey,此時(shí)實(shí)際上放在根目錄 / 下面,也可以為指定目錄結(jié)構(gòu),如 cluster1/node2/testkey,則將創(chuàng)建相應(yīng)的目錄結(jié)構(gòu)。

注:CRUD 即 Create, Read, Update, Delete,是符合 REST 風(fēng)格的一套 API 操作。

set

指定某個(gè)鍵的值。例如

$ etcdctl set /testdir/testkey "Hello world"
Hello world

支持的選項(xiàng)包括:

--ttl '0'           該鍵值的超時(shí)時(shí)間(單位為秒),不配置(默認(rèn)為 0)則永不超時(shí)
--swap-with-value value 若該鍵現(xiàn)在的值是 value,則進(jìn)行設(shè)置操作
--swap-with-index '0'   若該鍵現(xiàn)在的索引值是指定索引,則進(jìn)行設(shè)置操作

get

獲取指定鍵的值。例如

$ etcdctl set testkey hello
hello
$ etcdctl update testkey world
world

當(dāng)鍵不存在時(shí),則會(huì)報(bào)錯(cuò)。例如

$ etcdctl get testkey2
Error:  100: Key not found (/testkey2) [1]

支持的選項(xiàng)為

--sort  對(duì)結(jié)果進(jìn)行排序
--consistent 將請(qǐng)求發(fā)給主節(jié)點(diǎn),保證獲取內(nèi)容的一致性

update

當(dāng)鍵存在時(shí),更新值內(nèi)容。例如

$ etcdctl set testkey hello
hello
$ etcdctl update testkey world
world

當(dāng)鍵不存在時(shí),則會(huì)報(bào)錯(cuò)。例如

$ etcdctl update testkey2 world
Error:  100: Key not found (/testkey2) [1]

支持的選項(xiàng)為

--ttl '0'   超時(shí)時(shí)間(單位為秒),不配置(默認(rèn)為 0)則永不超時(shí)

rm

刪除某個(gè)鍵值。例如

$ etcdctl rm testkey

當(dāng)鍵不存在時(shí),則會(huì)報(bào)錯(cuò)。例如

$ etcdctl rm testkey2
Error:  100: Key not found (/testkey2) [8]

支持的選項(xiàng)為

--dir       如果鍵是個(gè)空目錄或者鍵值對(duì)則刪除
--recursive     刪除目錄和所有子鍵
--with-value    檢查現(xiàn)有的值是否匹配
--with-index '0'    檢查現(xiàn)有的 index 是否匹配

mk

如果給定的鍵不存在,則創(chuàng)建一個(gè)新的鍵值。例如

$ etcdctl mk /testdir/testkey "Hello world"
Hello world

當(dāng)鍵存在的時(shí)候,執(zhí)行該命令會(huì)報(bào)錯(cuò),例如

$ etcdctl set testkey "Hello world"
Hello world
$ ./etcdctl mk testkey "Hello world"
Error:  105: Key already exists (/testkey) [2]

支持的選項(xiàng)為

--ttl '0'   超時(shí)時(shí)間(單位為秒),不配置(默認(rèn)為 0)則永不超時(shí)

mkdir

如果給定的鍵目錄不存在,則創(chuàng)建一個(gè)新的鍵目錄。例如

$ etcdctl mkdir testdir

當(dāng)鍵目錄存在的時(shí)候,執(zhí)行該命令會(huì)報(bào)錯(cuò),例如

$ etcdctl mkdir testdir
$ etcdctl mkdir testdir
Error:  105: Key already exists (/testdir) [7]

支持的選項(xiàng)為

--ttl '0'   超時(shí)時(shí)間(單位為秒),不配置(默認(rèn)為 0)則永不超時(shí)

setdir

創(chuàng)建一個(gè)鍵目錄,無(wú)論存在與否。

支持的選項(xiàng)為

--ttl '0'   超時(shí)時(shí)間(單位為秒),不配置(默認(rèn)為 0)則永不超時(shí)

updatedir

更新一個(gè)已經(jīng)存在的目錄。

支持的選項(xiàng)為

--ttl '0'   超時(shí)時(shí)間(單位為秒),不配置(默認(rèn)為 0)則永不超時(shí)

rmdir

刪除一個(gè)空目錄,或者鍵值對(duì)。

若目錄不空,會(huì)報(bào)錯(cuò)

$ etcdctl set /dir/testkey hi
hi
$ etcdctl rmdir /dir
Error:  108: Directory not empty (/dir) [13]

ls

列出目錄(默認(rèn)為根目錄)下的鍵或者子目錄,默認(rèn)不顯示子目錄中內(nèi)容。

例如

$ ./etcdctl set testkey 'hi'
hi
$ ./etcdctl set dir/test 'hello'
hello
$ ./etcdctl ls
/testkey
/dir
$ ./etcdctl ls dir
/dir/test

支持的選項(xiàng)包括

--sort  將輸出結(jié)果排序
--recursive 如果目錄下有子目錄,則遞歸輸出其中的內(nèi)容
-p      對(duì)于輸出為目錄,在最后添加 `/` 進(jìn)行區(qū)分

非數(shù)據(jù)庫(kù)操作

backup

備份 etcd 的數(shù)據(jù)。

支持的選項(xiàng)包括

--data-dir      etcd 的數(shù)據(jù)目錄
--backup-dir    備份到指定路徑

watch

監(jiān)測(cè)一個(gè)鍵值的變化,一旦鍵值發(fā)生更新,就會(huì)輸出最新的值并退出。

例如,用戶(hù)更新 testkey 鍵值為 Hello world。

$ etcdctl watch testkey
Hello world

支持的選項(xiàng)包括

--forever       一直監(jiān)測(cè),直到用戶(hù)按 `CTRL+C` 退出
--after-index '0'   在指定 index 之前一直監(jiān)測(cè)
--recursive     返回所有的鍵值和子鍵值

exec-watch

監(jiān)測(cè)一個(gè)鍵值的變化,一旦鍵值發(fā)生更新,就執(zhí)行給定命令。

例如,用戶(hù)更新 testkey 鍵值。

$etcdctl exec-watch testkey -- sh -c 'ls'
default.etcd
Documentation
etcd
etcdctl
etcd-migrate
README-etcdctl.md
README.md

支持的選項(xiàng)包括

--after-index '0'   在指定 index 之前一直監(jiān)測(cè)
--recursive     返回所有的鍵值和子鍵值

member

通過(guò) list、add、remove 命令列出、添加、刪除 etcd 實(shí)例到 etcd 集群中。

例如本地啟動(dòng)一個(gè) etcd 服務(wù)實(shí)例后,可以用如下命令進(jìn)行查看。

$ etcdctl member list
ce2a822cea30bfca: name=default peerURLs=http://localhost:2380,http://localhost:7001 clientURLs=http://localhost:2379,http://localhost:4001

命令選項(xiàng)

  • --debug 輸出 cURL 命令,顯示執(zhí)行命令的時(shí)候發(fā)起的請(qǐng)求
  • --no-sync 發(fā)出請(qǐng)求之前不同步集群信息
  • --output, -o 'simple' 輸出內(nèi)容的格式 (simple 為原始信息,json 為進(jìn)行json格式解碼,易讀性好一些)
  • --peers, -C 指定集群中的同伴信息,用逗號(hào)隔開(kāi) (默認(rèn)為: "127.0.0.1:4001")
  • --cert-file HTTPS 下客戶(hù)端使用的 SSL 證書(shū)文件
  • --key-file HTTPS 下客戶(hù)端使用的 SSL 密鑰文件
  • --ca-file 服務(wù)端使用 HTTPS 時(shí),使用 CA 文件進(jìn)行驗(yàn)證
  • --help, -h 顯示幫助命令信息
  • --version, -v 打印版本信息
上一篇:常用倉(cāng)庫(kù)下一篇:安裝