首页 文章 精选 留言 我的

精选列表

搜索[命令行界面],共10000篇文章
优秀的个人博客,低调大师

阿里云 云存储OSS的命令行使用

1.简介 OSS,Object Storage Service,对象存储服务。简单讲就是把文件放在云上。 官网介绍: https://www.aliyun.com/product/oss 2.阿里云申请与配置 2.1 创建AccessKey 图2-1 创建accessKey 2.2 创建OSS的bucket bucket是虚拟目录,起到nameSpace的作用。 图2-2 创建bucket 3.安装客户端 3.1 python 去python.org自行下载。 3.2 OSScmd SDK 去阿里云下载,地址: https://help.aliyun.com/document_detail/32026.html?spm=5176.doc32013.6.228.hFcfPv 3.3 客户端配置 //config client python osscmd config --host=oss-cn-shanghai.aliyuncs.com --id={access key} --key={key secret} 4.使用示例 4.1 console 控制台 //see files python osscmd ls oss://wca-bucket/ //upload python osscmd put /d/code/hello.txt oss://wca-bucket/ //download python osscmd get oss://wca-bucket/hello.txt /d/code/hello.txt 更多命令可见:https://help.aliyun.com/document_detail/32187.html 4.2 web 控制台 也可以在portal上查看操作结果,见图4-1。 图4-1 web控制台

优秀的个人博客,低调大师

openstack 命令行管理十七 - 宿主主机管理 (备忘)

帮助信息 [root@station140 ~(keystone_admin)]# nova help | grep hyper hypervisor-list List hypervisors. hypervisor-servers List instances belonging to specific hypervisors. hypervisor-show Display the details of the specified hypervisor. hypervisor-stats Get hypervisor statistics over all compute nodes. hypervisor-uptime Display the uptime of the specified hypervisor. 查询物理服务器 [root@hh-yun-puppet-129021 ~(keystone_admin)]# nova hypervisor-list | more +-----+-----------------------------------+ | ID | Hypervisor hostname | +-----+-----------------------------------+ | 1 | hh-yun-compute-130118.vclound.com | | 3 | hh-yun-compute-130117.vclound.com | | 5 | hh-yun-compute-130119.vclound.com | | 7 | hh-yun-compute-130121.vclound.com | | 9 | hh-yun-compute-130122.vclound.com | | 11 | hh-yun-compute-130120.vclound.com | | 13 | hh-yun-compute-130123.vclound.com | | 15 | hh-yun-compute-130127.vclound.com | | 17 | hh-yun-compute-130140.vclound.com | | 19 | hh-yun-compute-130137.vclound.com | | 21 | hh-yun-compute-130130.vclound.com | | 39 | hh-yun-compute-130136.vclound.com | | 25 | hh-yun-compute-130163.vclound.com | | 23 | hh-yun-compute-130152.vclound.com | | 27 | hh-yun-compute-130145.vclound.com | +-----+-----------------------------------+ 显示某个物理主机详细信息方法 [root@hh-yun-puppet-129021 ~(keystone_admin)]# nova hypervisor-show hh-yun-compute-130228.vclound.com +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Property | Value | +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | cpu_info_arch | x86_64 | | cpu_info_features | ["ssse3", "pge", "avx", "clflush", "sep", "syscall", "vme", "dtes64", "tsc", "sse", "xsave", "vmx", "erms", "xtpr", "cmov", "smep", "pcid", "est", "pat", "monitor", "smx", "lm", "msr", "nx", "fxsr", "tm", "sse4.1", "pae", "sse4.2", "pclmuldq", "acpi", "tsc-deadline", "popcnt", "mmx", "osxsave", "cx8", "mce", "mtrr", "rdtscp", "ht", "dca", "lahf_lm", "pdcm", "mca", "pdpe1gb", "apic", "fsgsbase", "f16c", "pse", "ds", "invtsc", "pni", "tm2", "aes", "sse2", "ss", "pbe", "de", "fpu", "cx16", "pse36", "ds_cpl", "rdrand", "x2apic"] | | cpu_info_model | SandyBridge | | cpu_info_topology_cores | 6 | | cpu_info_topology_sockets | 1 | | cpu_info_topology_threads | 2 | | cpu_info_vendor | Intel | | current_workload | 0 | | disk_available_least | 302 | | free_disk_gb | 358 | | free_ram_mb | 12538 | | host_ip | 10.199.130.228 | | hypervisor_hostname | hh-yun-compute-130228.vclound.com | | hypervisor_type | QEMU | | hypervisor_version | 1005003 | | id | 661 | | local_gb | 1098 | | local_gb_used | 740 | | memory_mb | 193274 | | memory_mb_used | 180736 | | running_vms | 24 | | service_host | hh-yun-compute-130228.vclound.com | | service_id | 689 | | vcpus | 24 | | vcpus_used | 109 | +---------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 显示某个主机当前使用的资源方法 [root@station140 ~(keystone_admin)]# nova hypervisor-stats +----------------------+-------+ | Property | Value | +----------------------+-------+ | count | 1 | | vcpus_used | 0 | | local_gb_used | 0 | | memory_mb | 7872 | | current_workload | 0 | | vcpus | 2 | | running_vms | 0 | | free_disk_gb | 15 | | disk_available_least | 7 | | local_gb | 15 | | free_ram_mb | 7360 | | memory_mb_used | 512 | +----------------------+-------+ 查询某个主机下当前使用了多少个云主机方法 [root@hh-yun-puppet-129021 ~(keystone_admin)]# nova hypervisor-servers hh-yun-compute-130228.vclound.com +--------------------------------------+-------------------+---------------+-----------------------------------+ | ID | Name | Hypervisor ID | Hypervisor Hostname | +--------------------------------------+-------------------+---------------+-----------------------------------+ | 6f0848d4-f1e4-48ab-ac61-9381a623df8e | instance-00000575 | 661 | hh-yun-compute-130228.vclound.com | | b804e517-8627-42e4-8ee3-147b85a45e49 | instance-0000057d | 661 | hh-yun-compute-130228.vclound.com | | 3f21c3fb-582d-49a6-92e1-a6cd700b7771 | instance-00003a04 | 661 | hh-yun-compute-130228.vclound.com | | 6d20c830-b58e-453d-a1ff-c3eaf922649c | instance-00003a88 | 661 | hh-yun-compute-130228.vclound.com | | 0169068f-dc37-4374-8c8d-3ab522341971 | instance-00003a89 | 661 | hh-yun-compute-130228.vclound.com | | 4047d7c9-53b0-44f4-8d24-4bece2490e5c | instance-000043c7 | 661 | hh-yun-compute-130228.vclound.com | | b086b6ba-bce6-4538-8f48-277624f91388 | instance-000043c9 | 661 | hh-yun-compute-130228.vclound.com | | ea3c9c00-6d75-4b32-84f5-ce8a8a9dee2c | instance-00004ea1 | 661 | hh-yun-compute-130228.vclound.com | | b3de708c-fcfd-4bae-a40f-bb6c8ffd24cd | instance-0000597d | 661 | hh-yun-compute-130228.vclound.com | | 632adb45-bc85-4357-8771-45aa86f9a30e | instance-000059b1 | 661 | hh-yun-compute-130228.vclound.com | | a3c0a387-6c0f-48da-9088-577f72684730 | instance-00007597 | 661 | hh-yun-compute-130228.vclound.com | | 56a15032-a9c0-4bfa-a8b4-198e527507b4 | instance-000089f7 | 661 | hh-yun-compute-130228.vclound.com | | bd81ca6a-1c1e-48a6-94b4-22b5c2953e40 | instance-00009dbf | 661 | hh-yun-compute-130228.vclound.com | | b285e1ef-c634-44ec-a299-487995cb29df | instance-00009e2b | 661 | hh-yun-compute-130228.vclound.com | | b6daf848-ab91-453b-9015-c3d4b7d453f5 | instance-0000a1e5 | 661 | hh-yun-compute-130228.vclound.com | | 17a1c5a6-e817-40a3-9f3d-dd94c8eb0151 | instance-0000a97f | 661 | hh-yun-compute-130228.vclound.com | | fa65ab21-05c9-473f-8e7b-6bb40b2c6d58 | instance-0000bef9 | 661 | hh-yun-compute-130228.vclound.com | | ec66f95f-7d37-4645-9ec0-769e60e530e3 | instance-0000e236 | 661 | hh-yun-compute-130228.vclound.com | | d41a1bef-5ee7-4b70-b7c8-036465023f3b | instance-0000e3f8 | 661 | hh-yun-compute-130228.vclound.com | | ab7e3a16-c9aa-4f9b-ba1a-6e79e58be40c | instance-0000f743 | 661 | hh-yun-compute-130228.vclound.com | | ce42403a-5bcf-4141-9dce-5963f1651307 | instance-0001273d | 661 | hh-yun-compute-130228.vclound.com | | e534f3be-007c-470c-9ebb-80ab73ce2ee2 | instance-00012967 | 661 | hh-yun-compute-130228.vclound.com | | 62fdeda2-89a2-46c2-b522-c18495481a94 | instance-00012e35 | 661 | hh-yun-compute-130228.vclound.com | | bab1461c-0c14-4845-8daa-c58a020be3b9 | instance-00012e37 | 661 | hh-yun-compute-130228.vclound.com | +--------------------------------------+-------------------+---------------+-----------------------------------+ 利用 nova 命令查询正常工作中的计算节点 参考命令nova service-list (下面是测试环境下的显示) +------------------+----------------------------------+----------------+---------+-------+----------------------------+-----------------+ | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason | +------------------+----------------------------------+----------------+---------+-------+----------------------------+-----------------+ | nova-conductor | gz-controller-209131.vclound.com | internal | enabled | up | 2016-03-14T03:47:04.000000 | - | | nova-scheduler | gz-controller-209131.vclound.com | internal | enabled | up | 2016-03-14T03:47:03.000000 | - | | nova-cert | gz-controller-209131.vclound.com | internal | enabled | up | 2016-03-14T03:47:03.000000 | - | | nova-cert | gz-controller-209132.vclound.com | internal | enabled | up | 2016-03-14T03:46:58.000000 | - | | nova-scheduler | gz-controller-209132.vclound.com | internal | enabled | up | 2016-03-14T03:46:58.000000 | - | | nova-conductor | gz-controller-209132.vclound.com | internal | enabled | up | 2016-03-14T03:47:01.000000 | - | | nova-console | gz-controller-209131.vclound.com | internal | enabled | up | 2016-03-14T03:46:57.000000 | - | | nova-console | gz-controller-209132.vclound.com | internal | enabled | up | 2016-03-14T03:46:57.000000 | - | | nova-consoleauth | gz-controller-209131.vclound.com | internal | enabled | down | 2016-01-07T03:02:49.000000 | - | | nova-consoleauth | gz-controller-209132.vclound.com | internal | enabled | up | 2016-03-14T03:46:57.000000 | - | | nova-compute | gz-compute-209126.vclound.com | develop-zone | enabled | down | 2016-02-12T14:26:17.000000 | - | | nova-compute | gz-compute-209127.vclound.com | develop-zone | enabled | up | 2016-03-14T03:47:01.000000 | - | | nova-compute | gz-compute-209230 | qa-zone | enabled | up | 2016-03-14T03:46:58.000000 | None | | nova-compute | gz-compute-209232 | qa-master-zone | enabled | up | 2016-03-14T03:47:00.000000 | - | | nova-compute | gz-compute-209233 | develop-zone | enabled | up | 2016-03-14T03:46:59.000000 | - | +------------------+----------------------------------+----------------+---------+-------+----------------------------+-----------------+ 说明: Brinay 描述服务类型, 常见服务有 nova-conductor nova 程序主控制器, 接受 api 请求 nova-scheduler nova 调度器, 进行主机开启, 关闭, 重启调度 nova-cert 证书管理中心, 验证用户权限 nova-console vnc 控制器 nova-consoleauth vnc 认证中心(对用户 token 进行认证) nova-compute 计算节点 Host 主机名 Zone 把不同物理机划分成不同分区 Internal 常见为 openstack 核心程序 develop-zone 供开发同事使用的计算节点集群 qa-zone 供测试同事使用的计算节点集群 Status Up 服务可用 Down 服务不可用 (注, 在集群中, 只能够有一个 nova-console-auth 处于 up 状态) Updated 服务启动时间 Disable Reason 手动关闭服务时, 可以添加注释, 注释可在该列中进行显示 Zone 说明 由于集群中机器比较多,申请用户也比较多,为了更好地进行服务器规划, 我们计划把不同机柜中的服务器划分到不同 zone 中, 并限制不同部门的同事使用不同的 zone. 规划: 开发同事只在 develop-zone 中进行云主机申请 测试同事只在 qa-zone 中进行云主机申请 Sandbox项目只在 sandbox中进行云主机申请 指定申请机器使用使用不同的 zone 方法 nova boot --flavor b2c_web_1core--image Centos6.6_x86_64_1.12--nic net-id=fe662a3d-dc73-48d2-ba0f-920cd15da5c2 terry.vclound.com--availability-zonedevelop-zone 机器 zone 规划 zone 机器数量 Cpu core Memory Qa-zone 148(gz) 24 X 148 = 3552 192X148 = 28416 Qa-master-zone 47(gz) 24 X 47= 1128 192X47 = 9024 Develop-zone 121(gz)+ 68(sh) 24 X 189= 4536 192X189 = 36288 sandbox 8(gz) 24 X 8= 192 192X8 = 1536 查询当前服务器中具有多少zone 的物理主机方法 [root@hh-yun-puppet-129021~(keystone_admin)]# nova aggregate-list +----+----------------+-------------------+ | Id | Name | Availability Zone | +----+----------------+-------------------+ | 3 | develop-sas | develop-zone | | 7 | develop-ssd | develop-zone | | 9 | qa-glusterfs | qa-zone | | 11 | qa-ssd | qa-zone | | 13 | pre-release | pre-zone | | 15 | qa-sas | qa-zone | | 19 | qa-master-zone | qa-master-zone | | 20 | sandbox-zone | sandbox-zone | +----+----------------+-------------------+ 查询在不同 zone 下的物理节点方法 留意 hosts 中列出的就是在该 zone 中可用的物理机 设定不同 zone 方法 [root@gz-controller-209131~(keystone_admin)]# nova aggregate-create new-zone cgroup-zone +----+----------+-------------------+-------+---------------------------------+ | Id | Name | Availability Zone | Hosts | Metadata | +----+----------+-------------------+-------+---------------------------------+ | 20 | new-zone | cgroup-zone | | 'availability_zone=cgroup-zone' | +----+----------+-------------------+-------+---------------------------------+ 把主机定义到指定的 zone 中 [root@gz-controller-209131 ~(keystone_admin)]# nova aggregate-add-host new-zone gz-compute-209127.vclound.com Host gz-compute-209127.vclound.com has been successfully added for aggregate 20 +----+----------+-------------------+---------------------------------+---------------------------------+ | Id | Name | Availability Zone | Hosts | Metadata | +----+----------+-------------------+---------------------------------+---------------------------------+ | 20 | new-zone | cgroup-zone | 'gz-compute-209127.vclound.com' | 'availability_zone=cgroup-zone' | +----+----------+-------------------+---------------------------------+---------------------------------+ 在指定 zone 中删除主机 [root@gz-controller-209131 ~(keystone_admin)]# nova aggregate-remove-host new-zone gz-compute-209127.vclound.com Host gz-compute-209127.vclound.com has been successfully removed from aggregate 20 +----+----------+-------------------+-------+---------------------------------+ | Id | Name | Availability Zone | Hosts | Metadata | +----+----------+-------------------+-------+---------------------------------+ | 20 | new-zone | cgroup-zone | | 'availability_zone=cgroup-zone' | +----+----------+-------------------+-------+---------------------------------+ 删除指定 zone [root@gz-controller-209131~(keystone_admin)]# nova aggregate-delete new-zone Aggregate 20 has beensuccessfully deleted.

优秀的个人博客,低调大师

openstack 命令行管理五 - 磁盘配额管理(备忘)

 磁盘配额由 Swift 1.8 (OpenStack Grizzly) 管理 Container Quotas: Limits the total size (in bytes) or number of objects that can be stored in a single container. Account Quotas: Limits the total size (in bytes) that a user has available in the Object Storage service. [root@station140 ~(keystone_admin)]# cinder help | grep quota quota-class-show List the quotas for a quota class. quota-class-update Update the quotas for a quota class. quota-defaults List the default quotas for a tenant. quota-show List the quotas for a tenant. quota-update Update the quotas for a tenant. quota-usage List the quota usage for a tenant. 配额默认针对 tenants 级别, 倒不如改成针对用户级别更方便管理 下面方法限制用户在所有 project 中的磁盘总大小 /etc/glance/glance-api.conf user_storage_quota = 0 <- 以 byte 进行计算 ex: 5368709120 (5G) ex: icehouse 版本后, 需要修改配置文件 glance-api.conf 中 image_member_quota 配置 默认配额配置文件 /etc/cinder/cinder.conf #quota_volumes=10 #quota_snapshots=10 #quota_gigabytes=1000 分别查询, 默认或某个 project 配额 [root@station140 ~(keystone_admin)]# cinder quota-defaults default +-----------+-------+ | Property | Value | +-----------+-------+ | gigabytes | 1000 | | snapshots | 10 | | volumes | 10 | +-----------+-------+ [root@station140 ~(keystone_admin)]# cinder quota-show 9467f30b8bba4770a06a687e4584636b <- 可选 cloud +-----------+-------+ | Property | Value | +-----------+-------+ | gigabytes | 1000 | | snapshots | 10 | | volumes | 10 | +-----------+-------+ 修改 cloud 配额 [root@station140 ~(keystone_admin)]# cinder quota-update --volumes 15 cloud 查询修改后设定 [root@station140 ~(keystone_admin)]# cinder quota-show cloud +-----------+-------+ | Property | Value | +-----------+-------+ | gigabytes | 1000 | | snapshots | 10 | | volumes | 15 | +-----------+-------+

优秀的个人博客,低调大师

openstack 命令行管理十一 - 安全组管理 (备忘)

 参考官方资料 You must modify the rules for the default security group because users cannot access instances that use the default group from any IP address outside the cloud. You can modify the rules in a security group to allow access to instances through different ports and protocols. For example, you can modify rules to allow access to instances through SSH, to ping them, or to allow UDP traffic – for example, for a DNS server running on an instance. You specify the following parameters for rules: Source of traffic. Enable traffic to instances from either IP addresses inside the cloud from other group members or from all IP addresses. Protocol. Choose TCP for SSH, ICMP for pings, or UDP. Destination port on virtual machine. Defines a port range. To open a single port only, enter the same value twice. ICMP does not support ports: Enter values to define the codes and types of ICMP traffic to be allowed. Rules are automatically enforced as soon as you create or modify them. 注: 已通过测试, 修改默认 secgroup 或自定义 secgroup 都可以完成数据访问测试 帮助 [root@station140 ~(keystone_admin)]# nova help | grep secgroup add-secgroup Add a Security Group to a server. list-secgroup List Security Group(s) of a server. remove-secgroup Remove a Security Group from a server. secgroup-add-group-rule secgroup-add-rule Add a rule to a security group. secgroup-create Create a security group. secgroup-delete Delete a security group. secgroup-delete-group-rule secgroup-delete-rule secgroup-list List security groups for the current tenant. secgroup-list-rules secgroup-update Update a security group. 创建自定义安全组 [root@station140 ~(keystone_admin)]# nova secgroup-create terry "allow ping and ssh" +--------------------------------------+-------+--------------------+ | Id | Name | Description | +--------------------------------------+-------+--------------------+ | 6966a8e4-0980-40ad-a409-baac65b60287 | terry | allow ping and ssh | +--------------------------------------+-------+--------------------+ 列出当前所有安全组 [root@station140 ~(keystone_admin)]# nova secgroup-list +--------------------------------------+---------+--------------------+ | Id | Name | Description | +--------------------------------------+---------+--------------------+ | 91a191a6-b89e-4f87-99c0-0fb985985978 | default | default | | 6966a8e4-0980-40ad-a409-baac65b60287 | terry | allow ping and ssh | +--------------------------------------+---------+--------------------+ 列出某个组中的安全规则 [root@station140 ~(keystone_admin)]# nova secgroup-list-rules default +-------------+-----------+---------+----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+----------+--------------+ | | | | | default | | | | | | default | +-------------+-----------+---------+----------+--------------+ 增加规则方法 (允许 ping) [root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry icmp -1 -1 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | icmp | -1 | -1 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 增加规则方法 (允许 ssh) [root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry tcp 22 22 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | tcp | 22 | 22 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 增加规则方法 (允许 dns 外部访问) [root@station140 ~(keystone_admin)]# nova secgroup-add-rule terry udp 53 53 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | udp | 53 | 53 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 列出自定义组规则 [root@station140 ~(keystone_admin)]# nova secgroup-list-rules terry +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | tcp | 22 | 22 | 0.0.0.0/0 | | | udp | 53 | 53 | 0.0.0.0/0 | | | icmp | -1 | -1 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 尝试修改 default secgroup 列出 default secgroup 规则 [root@station140 ~(keystone_admin)]# nova secgroup-list-rules default +-------------+-----------+---------+----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+----------+--------------+ | | | | | default | | | | | | default | +-------------+-----------+---------+----------+--------------+ 添加规则 (允许 ping) [root@station140 ~(keystone_admin)]# nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | icmp | -1 | -1 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 添加规则 (允许 ssh) [root@station140 ~(keystone_admin)]# nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | tcp | 22 | 22 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 添加规则 (允许 dns外部访问) [root@station140 ~(keystone_admin)]# nova secgroup-add-rule default udp 53 53 0.0.0.0/0 +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | udp | 53 | 53 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 列出默认组规则 [root@station140 ~(keystone_admin)]# nova secgroup-list-rules default +-------------+-----------+---------+-----------+--------------+ | IP Protocol | From Port | To Port | IP Range | Source Group | +-------------+-----------+---------+-----------+--------------+ | | | | | default | | icmp | -1 | -1 | 0.0.0.0/0 | | | tcp | 22 | 22 | 0.0.0.0/0 | | | | | | | default | | udp | 53 | 53 | 0.0.0.0/0 | | +-------------+-----------+---------+-----------+--------------+ 删除某个实例, 使用中的规则 nova remove-secgroup terry_instance1 terry 注: 在虚拟机启动后, 无法在增加其他规则 

优秀的个人博客,低调大师

openstack 命令行管理十五 - 浮动 IP 管理 (备忘)

帮助 [root@station140 ~(keystone_admin)]# nova help | grep float add-floating-ip Add a floating IP address to a server. floating-ip-bulk-create Bulk create floating ips by range. floating-ip-bulk-delete Bulk delete floating ips by range. floating-ip-bulk-list List all floating ips. floating-ip-create Allocate a floating IP for the current tenant. floating-ip-delete De-allocate a floating IP. floating-ip-list List floating ips for this tenant. floating-ip-pool-list List all floating ip pools. remove-floating-ip Remove a floating IP address from a server. 生成 浮动 IP [root@station140 ~(keystone_admin)]# nova floating-ip-create pub1 +----------------+-------------+----------+------+ | Ip | Instance Id | Fixed Ip | Pool | +----------------+-------------+----------+------+ | 192.168.48.143 | None | None | pub1 | +----------------+-------------+----------+------+ 分配 [root@station140 ~(network_admin)]# nova add-floating-ip terry_instance1 192.168.48.143 查询浮动 IP 分配情况 [root@station140 ~(keystone_admin)]# nova floating-ip-list +----------------+--------------------------------------+-----------+------+ | Ip | Instance Id | Fixed Ip | Pool | +----------------+--------------------------------------+-----------+------+ | 192.168.48.143 | 93d0c9c1-b38b-4fe3-9ae3-400f43276f60 | 10.0.0.50 | pub1 | +----------------+--------------------------------------+-----------+------+ 移除浮动 IP [root@station140 ~(keystone_admin)]# nova floating-ip-delete 192.168.48.143 

优秀的个人博客,低调大师

openstack 命令行管理四 - 资源管理 (备忘)

 配额用于对每个 tenants 进行限制, 如浮动 IP, 内存, CPU, 磁盘, 密钥, 安全规则, 云硬盘等 资源管理帮助 [root@station140 ~(keystone_admin)]# nova help | grep quota quota-class-show List the quotas for a quota class. quota-class-update Update the quotas for a quota class. quota-defaults List the default quotas for a tenant. quota-delete Delete quota for a tenant/user so their quota will quota-show List the quotas for a tenant/user. quota-update Update the quotas for a tenant/user. 可管理资源 fixed-ips 每个 project 可用固定 IP 地址, 必须大于等于实例可用的 IP 地址数量 floating-ips 每个 project 可用的浮动 IP 地址 injected-file-content-bytes 添加的文件最大可包含多少 bytes injected-file-path-bytes 指定的文件目录下最大可包含的文件 bytes injected-files 每个 project 可以包含的文件数量 instances 每个 project 可包含的最多的 instances 数量 key-pairs 每个用户可用的 key-pairs 的数量 metadata-items 每个实例可拥有的 metadata-items 数量 ram 允许每个 project 中的 instances 可用的 ram (MB) 数量 security-group-rules 可用的安全组规则 security-groups 每个 project 的安全组 cores 每个 project 可用的虚拟 CPU 个数 显示 [root@station140 ~(keystone_admin)]# nova quota-defaults +-----------------------------+-------+ | Quota | Limit | +-----------------------------+-------+ | instances | 10 | | cores | 20 | | ram | 51200 | | floating_ips | 10 | | fixed_ips | -1 | | metadata_items | 128 | | injected_files | 5 | | injected_file_content_bytes | 10240 | | injected_file_path_bytes | 255 | | key_pairs | 100 | | security_groups | 10 | | security_group_rules | 20 | +-----------------------------+-------+ 更新方法 [root@station140 ~(keystone_admin)]# nova quota-class-update --instances 20 default [root@station140 ~(keystone_admin)]# nova quota-defaults +-----------------------------+-------+ | Quota | Limit | +-----------------------------+-------+ | instances | 20 | 建议直接通过 horizon 对每个租户进行配额限制, 方便简单, 准确 通过数据库方法对 quota 进行查询会更加准确 表一, 用于查询 内核, 实例, 内存, 安全组资源 mysql> select a.name, b.resource, b.hard_limit from keystone.project a, nova.quotas b where a.enabled=1 and b.deleted=0 and a.id=b.project_id and a.name='admin'; +-------+-----------------------------+------------+ | name | resource | hard_limit | +-------+-----------------------------+------------+ | admin | cores | 500 | | admin | injected_files | 50 | | admin | injected_file_content_bytes | 10240 | | admin | instances | 200 | | admin | metadata_items | 128 | | admin | ram | 1024000 | | admin | security_groups | 10 | | admin | security_group_rules | 20 | +-------+-----------------------------+------------+ 8 rows in set (0.00 sec) 表二, 用于查询云盘大小, 云盘快照, 云盘数量配额 mysql> select a.name, b.resource, b.hard_limit from keystone.project a, cinder.quotas b where a.enabled=1 and b.deleted=0 and a.id=b.project_id and a.name='admin'; +-------+-----------+------------+ | name | resource | hard_limit | +-------+-----------+------------+ | admin | gigabytes | 10000 | | admin | snapshots | 10 | | admin | volumes | 100 | +-------+-----------+------------+ 3 rows in set (0.00 sec) 表三, 用于查询对路由, 网络安全策略, 浮动IP, IP 地址的配额限制 mysql> select a.name, b.resource, b.limit from keystone.project a, neutron.quotas b where a.enabled=1 and a.id=b.tenant_id and a.name='QA'; +------+---------------------+-------+ | name | resource | limit | +------+---------------------+-------+ | QA | router | 1000 | | QA | security_group_rule | 10000 | | QA | subnet | 1000 | | QA | network | 1000 | | QA | security_group | 1000 | | QA | floatingip | 5000 | | QA | port | 8172 | +------+---------------------+-------+ 7 rows in set (0.00 sec)

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册