optional arguments: -h, --help show this help message and exit -v, --version show program's version number and exit --config [CONFIG_FILE] Use custom configuration from a file --show [STREAM[:LVL]] List of comma separated builtin logs, or logging streams optionally followed by LEVEL (DEBUG,INFO,...). Builtin streams are: "test": test output; "debug": tracebacks and other debugging info; "app": application output; "early": early logging of other streams, including test (very verbose); "remote": fabric/paramiko debug; "all": all builtin streams; "none": disables regular output (leaving only errors enabled). By default: 'app' -s, --silent disables regular output (leaving only errors enabled)
subcommands: valid subcommands
{config,diff,distro,exec-path,list,multiplex,plugins,run,sysinfo,variants} subcommand help config Shows avocado config keys diff Shows the difference between 2 jobs. distro Shows detected Linux distribution exec-path Returns path to avocado bash libraries and exits. list List available tests multiplex Tool to analyze and visualize test variants and params plugins Displays plugin information run Runs one or more tests (native test, test alias, binary or script) sysinfo Collect system information variants Tool to analyze and visualize test variants and params Failed to load plugin from module "avocado_runner_remote": ImportError('No module named api',) Failed to load plugin from module "avocado_runner_docker": ImportError('No module named api',) Failed to load plugin from module "avocado_runner_vm": ImportError('No module named api',)
name - name of the parameter (key) --- 参数的名称(键) path - where to look for this parameter (when not specified uses mux-path) --- 在何处查找此参数(未指定时使用mux-path) default - what to return when param not found --- 未找到参数时返回的内容
path有点棘手。Avocado使用tree来表示参数。在简单的场景中,您不必担心,您将在默认路径中找到所有值(values),但最终您可能需要check-out Test parameters以了解详细信息。
The “yaml_to_mux” plugin accepts YAML files. Those will create a tree-like structure, store the variables as parameters and use custom tags to mark locations as “multiplex” domains.
[root@cephL]# vi /root/mac/examples/tests/passtest.py #!/usr/bin/env python from avocado import main from avocado import Test class PassTest(Test): """ Example test that passes. :avocado: tags=fast """ def test(self): """ A test simply doesn't have to fail in order to pass """ pass if __name__ == "__main__": main()
nl passwd | sed -n '10,20p' (打印10行到20行) nl passwd | sed -n '/operator/,/games/p' nl passwd | sed -n '10!p' (不选择第10行) nl passwd | sed -n '10,20!p' (不选择10行到20行)
定位间隔几行:first~step nl passwd | sed -n '1~2p' (从第1行开始,间隔2-1行,再打印)
基本操作命令(2)
1 2 3 4 5 6 7 8 9 10 11
-a (新增行)/ i(插入行) -c (替代行) -d(删除行) nl passwd | sed '5a ===========' (第5行和第6行之间增加分隔符===========) nl passwd | sed '1,5a===========' (第1行和第5行之间,每一行都增加分隔符===========) nl passwd | sed '5i===========' (第5行之前插入分隔符===========) nl passwd | sed '1,5i===========' (第1行和第5行之前,每一行都插入分隔符===========) nl passwd | sed '40c 123123' (将40行替换成123123) nl passwd | sed '35,40c 123123' (将35行到40行替换成123123,35行以后的内容就没有了,只有123123这一行,并不是每一行进行替换,而是对这些行做一个整体的替换) nl passwd | sed '/mooc/d' (删除mooc所在行) sed不会改变源文件的内容,如果要保存结果需要重定向
案例:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
案例一:优化服务器的配置 在ssh的配置文件加入相应文本: " Port 52113 PermitRootLogin no PermitEmptyPasswords no " sed '$a \ port\ 52113 \n permitroologin no' sshd_config (空格需要\转义)
案例二:文本处理 删除文本中空行 sed '/^$/d' sshd_config (空行用正则/^$/表示)
案例三:服务器日志处理 服务器log中找出error报错 sed -n '/Error/p'
基本操作命令(3)
1 2 3 4 5 6 7 8 9 10 11
-s(替换):分隔符/,#等 sed 's/nologin/l/' passwd (nologin替换为l) -g(全局):替换标志 sed 's/:/%/' passwd (只是把每一行的第一个':'替换为'%') sed 's/:/%/g' passwd (所有的':'都被替换为'%')
案例四:数据筛选 获取enp0s8的ip ifconfig enp0s8 | sed -n '/inet /p' | sed 's/inet//' (centos7) ifconfig enp0s8 | sed -n '/inet /p' | sed 's/inet.*r://' (Ubuntu上有:) ifconfig enp0s8 | sed -n '/inet /p' | sed 's/inet//' | sed 's/n.*$//'
高级操作命令(1)
1 2
-{}:多个sed命令,用;分开 nl passwd | sed '{20,30d;s/nologin/login/}' (先删除20行到30行,然后剩下的行nologin替换成login)
高级操作命令(2)
1 2 3 4 5
-n:读取下一个输入行(用下一个命令处理) nl passwd | sed -n '{n;p}' (你会发现跳行,输出2、4、6、8行。执行过程是sed读入一行后,接着n又读入下一行。输出偶数行) nl passwd | sed -n '2~2p' (输出偶数行) nl passwd | sed -n '{p;n}' (输出奇数行) nl passwd | sed -n '1~2p' (输出奇数行,与上一条命令相等)
ceph-volume lvm(使用LVM和LVM-based技术,像dmcache去部署OSD) 1、activate Discover and mount the LVM device associated with an OSD ID and start the Ceph OSD(Discover并mount与OSD ID关联的LVM设备,然后启动Ceph OSD) 2、prepare Format an LVM device and associate it with an OSD(Format LVM device并将其与OSD关联) 3、create Create a new OSD from an LVM device(从LVM device创建新的OSD) 4、list list logical volumes and devices associated with Ceph(列出与Ceph相关的logical volumes和devices) 5、batch Automatically size devices for multi-OSD provisioning with minimal interaction(自动调整devices大小,以最少的交互进行多OSD配置) 6、trigger systemd helper to activate an OSD(systemd助手来激活OSD) 7、zap Removes all data and filesystems from a logical volume or partition.(从logical volume或分区中删除所有数据和文件系统。)
ceph-volume simple(使用ceph-volume管理已部署的OSD) 1、trigger systemd helper to activate an OSD(systemd助手来激活OSD) 2、activate Enable systemd units to mount configured devices and start a Ceph OSD(使systemd units可以mount已配置的devices,并启动Ceph OSD) 3、scan Capture metadata from all running ceph-disk OSDs, OSD data partition or directory(从所有正在运行的ceph-disk OSDs,OSD数据分区或目录中捕获元数据)
Description: 校验chunk的数量,每个data chunk都包含在计算范围内。该数字被用作耐久性估算。例如,如果c = 2,则可以在不丢失数据的情况下down掉2个OSD。 The number of parity chunks each of which includes each data chunk in its calculation range. The number is used as a durability estimator. For instance, if c=2, 2 OSDs can be down without losing data. Type: Integer Required: No. Default: 2
Group the coding and data chunks into sets of size locality. For instance, for k=4 and m=2, when locality=3 two groups of three are created. Each set can be recovered without reading chunks from another set. Type: Integer Required: Yes. Example: 3
Description: crush bucket的type,其中由l定义的每个chunks集合将被存储。例如,如果它被设置为rack,则每个l chunks将被放置在不同的rack中。它用于创建CRUSH rule step,如step选择rack。如果没有设置,则不会进行这样的分组。 The type of the crush bucket in which each set of chunks defined by l will be stored. For instance, if it is set to rack, each group of l chunks will be placed in a different rack. It is used to create a CRUSH rule step such as step choose rack. If it is not set, no such grouping is done. Type: String Required: No.
Ensure that no two chunks are in a bucket with the same failure domain. For instance, if the failure domain is host no two chunks will be stored on the same host. It is used to create a CRUSH rule step such as step chooseleaf host. Type: String Required: No. Default: host
Description: crush bucket名字用于CRUSH rule的first step。"take"为step的默认值。 The name of the crush bucket used for the first step of the CRUSH rule. For intance step take default. Type: String Required: No. Default: default
在erasure coding方案中,pool创建参数将自动生成适当的rule。 有关详细信息,请参阅Create a Pool。
在随后的例子中,我们将backing storage pool称为cold-storage。
SETTING UP A CACHE POOL
设置cache pool遵循与standard storage方案相同的过程,但有这样的区别:作为cache tier(缓存层)的驱动器通常是服务器中的高性能驱动器,并具有自己的CRUSH rule。在设置这样的rule时,应该考虑具有高性能驱动器的主机,忽略不具有高性能驱动器的主机。有关详细信息,请参阅Placing Different Pools on Different OSDs。
ceph osd pool set {cachepool} hit_set_count 12 ceph osd pool set {cachepool} hit_set_period 14400 ceph osd pool set {cachepool} target_max_bytes 1000000000000
1
注意:更大的hit_set_count会导致ceph-osd进程消耗更多的内存。
分级访问,随着时间的推移,可以让Ceph确定是否一个Ceph client访问某个object至少一次,或者在一段时间内(“age” vs “temperature”)超过一次。