Swarmd
程序支持的命令选项:
func init() {
mainCmd.Flags().BoolP("version", "v", false, "Display the version and exit")
mainCmd.Flags().StringP("log-level", "l", "info", "Log level (options \"debug\", \"info\", \"warn\", \"error\", \"fatal\", \"panic\")")
mainCmd.Flags().StringP("state-dir", "d", "./swarmkitstate", "State directory")
mainCmd.Flags().StringP("join-token", "", "", "Specifies the secret token required to join the cluster")
mainCmd.Flags().String("engine-addr", "unix:///var/run/docker.sock", "Address of engine instance of agent.")
mainCmd.Flags().String("hostname", "", "Override reported agent hostname")
mainCmd.Flags().String("listen-remote-api", "0.0.0.0:4242", "Listen address for remote API")
mainCmd.Flags().String("listen-control-api", "./swarmkitstate/swarmd.sock", "Listen socket for control API")
mainCmd.Flags().String("listen-debug", "", "Bind the Go debug server on the provided address")
mainCmd.Flags().String("join-addr", "", "Join cluster with a node at this address")
mainCmd.Flags().Bool("force-new-cluster", false, "Force the creation of a new cluster from data directory")
mainCmd.Flags().Uint32("heartbeat-tick", 1, "Defines the heartbeat interval (in seconds) for raft member health-check")
mainCmd.Flags().Uint32("election-tick", 3, "Defines the amount of ticks (in seconds) needed without a Leader to trigger a new election")
mainCmd.Flags().Var(&externalCAOpt, "external-ca", "Specifications of one or more certificate signing endpoints")
}
(1)version
,log-level
和hostname
最简单,不必细说。
(2)state-dir
目录存储远端manager
以及CA
认证等相关信息:
# ls -alt
total 24
drwx------ 5 root root 4096 Jul 29 02:40 .
drwx------ 4 root root 4096 Jul 29 02:40 raft
-rw------- 1 root root 63 Jul 29 02:40 state.json
drwxr-xr-x 2 root root 4096 Jul 29 02:40 worker
drwxr-xr-x 2 root root 4096 Jul 29 02:40 certificates
drwxr-xr-x 3 root root 4096 Jul 29 02:40 ..
(3)join-token
是node
用来加入某个cluster
的token
,在第一次认证请求时会被用到。
(4)engine-addr
指定实际用来执行executor
的engine
位置,默认是使用本机Docker
。
(5)listen-remote-api
指定监听一个tcp port
,用来接收和处理其它node
的访问请求。
(6)listen-control-api
指定一个Unix socket
,用来接收和处理swarmctl
程序的访问请求。
(7)listen-debug
指定监听一个用来debug
程序的端口。
(8)join-addr
指定要加入的cluster
的一个node
地址,通过连接这个node
来加入这个cluster
。
(9)其余force-new-cluster
,heartbeat-tick
,election-tick
和external-ca
解释的都很清楚,不必赘述。
有疑问加站长微信联系(非本文作者)