记录:336
场景:在CentOS 7.9操作系统上,使用ceph-deploy创建ceph集群;部署集群的mon、mgr、mds、osd、rgw等组件。
版本:
操作系统:CentOS 7.9
ceph版本:ceph-13.2.10
名词:
ceph-deploy:Ceph部署集群的工具命令。
1.基础环境
在规划集群主机上需安装ceph-deploy、ceph、ceph-radosgw软件。
(1)集群主节点安装软件
安装命令:yum install -y ceph-deploy ceph-13.2.10
安装命令:yum install -y ceph-radosgw-13.2.10
解析:集群中主节点安装ceph-deploy、ceph、ceph-radosgw软件。
(2)集群从节点安装软件
安装命令:yum install -y ceph-13.2.10
安装命令:yum install -y ceph-radosgw-13.2.10
解析:集群中从节点安装ceph、ceph-radosgw软件。
2.命令应用
ceph-deploy命令,在集群主节点的/etc/ceph目录下使用。
(1)创建ceph集群
命令:ceph-deploy new app161 app162 app163
解析:创建由app161、app162、app163三个主机组成的集群。
(2)创建和初始化mon守护进程
命令:ceph-deploy mon create-initial
解析:在主节点执行,初始化集群中的mon守护进程。
(3)部署osd和指定磁盘
命令:ceph-deploy osd create --data /dev/sdb app161
解析:在指定主机创建osd;--data,指定磁盘;app161,部署的节点。
(4)创建mgr
命令:ceph-deploy mgr create app161 app162 app163
解析:在指定主机上创建mgr组件。
(5)创建mds
命令:ceph-deploy mds create app161 app162 app163
解析:在指定主机上创建mds组件。
(6)创建rgw
命令:ceph-deploy rgw create app161 app162 app163
解析:在指定主机上创建rgw组件。
(7)ceph dashboard create-self-signed-cert
命令:ceph mgr module enable dashboard
命令:ceph dashboard create-self-signed-cert
解析:ceph mgr module enable,开启dashboard功能;ceph dashboard,创建证书。
(8)同步配置文件到客户端主机
命令:ceph-deploy admin 192.168.19.166
解析:同步集群主节点的配置信息到客户端主机。
(9)查看主机磁盘信息
命令:ceph-deploy disk list app161
解析:查看主机磁盘信息。
(10)卸载集群
命令:ceph-deploy purge app161 app162 app163
命令:ceph-deploy purgedata app161 app162 app163
解析:卸载集群和卸载数据。
3.命令帮助手册
(1)ceph-deploy帮助命令
命令:ceph-deploy --help
解析:查看ceph-deploy支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy [-h] [-v | -q] [--version] [--username USERNAME]
[--overwrite-conf] [--ceph-conf CEPH_CONF]
COMMAND ...
Easy Ceph deployment
-^-
/ \
|O o| ceph-deploy v2.0.1
).-.(
'/|||\`
| '|` |
'|`
Full documentation can be found at: http://ceph.com/ceph-deploy/docs
optional arguments:
-h, --help show this help message and exit
-v, --verbose be more verbose
-q, --quiet be less verbose
--version the current installed version of ceph-deploy
--username USERNAME the username to connect to the remote host
--overwrite-conf overwrite an existing conf file on remote host (if
present)
--ceph-conf CEPH_CONF
use (or reuse) a given ceph.conf file
commands:
COMMAND description
new Start deploying a new cluster, and write a
CLUSTER.conf and keyring for it.
install Install Ceph packages on remote hosts.
rgw Ceph RGW daemon management
mgr Ceph MGR daemon management
mds Ceph MDS daemon management
mon Ceph MON Daemon management
gatherkeys Gather authentication keys for provisioning new nodes.
disk Manage disks on a remote host.
osd Prepare a data disk on remote host.
repo Repo definition management
admin Push configuration and client.admin key to a remote
host.
config Copy ceph.conf to/from remote host(s)
uninstall Remove Ceph packages from remote hosts.
purgedata Purge (delete, destroy, discard, shred) any Ceph data
from /var/lib/ceph
purge Remove Ceph packages from remote hosts and purge all
data.
forgetkeys Remove authentication keys from the local directory.
pkg Manage packages on remote hosts.
calamari Install and configure Calamari nodes. Assumes that a
repository with Calamari packages is already
configured. Refer to the docs for examples
(http://ceph.com/ceph-deploy/docs/conf.html)
See 'ceph-deploy <command> --help' for help on a specific command
(2)ceph-deploy new帮助命令
命令:ceph-deploy new --help
解析:查看ceph-deploy new支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy new [-h] [--no-ssh-copykey] [--fsid FSID]
[--cluster-network CLUSTER_NETWORK]
[--public-network PUBLIC_NETWORK]
MON [MON ...]
Start deploying a new cluster, and write a CLUSTER.conf and keyring for it.
positional arguments:
MON initial monitor hostname, fqdn, or hostname:fqdn pair
optional arguments:
-h, --help show this help message and exit
--no-ssh-copykey do not attempt to copy SSH keys
--fsid FSID provide an alternate FSID for ceph.conf generation
--cluster-network CLUSTER_NETWORK
specify the (internal) cluster network
--public-network PUBLIC_NETWORK
specify the public network for a cluster
(3)ceph-deploy mon帮助命令
命令:ceph-deploy mon --help
解析:查看ceph-deploy mon支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy mon [-h] {add,create,create-initial,destroy} ...
Ceph MON Daemon management
positional arguments:
{add,create,create-initial,destroy}
add Add a monitor to an existing cluster:
ceph-deploy mon add node1
Or:
ceph-deploy mon add --address 192.168.1.10 node1
If the section for the monitor exists and defines a `mon addr` that
will be used, otherwise it will fallback by resolving the hostname to an
IP. If `--address` is used it will override all other options.
create Deploy monitors by specifying them like:
ceph-deploy mon create node1 node2 node3
If no hosts are passed it will default to use the
`mon initial members` defined in the configuration.
create-initial Will deploy for monitors defined in `mon initial
members`, wait until they form quorum and then
gatherkeys, reporting the monitor status along the
process. If monitors don't form quorum the command
will eventually time out.
destroy Completely remove Ceph MON from remote host(s)
optional arguments:
-h, --help show this help message and exit
(4)ceph-deploy osd帮助命令
命令:ceph-deploy osd --help
解析:查看ceph-deploy osd支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy osd [-h] {list,create} ...
Create OSDs from a data disk on a remote host:
ceph-deploy osd create {node} --data /path/to/device
For bluestore, optional devices can be used::
ceph-deploy osd create {node} --data /path/to/data --block-db /path/to/db-device
ceph-deploy osd create {node} --data /path/to/data --block-wal /path/to/wal-device
ceph-deploy osd create {node} --data /path/to/data --block-db /path/to/db-device --block-wal /path/to/wal-device
For filestore, the journal must be specified, as well as the objectstore::
ceph-deploy osd create {node} --filestore --data /path/to/data --journal /path/to/journal
For data devices, it can be an existing logical volume in the format of:
vg/lv, or a device. For other OSD components like wal, db, and journal, it
can be logical volume (in vg/lv format) or it must be a GPT partition.
positional arguments:
{list,create}
list List OSD info from remote host(s)
create Create new Ceph OSD daemon by preparing and activating a
device
optional arguments:
-h, --help show this help message and exit
(5)ceph-deploy mgr帮助命令
命令:ceph-deploy mgr --help
解析:查看ceph-deploy mgr支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy purgedata [-h] HOST [HOST ...]
Purge (delete, destroy, discard, shred) any Ceph data from /var/lib/ceph
positional arguments:
HOST hosts to purge Ceph data from
optional arguments:
-h, --help show this help message and exit
(6)ceph-deploy mds帮助命令
命令:ceph-deploy mds --help
解析:查看ceph-deploy mds支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy mds [-h] {create} ...
Ceph MDS daemon management
positional arguments:
{create}
create Deploy Ceph MDS on remote host(s)
optional arguments:
-h, --help show this help message and exit
(7)ceph-deploy rgw帮助命令
命令:ceph-deploy rgw --help
解析:查看ceph-deploy rgw支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy rgw [-h] {create} ...
Ceph RGW daemon management
positional arguments:
{create}
create Create an RGW instance
optional arguments:
-h, --help show this help message and exit
(8)ceph dashboard帮助命令
命令:ceph dashboard --help
解析:查看ceph dashboard支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
General usage:
==============
usage: ceph [-h] [-c CEPHCONF] [-i INPUT_FILE] [-o OUTPUT_FILE]
[--setuser SETUSER] [--setgroup SETGROUP] [--id CLIENT_ID]
[--name CLIENT_NAME] [--cluster CLUSTER]
[--admin-daemon ADMIN_SOCKET] [-s] [-w] [--watch-debug]
[--watch-info] [--watch-sec] [--watch-warn] [--watch-error]
[--watch-channel {cluster,audit,*}] [--version] [--verbose]
[--concise] [-f {json,json-pretty,xml,xml-pretty,plain}]
[--connect-timeout CLUSTER_TIMEOUT] [--block] [--period PERIOD]
Ceph administration tool
optional arguments:
-h, --help request mon help
-c CEPHCONF, --conf CEPHCONF
ceph configuration file
-i INPUT_FILE, --in-file INPUT_FILE
input file, or "-" for stdin
-o OUTPUT_FILE, --out-file OUTPUT_FILE
output file, or "-" for stdout
--setuser SETUSER set user file permission
--setgroup SETGROUP set group file permission
--id CLIENT_ID, --user CLIENT_ID
client id for authentication
--name CLIENT_NAME, -n CLIENT_NAME
client name for authentication
--cluster CLUSTER cluster name
--admin-daemon ADMIN_SOCKET
submit admin-socket commands ("help" for help
-s, --status show cluster status
-w, --watch watch live cluster changes
--watch-debug watch debug events
--watch-info watch info events
--watch-sec watch security events
--watch-warn watch warn events
--watch-error watch error events
--watch-channel {cluster,audit,*}
which log channel to follow when using -w/--watch. One
of ['cluster', 'audit', '*']
--version, -v display version
--verbose make verbose
--concise make less verbose
-f {json,json-pretty,xml,xml-pretty,plain}, --format {json,json-pretty,xml,xml-pretty,plain}
--connect-timeout CLUSTER_TIMEOUT
set a timeout for connecting to the cluster
--block block until completion (scrub and deep-scrub only)
--period PERIOD, -p PERIOD
polling period, default 1.0 second (for polling
commands only)
Local commands:
===============
ping <mon.id> Send simple presence/life test to a mon
<mon.id> may be 'mon.*' for all mons
daemon {type.id|path} <cmd>
Same as --admin-daemon, but auto-find admin socket
daemonperf {type.id | path} [stat-pats] [priority] [<interval>] [<count>]
daemonperf {type.id | path} list|ls [stat-pats] [priority]
Get selected perf stats from daemon/admin socket
Optional shell-glob comma-delim match string stat-pats
Optional selection priority (can abbreviate name):
critical, interesting, useful, noninteresting, debug
List shows a table of all available stats
Run <count> times (default forever),
once per <interval> seconds (default 1)
Monitor commands:
=================
dashboard create-self-signed-cert Create self signed certificate
dashboard get-enable-browsable-api Get the ENABLE_BROWSABLE_API option value
dashboard get-rest-requests-timeout Get the REST_REQUESTS_TIMEOUT option value
dashboard get-rgw-api-access-key Get the RGW_API_ACCESS_KEY option value
dashboard get-rgw-api-admin-resource Get the RGW_API_ADMIN_RESOURCE option value
dashboard get-rgw-api-host Get the RGW_API_HOST option value
dashboard get-rgw-api-port Get the RGW_API_PORT option value
dashboard get-rgw-api-scheme Get the RGW_API_SCHEME option value
dashboard get-rgw-api-secret-key Get the RGW_API_SECRET_KEY option value
dashboard get-rgw-api-ssl-verify Get the RGW_API_SSL_VERIFY option value
dashboard get-rgw-api-user-id Get the RGW_API_USER_ID option value
dashboard set-enable-browsable-api <value> Set the ENABLE_BROWSABLE_API option value
dashboard set-login-credentials <username> <password> Set the login credentials
dashboard set-rest-requests-timeout <int> Set the REST_REQUESTS_TIMEOUT option value
dashboard set-rgw-api-access-key <value> Set the RGW_API_ACCESS_KEY option value
dashboard set-rgw-api-admin-resource <value> Set the RGW_API_ADMIN_RESOURCE option value
dashboard set-rgw-api-host <value> Set the RGW_API_HOST option value
dashboard set-rgw-api-port <int> Set the RGW_API_PORT option value
dashboard set-rgw-api-scheme <value> Set the RGW_API_SCHEME option value
dashboard set-rgw-api-secret-key <value> Set the RGW_API_SECRET_KEY option value
dashboard set-rgw-api-ssl-verify <value> Set the RGW_API_SSL_VERIFY option value
dashboard set-rgw-api-user-id <value> Set the RGW_API_USER_ID option value
dashboard set-session-expire <int> Set the session expire timeout
(9)ceph-deploy admin帮助命令
命令:ceph-deploy admin --help
解析:查看ceph-deploy admin支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy admin [-h] HOST [HOST ...]
Push configuration and client.admin key to a remote host.
positional arguments:
HOST host to configure for Ceph administration
optional arguments:
-h, --help show this help message and exit
(10)ceph-deploy disk帮助命令
命令:ceph-deploy disk --help
解析:查看ceph-deploy disk支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy disk [-h] {zap,list} ...
Manage disks on a remote host.
positional arguments:
{zap,list}
zap destroy existing data and filesystem on LV or partition
list List disk info from remote host(s)
optional arguments:
-h, --help show this help message and exit
(11)ceph-deploy purge帮助命令
命令:ceph-deploy purge --help
解析:查看ceph-deploy purge支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy purge [-h] HOST [HOST ...]
Remove Ceph packages from remote hosts and purge all data.
positional arguments:
HOST hosts to purge Ceph from
optional arguments:
-h, --help show this help message and exit
(12)ceph-deploy purgedata帮助命令
命令:ceph-deploy purgedata --help
解析:查看ceph-deploy purgedata支持全部命令和选项,在实际工作中,查看这个手册应该是必备之选。
usage: ceph-deploy purgedata [-h] HOST [HOST ...]
Purge (delete, destroy, discard, shred) any Ceph data from /var/lib/ceph
positional arguments:
HOST hosts to purge Ceph data from
optional arguments:
-h, --help show this help message and exit
以上,感谢。
2022年11月26日